mirror of
https://gitee.com/infiniflow/ragflow.git
synced 2025-12-06 07:19:03 +08:00
Feat: confluence space key (#11706)
# PR Description: Add Space Key Configuration for Confluence Data Source ### What problem does this PR solve? This PR addresses issue #11638 where users requested the ability to specify Confluence Space Keys when configuring a Confluence data source connector. **Problem:** Currently, the RAGFlow UI for Confluence data sources only provides fields for: - Username - Access Token - Wiki Base URL - Is Cloud checkbox There is no way to specify which Confluence space(s) to sync, causing RAGFlow to attempt syncing all accessible spaces. This is problematic for users who: - Only want to index specific spaces (e.g., only the HR or Documentation space) - Have access to many spaces but only need a subset - Want to avoid unnecessary data transfer and processing **Solution:** The backend `ConfluenceConnector` class already supports a `space` parameter in its `__init__()` method (line 1282 in `common/data_source/confluence_connector.py`), but this parameter was never exposed in the UI. This PR adds the missing UI field to allow users to configure space filtering. **User Impact:** Users can now: - Leave the field empty to sync all accessible spaces (default behavior) - Specify a single space key (e.g., `DEV`) - Specify multiple space keys separated by commas (e.g., `DEV,DOCS,HR`) This gives users fine-grained control over which Confluence content gets indexed into their RAGFlow knowledge base. Fixes #11638 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- ## Implementation Details ### Changes Made **1. Frontend UI (`web/src/pages/user-setting/data-source/contant.tsx`)** - Added "Space Key" text input field to Confluence configuration form - Field is optional (not required) - Positioned after "Is Cloud" checkbox for logical grouping - Added to initial values with empty string default **2. Internationalization (`web/src/locales/*.ts`)** - **English (`en.ts`)**: Added `confluenceSpaceKeyTip` with clear instructions and examples - **Chinese (`zh.ts`)**: Added Chinese translation for the tooltip - **Russian (`ru.ts`)**: Added Russian translation for the tooltip - **Bonus Fix**: Removed duplicate `deleteModal` object in `zh.ts` that was causing TypeScript lint errors ### Backend Compatibility No backend changes were needed! The `ConfluenceConnector` class already supports the `space` parameter: ```python def __init__( self, wiki_base: str, is_cloud: bool, space: str = "", # ← Already supported! page_id: str = "", index_recursively: bool = False, cql_query: str | None = None, ... ) ``` The connector uses this parameter to filter the CQL query (line 1328-1330): ```python elif space: uri_safe_space = quote(space) base_cql_page_query += f" and space='{uri_safe_space}'" ``` ### User Experience **Before:** - Users could only sync ALL accessible spaces - No UI option to limit scope **After:** - Users see "Space Key" field with helpful tooltip - Tooltip explains: - Optional field (leave empty for all spaces) - Single space example: `DEV` - Multiple spaces example: `DEV,DOCS,HR` - Available in English, Chinese, and Russian ### Future Enhancements Potential improvements for future PRs: - Add validation to check if space key exists before saving - Add autocomplete/dropdown to show available spaces - Add UI hints about space key format requirements - Support for page_id filtering (already supported in backend) --- ## Related Issues - Fixes #11638 - [Confluence] How to specify Space Key when adding Confluence data source?
This commit is contained in:
@@ -714,6 +714,8 @@ This auto-tagging feature enhances retrieval by adding another layer of domain-s
|
||||
'Check if this is a Confluence Cloud instance, uncheck for Confluence Server/Data Center',
|
||||
confluenceWikiBaseUrlTip:
|
||||
'The base URL of your Confluence instance (e.g., https://your-domain.atlassian.net/wiki)',
|
||||
confluenceSpaceKeyTip:
|
||||
'Optional: Specify a space key to limit syncing to a specific space. Leave empty to sync all accessible spaces. For multiple spaces, separate with commas (e.g., DEV,DOCS,HR)',
|
||||
s3PrefixTip: `Specify the folder path within your S3 bucket to fetch files from.
|
||||
Example: general/v2/`,
|
||||
S3CompatibleEndpointUrlTip: `Required for S3 compatible Storage Box. Specify the S3-compatible endpoint URL.
|
||||
|
||||
@@ -711,6 +711,8 @@ export default {
|
||||
'Отметьте, если это экземпляр Confluence Cloud, снимите для Confluence Server/Data Center',
|
||||
confluenceWikiBaseUrlTip:
|
||||
'Базовый URL вашего экземпляра Confluence (например, https://your-domain.atlassian.net/wiki)',
|
||||
confluenceSpaceKeyTip:
|
||||
'Необязательно: Укажите ключ пространства для синхронизации только определенного пространства. Оставьте пустым для синхронизации всех доступных пространств. Для нескольких пространств разделите запятыми (например, DEV,DOCS,HR)',
|
||||
s3PrefixTip: `Укажите путь к папке в вашем S3 бакете для получения файлов.
|
||||
Пример: general/v2/`,
|
||||
S3CompatibleEndpointUrlTip: `Требуется для S3 совместимого Storage Box. Укажите URL конечной точки, совместимой с S3.
|
||||
|
||||
@@ -701,6 +701,8 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于
|
||||
'检查这是否是 Confluence Cloud 实例,如果是 Confluence 服务/数据中心,则取消选中。',
|
||||
confluenceWikiBaseUrlTip:
|
||||
'Confluence Wiki 的基础 URL(例如 https://your-domain.atlassian.net/wiki)',
|
||||
confluenceSpaceKeyTip:
|
||||
'可选:指定空间键以限制同步到特定空间。留空则同步所有可访问的空间。多个空间请用逗号分隔(例如:DEV,DOCS,HR)',
|
||||
s3PrefixTip: `指定 S3 存储桶内的文件夹路径,用于读取文件。
|
||||
示例:general/v2/`,
|
||||
addDataSourceModalTital: '创建你的 {{name}} 链接',
|
||||
@@ -1903,16 +1905,5 @@ Tokenizer 会根据所选方式将内容存储为对应的数据结构。`,
|
||||
searchTitle: '尚未创建搜索应用',
|
||||
addNow: '立即添加',
|
||||
},
|
||||
|
||||
deleteModal: {
|
||||
delAgent: '删除智能体',
|
||||
delDataset: '删除知识库',
|
||||
delSearch: '删除搜索',
|
||||
delFile: '删除文件',
|
||||
delFiles: '删除文件',
|
||||
delFilesContent: '已选择 {{count}} 个文件',
|
||||
delChat: '删除聊天',
|
||||
delMember: '删除成员',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -230,6 +230,13 @@ export const DataSourceFormFields = {
|
||||
required: false,
|
||||
tooltip: t('setting.confluenceIsCloudTip'),
|
||||
},
|
||||
{
|
||||
label: 'Space Key',
|
||||
name: 'config.space',
|
||||
type: FormFieldType.Text,
|
||||
required: false,
|
||||
tooltip: t('setting.confluenceSpaceKeyTip'),
|
||||
},
|
||||
],
|
||||
[DataSourceKey.GOOGLE_DRIVE]: [
|
||||
{
|
||||
@@ -563,6 +570,7 @@ export const DataSourceFormDefaultValues = {
|
||||
config: {
|
||||
wiki_base: '',
|
||||
is_cloud: true,
|
||||
space: '',
|
||||
credentials: {
|
||||
confluence_username: '',
|
||||
confluence_access_token: '',
|
||||
|
||||
Reference in New Issue
Block a user