diff --git a/docs/swagger.yaml b/docs/swagger.yaml index d3fbc78c..ae6ca15c 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -429,7 +429,7 @@ definitions: type: integer image_storage_provider: description: |- - Storage provider for image uploads: "local", "minio", "cos", "tos" + Storage provider for image uploads: "local", "minio", "cos", "tos", "s3", "oss" Empty means use the global/tenant default provider. type: string image_upload_enabled: @@ -2067,12 +2067,14 @@ definitions: cos: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.COSEngineConfig' default_provider: - description: '"local", "minio", "cos", "tos", "s3"' + description: '"local", "minio", "cos", "tos", "s3", "oss"' type: string local: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.LocalEngineConfig' minio: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.MinIOEngineConfig' + oss: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.OSSEngineConfig' s3: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.S3EngineConfig' tos: @@ -2081,7 +2083,7 @@ definitions: github_com_Tencent_WeKnora_internal_types.StorageProviderConfig: properties: provider: - description: '"local", "minio", "cos", "tos"' + description: '"local", "minio", "cos", "tos", "s3", "oss"' type: string type: object github_com_Tencent_WeKnora_internal_types.SubmitJoinRequestRequest: @@ -2169,6 +2171,27 @@ definitions: secret_key: type: string type: object + github_com_Tencent_WeKnora_internal_types.OSSEngineConfig: + properties: + access_key: + type: string + bucket_name: + type: string + endpoint: + type: string + path_prefix: + type: string + region: + type: string + secret_key: + type: string + temp_bucket_name: + type: string + temp_region: + type: string + use_temp_bucket: + type: boolean + type: object github_com_Tencent_WeKnora_internal_types.Tenant: properties: agent_config: @@ -2671,8 +2694,10 @@ definitions: minio: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.MinIOEngineConfig' provider: - description: '"minio", "cos", "tos", or "s3"' + description: '"minio", "cos", "tos", "s3", or "oss"' type: string + oss: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.OSSEngineConfig' s3: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.S3EngineConfig' tos: @@ -2696,7 +2721,7 @@ definitions: description: short description for UI type: string name: - description: '"local", "minio", "cos", "tos"' + description: '"local", "minio", "cos", "tos", "s3", "oss"' type: string type: object internal_handler.TextRelationExtractionRequest: diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index dbaeeae4..eaecf48e 100755 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -708,6 +708,7 @@ export default { requestFailed: 'Request failed', cos: 'Tencent Cloud COS', tos: 'Volcengine TOS', + oss: 'Alibaba Cloud OSS', }, }, webSearchSettings: { diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index e31b058c..6dedae9b 100755 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -562,6 +562,7 @@ export default { requestFailed: "请求失败", cos: "腾讯云 COS", tos: "火山引擎 TOS", + oss: "阿里云 OSS", }, }, webSearchSettings: { diff --git a/frontend/src/utils/security.ts b/frontend/src/utils/security.ts index cacf5009..b5a35518 100644 --- a/frontend/src/utils/security.ts +++ b/frontend/src/utils/security.ts @@ -41,7 +41,7 @@ const DOMPurifyConfig = { 'display', 'pointer-events', 'cursor', 'data-emit', 'direction' ], // 允许的协议 - ALLOWED_URI_REGEXP: /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|(?:local|minio|cos|tos|s3):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i, + ALLOWED_URI_REGEXP: /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|(?:local|minio|cos|tos|s3|oss):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i, // 禁止的标签和属性 FORBID_TAGS: ['script', 'object', 'embed', 'form', 'input', 'button'], FORBID_ATTR: ['onerror', 'onload', 'onclick', 'onmouseover', 'onfocus', 'onblur'], @@ -119,7 +119,7 @@ function protectProviderImageSrcInHTML(html: string): string { .replace(/&/g, '&') .replace(/"/g, '"'); return html.replace( - /]*?)\ssrc=(["'])(local|minio|cos|tos|s3):(?:\/\/|//|//)([^"']+)\2([^>]*)>/gi, + /]*?)\ssrc=(["'])(local|minio|cos|tos|s3|oss):(?:\/\/|//|//)([^"']+)\2([^>]*)>/gi, (_m, before, quote, provider, restPathRaw, after) => { const restPath = decodeProviderURL(restPathRaw); const protectedSrc = `${provider}://${restPath}`; @@ -173,7 +173,7 @@ export function isValidURL(url: string): boolean { } // 允许 provider:// 形式,由前端后续鉴权拉取并替换为 blob URL - if (/^(local|minio|cos|tos|s3):\/\/\S+$/i.test(trimmed)) { + if (/^(local|minio|cos|tos|s3|oss):\/\/\S+$/i.test(trimmed)) { return true; } @@ -299,7 +299,7 @@ export async function hydrateProtectedFileImages(root: ParentNode | null | undef } const images = root.querySelectorAll( - 'img[data-protected-src], img[src^="local://"], img[src^="minio://"], img[src^="cos://"], img[src^="tos://"], img[src^="s3://"]', + 'img[data-protected-src], img[src^="local://"], img[src^="minio://"], img[src^="cos://"], img[src^="tos://"], img[src^="s3://"], img[src^="oss://"]', ); if (!images.length) { return; @@ -319,7 +319,7 @@ export async function hydrateProtectedFileImages(root: ParentNode | null | undef } img.dataset.authHydrated = '1'; - const isProviderScheme = /^(local|minio|cos|tos|s3):\/\//.test(sourceURL); + const isProviderScheme = /^(local|minio|cos|tos|s3|oss):\/\//.test(sourceURL); const requestURL = isProviderScheme ? `/files?${new URLSearchParams({ file_path: sourceURL }).toString()}` : sourceURL; diff --git a/frontend/src/views/agent/AgentEditorModal.vue b/frontend/src/views/agent/AgentEditorModal.vue index b6846e4b..2e7aaea1 100644 --- a/frontend/src/views/agent/AgentEditorModal.vue +++ b/frontend/src/views/agent/AgentEditorModal.vue @@ -1266,6 +1266,7 @@ const imageStorageOptions = computed(() => { { value: 'cos', label: t('settings.storage.engineCos'), disabled: statusMap.cos === false }, { value: 'tos', label: t('settings.storage.engineTos'), disabled: statusMap.tos === false }, { value: 's3', label: 'Amazon S3', disabled: statusMap.s3 === false }, + { value: 'oss', label: t('settings.storage.engineOss'), disabled: statusMap.oss === false }, ]; }); diff --git a/frontend/src/views/knowledge/settings/KBStorageSettings.vue b/frontend/src/views/knowledge/settings/KBStorageSettings.vue index c3ec4c8b..035fb4ce 100644 --- a/frontend/src/views/knowledge/settings/KBStorageSettings.vue +++ b/frontend/src/views/knowledge/settings/KBStorageSettings.vue @@ -114,6 +114,13 @@ const engineOptions = computed(() => { available: statusMap.s3, disabled: statusMap.s3 === false, }, + { + value: 'oss', + label: t('kbSettings.storage.engineOss'), + desc: t('kbSettings.storage.engineOssDesc'), + available: statusMap.oss, + disabled: statusMap.oss === false, + }, ] }) diff --git a/frontend/src/views/settings/Settings.vue b/frontend/src/views/settings/Settings.vue index 86abcb0a..bdbfab36 100644 --- a/frontend/src/views/settings/Settings.vue +++ b/frontend/src/views/settings/Settings.vue @@ -201,6 +201,7 @@ const navItems = computed(() => [ { key: 'cos', label: t('settings.storage.cos') }, { key: 'tos', label: t('settings.storage.tos') }, { key: 's3', label: 'AWS S3' }, + { key: 'oss', label: t('settings.storage.oss') }, ] }, { key: 'mcp', icon: 'tools', label: t('settings.mcpService') },