diff --git a/frontend/src/api/system/index.ts b/frontend/src/api/system/index.ts index 92aa30e4..3f26b722 100644 --- a/frontend/src/api/system/index.ts +++ b/frontend/src/api/system/index.ts @@ -71,9 +71,8 @@ export interface ParserEngineInfo { UnavailableReason?: string } -/** 解析引擎配置(引擎相关存空间;docreader 地址由环境变量配置) */ +/** 解析引擎配置(引擎连接参数存空间;聊天附件解析策略在智能体中配置) */ export interface ParserEngineConfig { - chat_parser_engine_rules?: Array<{ file_types: string[]; engine: string }> docreader_addr?: string docreader_transport?: string mineru_endpoint?: string diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index 10d048c4..106f7dc8 100755 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -1355,9 +1355,6 @@ export default { docs: 'Docs', loadFailed: 'Failed to load parser engine list', ensureDocreaderConnected: 'Please ensure the DocReader service is configured via environment variables and connected', - chatPolicyTitle: 'Chat attachment parser policy', - chatPolicyDescription: 'Set the default parser per file type for chat attachments at the workspace level. Individual agents can override these rules.', - chatPolicySaved: 'Chat attachment parser policy saved', checkDoneStatusUpdated: 'Checked with current parameters. Status above has been updated.', checkSuccess: 'Test Connection Successful', checkFailed: 'Check failed', diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts index 35652f46..16d1d425 100755 --- a/frontend/src/i18n/locales/ko-KR.ts +++ b/frontend/src/i18n/locales/ko-KR.ts @@ -1194,9 +1194,6 @@ export default { title: '파서 엔진', description: '문서 파서 엔진 상태 및 구성. 이 설정은 서버 환경변수보다 우선 적용됩니다. 비워두면 환경변수 기본값을 사용합니다.', // Section / label keys for the redesigned drawer - chatPolicyTitle: '채팅 첨부 파일 파서 정책', - chatPolicyDescription: '파일 형식별 채팅 첨부 파서를 공간 기본값으로 지정합니다. 개별 에이전트에서 덮어쓸 수 있습니다.', - chatPolicySaved: '채팅 첨부 파일 파서 정책을 저장했습니다', supportedFileTypes: '지원 형식', statusSection: '상태', configSection: '구성', diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts index 9146d178..ae378ee1 100755 --- a/frontend/src/i18n/locales/ru-RU.ts +++ b/frontend/src/i18n/locales/ru-RU.ts @@ -1272,9 +1272,6 @@ export default { checkFailed: 'Проверка не пройдена', saveSuccess: 'Сохранено', saveFailed: 'Ошибка сохранения', - chatPolicyTitle: 'Политика обработки вложений чата', - chatPolicyDescription: 'Задайте парсер по умолчанию для каждого типа вложений чата на уровне пространства. Отдельные агенты могут переопределить эти правила.', - chatPolicySaved: 'Политика обработки вложений сохранена', mineruEndpointPlaceholder: 'напр. https://your-mineru.example.com', defaultPipeline: 'Pipeline по умолчанию', languagePlaceholder: 'напр. ch, en, ja (по умолчанию ch)', diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index 1da18fb5..b9f0b648 100755 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -1232,9 +1232,6 @@ export default { checkFailed: "检测失败", saveSuccess: "保存成功", saveFailed: "保存失败", - chatPolicyTitle: "聊天附件解析策略", - chatPolicyDescription: "为不同文件类型指定聊天附件使用的解析引擎,作为空间级默认;单个智能体可覆盖此配置。", - chatPolicySaved: "聊天附件解析策略已保存", mineruEndpointPlaceholder: "如 https://your-mineru.example.com", defaultPipeline: "默认 pipeline", languagePlaceholder: "如 ch、en、ja(默认 ch)", diff --git a/frontend/src/views/settings/ParserEngineSettings.vue b/frontend/src/views/settings/ParserEngineSettings.vue index a9e29868..23867603 100644 --- a/frontend/src/views/settings/ParserEngineSettings.vue +++ b/frontend/src/views/settings/ParserEngineSettings.vue @@ -91,23 +91,6 @@ -
-
-
-

{{ $t('settings.parser.chatPolicyTitle') }}

-

{{ $t('settings.parser.chatPolicyDescription') }}

-
- - {{ $t('common.save') }} - -
- -
@@ -395,7 +378,6 @@ import { useUIStore } from '@/stores/ui' import { useAuthStore } from '@/stores/auth' import { MessagePlugin } from 'tdesign-vue-next' import SettingDrawer from '@/components/settings/SettingDrawer.vue' -import KBParserSettings, { type ParserEngineRule } from '@/views/knowledge/settings/KBParserSettings.vue' import { getParserEngines, getParserEngineConfig, @@ -411,11 +393,6 @@ const uiStore = useUIStore() const authStore = useAuthStore() const CONFIGURABLE_ENGINES = new Set(['mineru', 'mineru_cloud', 'paddleocr_vl', 'paddleocr_vl_cloud']) -const CHAT_PARSER_EXTENSIONS = [ - 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'epub', 'mhtml', - 'txt', 'md', 'markdown', 'csv', 'json', 'xml', 'html', 'yaml', 'yml', 'log', - 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'webp', -] /** 各解析引擎的项目/官方文档地址 */ const ENGINE_DOC_LINKS: Record = { @@ -462,8 +439,6 @@ const error = ref('') const config = ref({ ...DEFAULT_PARSER_CONFIG }) const saving = ref(false) -const savingPolicy = ref(false) -const chatParserEngineRules = ref([]) const saveMessage = ref('') const saveSuccess = ref(false) const checking = ref(false) @@ -590,9 +565,7 @@ async function loadConfig() { paddleocr_vl_cloud_model: data?.paddleocr_vl_cloud_model ?? DEFAULT_PARSER_CONFIG.paddleocr_vl_cloud_model ?? 'PaddleOCR-VL-1.6', paddleocr_vl_cloud_use_seal_recognition: data?.paddleocr_vl_cloud_use_seal_recognition ?? DEFAULT_PARSER_CONFIG.paddleocr_vl_cloud_use_seal_recognition ?? true, paddleocr_vl_cloud_use_chart_recognition: data?.paddleocr_vl_cloud_use_chart_recognition ?? DEFAULT_PARSER_CONFIG.paddleocr_vl_cloud_use_chart_recognition ?? false, - chat_parser_engine_rules: data?.chat_parser_engine_rules ?? [], } - chatParserEngineRules.value = [...(data?.chat_parser_engine_rules ?? [])] } catch { config.value = { ...DEFAULT_PARSER_CONFIG } } @@ -607,7 +580,6 @@ async function loadAll() { function buildConfigPayload(): ParserEngineConfig { return { - chat_parser_engine_rules: chatParserEngineRules.value, docreader_addr: config.value.docreader_addr?.trim() ?? '', docreader_transport: (config.value.docreader_transport ?? 'grpc').trim() || 'grpc', mineru_endpoint: config.value.mineru_endpoint?.trim() ?? '', @@ -633,19 +605,6 @@ function buildConfigPayload(): ParserEngineConfig { } } -async function saveChatParserPolicy() { - savingPolicy.value = true - try { - const res = await updateParserEngineConfig(buildConfigPayload()) - if (res?.data) config.value = { ...config.value, ...res.data } - MessagePlugin.success(t('settings.parser.chatPolicySaved')) - } catch (e: any) { - MessagePlugin.error(e?.message || t('settings.parser.saveFailed')) - } finally { - savingPolicy.value = false - } -} - async function onCheck() { if (!connected) { checkMessage.value = t('settings.parser.ensureDocreaderConnected') @@ -783,33 +742,6 @@ onMounted(loadAll) padding: 16px 0; } -.chat-parser-policy { - margin-top: 28px; - padding-top: 24px; - border-top: 1px solid var(--td-component-stroke); - - &__header { - display: flex; - align-items: flex-start; - justify-content: space-between; - gap: 20px; - margin-bottom: 16px; - - h3 { - margin: 0 0 6px; - font-size: 16px; - color: var(--td-text-color-primary); - } - - p { - margin: 0; - color: var(--td-text-color-secondary); - font-size: 13px; - line-height: 1.5; - } - } -} - .empty-state { padding: 48px 0; text-align: center; diff --git a/internal/types/config_redaction.go b/internal/types/config_redaction.go index 99fbdd17..9e228954 100644 --- a/internal/types/config_redaction.go +++ b/internal/types/config_redaction.go @@ -168,6 +168,11 @@ func MergeParserEngineConfigForUpdate(incoming, existing *ParserEngineConfig) *P } out.MinerUAPIKey = PreserveIfRedacted(out.MinerUAPIKey, prev.MinerUAPIKey) out.PaddleOCRVLCloudToken = PreserveIfRedacted(out.PaddleOCRVLCloudToken, prev.PaddleOCRVLCloudToken) + // Chat attachment parser rules are configured per agent; preserve any legacy + // tenant-level rules when the settings UI omits this field on engine updates. + if incoming.ChatParserEngineRules == nil && existing != nil { + out.ChatParserEngineRules = existing.ChatParserEngineRules + } return &out } diff --git a/internal/types/config_redaction_test.go b/internal/types/config_redaction_test.go index 60098d0b..8a7d643f 100644 --- a/internal/types/config_redaction_test.go +++ b/internal/types/config_redaction_test.go @@ -58,6 +58,21 @@ func TestMergeParserEngineConfigForUpdate_PreservesRedactedSecrets(t *testing.T) assert.Equal(t, "http://mineru-new", merged.MinerUEndpoint) } +func TestMergeParserEngineConfigForUpdate_PreservesLegacyChatParserRules(t *testing.T) { + existing := &ParserEngineConfig{ + ChatParserEngineRules: []ParserEngineRule{ + {FileTypes: []string{"pdf"}, Engine: "mineru"}, + }, + } + incoming := &ParserEngineConfig{ + MinerUEndpoint: "http://mineru-new", + } + merged := MergeParserEngineConfigForUpdate(incoming, existing) + require.NotNil(t, merged) + require.Len(t, merged.ChatParserEngineRules, 1) + assert.Equal(t, "mineru", merged.ChatParserEngineRules[0].Engine) +} + func TestMergeStorageEngineConfigForUpdate_PreservesRedactedSecrets(t *testing.T) { existing := &StorageEngineConfig{ DefaultProvider: "minio",