diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index e436437f..1a625a57 100755 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -983,6 +983,7 @@ export default { allowedTools: 'Allowed Tools', multiTurn: 'Multi-turn Conversation', historyTurns: 'History Turns', + retainRetrievalHistory: 'Keep retrieval results', memoryEnabled: 'Long-term Memory', retrievalStrategy: 'Retrieval Strategy', embeddingTopK: 'Embedding Top K', @@ -5266,8 +5267,10 @@ export default { maxTokens: 'Maximum number of tokens for model-generated responses', thinking: 'Enable extended thinking capability (requires model support)', conversationSection: 'Configure multi-turn conversation and query rewriting parameters', + conversationSectionAgent: 'How much earlier conversation each turn carries. Smart reasoning is always multi-turn', multiTurn: 'When enabled, historical conversation context will be preserved', historyRounds: 'Number of recent conversation rounds to keep as context', + retainRetrievalHistory: 'Keep knowledge base results from earlier turns. When off, each turn searches again', rewrite: 'Automatically rewrite user questions in multi-turn conversations to resolve references and omissions', memoryEnabled: 'Let this agent read and add to your long-term memory. When off, conversations with it neither read your memories nor add new ones. Turning it on here has no effect while the workspace or personal switch is off', queryUnderstandModel: 'Model used for query understanding (rewriting and intent detection). Leave empty to reuse the main chat model.', diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts index e3781e30..b53422b9 100755 --- a/frontend/src/i18n/locales/ko-KR.ts +++ b/frontend/src/i18n/locales/ko-KR.ts @@ -1103,8 +1103,10 @@ export default { maxTokens: '모델이 생성하는 응답의 최대 토큰 수', thinking: '모델의 확장 사고 기능 활성화 (모델 지원 필요)', conversationSection: '다중 턴 대화 및 질문 재작성 관련 매개변수 설정', + conversationSectionAgent: '매 턴에 실어 보낼 이전 대화 분량 설정 (스마트 추론은 항상 다중 턴)', multiTurn: '활성화하면 대화 기록 컨텍스트가 유지됩니다', historyRounds: '컨텍스트로 유지할 최근 대화 라운드 수', + retainRetrievalHistory: '이전 턴의 지식베이스 검색 결과를 유지합니다. 끄면 매 턴 새로 검색합니다', rewrite: '다중 턴 대화에서 사용자 질문을 자동으로 재작성하여 지시대명사 해소 및 생략 보완', memoryEnabled: '이 에이전트가 장기 기억을 읽고 추가하도록 허용합니다. 끄면 이 에이전트와의 대화에서 기억을 읽지도, 새로 추가하지도 않습니다. 공간 또는 개인 설정이 꺼져 있으면 여기서 켜도 적용되지 않습니다', queryUnderstandModel: '질문 이해(재작성과 의도 분류)에 사용할 모델입니다. 비워 두면 기본 대화 모델을 사용합니다.', @@ -5457,6 +5459,7 @@ export default { allowedTools: '허용된 도구', multiTurn: '여러 라운드의 대화', historyTurns: '라운드 수를 유지하세요', + retainRetrievalHistory: '검색 결과 유지', memoryEnabled: '장기 기억', retrievalStrategy: '검색 전략', embeddingTopK: '벡터 회수 횟수', diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts index c54f0892..bcfed2c3 100755 --- a/frontend/src/i18n/locales/ru-RU.ts +++ b/frontend/src/i18n/locales/ru-RU.ts @@ -1103,8 +1103,10 @@ export default { maxTokens: 'Максимальное количество токенов в ответе модели', thinking: 'Включить расширенное мышление модели (требуется поддержка модели)', conversationSection: 'Настройка параметров многооборотного диалога и перефразирования вопросов', + conversationSectionAgent: 'Объём предыдущего диалога в каждом ходе. Умные рассуждения всегда многооборотные', multiTurn: 'При включении сохраняется контекст истории диалога', historyRounds: 'Количество последних раундов диалога для сохранения в контексте', + retainRetrievalHistory: 'Сохранять результаты поиска из прошлых ходов. При отключении каждый ход ищет заново', rewrite: 'Автоматическое перефразирование вопросов в многооборотном диалоге для разрешения ссылок и дополнения', memoryEnabled: 'Разрешить этому агенту читать и пополнять вашу долговременную память. При выключении разговоры с ним не читают ваши записи и не добавляют новые. Если память выключена в настройках пространства или в личных настройках, включение здесь не подействует', queryUnderstandModel: 'Модель для понимания запроса (перефразирование и распознавание намерения). Пустое значение — использовать основную модель чата.', @@ -5457,6 +5459,7 @@ export default { allowedTools: 'Allowed Tools', multiTurn: 'Multi-turn Conversation', historyTurns: 'History Turns', + retainRetrievalHistory: 'Сохранять результаты поиска', memoryEnabled: 'Долговременная память', retrievalStrategy: 'Retrieval Strategy', embeddingTopK: 'Embedding Top K', diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index dc7b26e6..da723462 100755 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -1105,8 +1105,10 @@ export default { maxTokens: '模型生成回复的最大Token数量', thinking: '启用模型的扩展思考能力(需要模型支持)', conversationSection: '配置多轮对话开关与问题改写开关(改写提示词见「提示词」)', + conversationSectionAgent: '配置每轮携带多少历史对话。智能推理始终为多轮模式。', multiTurn: '开启后将保留历史对话上下文', historyRounds: '保留最近几轮对话作为上下文', + retainRetrievalHistory: '保留此前轮次的知识库检索结果。关闭时每轮重新检索', rewrite: '多轮对话时自动改写用户问题,消解指代和补全省略', memoryEnabled: '允许该智能体读取并补充你的长期记忆。关闭后,与它的对话既不会读取记忆,也不会新增记忆。空间或个人设置关闭时,这里开启也不会生效', queryUnderstandModel: '用于问题理解(改写与意图识别)的模型,留空则复用主对话模型', @@ -5459,6 +5461,7 @@ export default { allowedTools: '允许的工具', multiTurn: '多轮对话', historyTurns: '保留轮数', + retainRetrievalHistory: '保留检索结果', memoryEnabled: '长期记忆', retrievalStrategy: '检索策略', embeddingTopK: '向量召回数量', diff --git a/frontend/src/views/agent/AgentEditorModal.test.mjs b/frontend/src/views/agent/AgentEditorModal.test.mjs index 834c402d..437fa629 100644 --- a/frontend/src/views/agent/AgentEditorModal.test.mjs +++ b/frontend/src/views/agent/AgentEditorModal.test.mjs @@ -34,3 +34,77 @@ test('shows a post-create hint after the first successful save', () => { assert.match(source, /settings-footer-note/) assert.match(source, /agent\.editor\.postCreateHint\.title/) }) + +// Locate a settings row by the i18n key of its label and return the attributes +// that sit before class="setting-row" — i.e. whatever v-if guards that row. +// Anchoring on the label keeps these assertions stable across reformatting. +function settingRowGuard(labelKey) { + const key = labelKey.replace(/\./g, '\\.') + const row = source.match( + new RegExp( + `]*)class="setting-row">\\s*
\\s*
-
@@ -861,16 +861,19 @@
- -
+ +

{{ $t('agent.editor.conversationSettings') }}

-

{{ $t('agentEditor.desc.conversationSection') }}

+

{{ conversationSectionDesc }}

- -
+ +

{{ $t('agentEditor.desc.multiTurn') }}

@@ -880,14 +883,26 @@
- -
+ +

{{ $t('agentEditor.desc.historyRounds') }}

- + +
+
+ + +
+
+ +

{{ $t('agentEditor.desc.retainRetrievalHistory') }}

+
+
+
@@ -2287,10 +2302,8 @@ const navItems = computed(() => { { key: 'model', icon: 'control-platform', label: t('agent.editor.modelConfig') }, { key: 'suggestions', icon: 'help-circle', label: t('agentEditor.questionSuggestions.navLabel') }, ]; - // 多轮对话(仅普通模式显示,Agent模式内部自动控制) - if (!isAgentMode.value) { - items.push({ key: 'conversation', icon: 'chat', label: t('agent.editor.conversationSettings') }); - } + // 多轮对话(两种模式都需要:Agent 模式同样按 history_turns 截断历史) + items.push({ key: 'conversation', icon: 'chat', label: t('agent.editor.conversationSettings') }); // 知识库与检索 items.push({ key: 'knowledge', icon: 'folder', label: t('agent.editor.knowledgeConfig') }); if (hasKnowledgeBase.value) { @@ -2412,6 +2425,7 @@ const defaultFormData = { // 多轮对话设置 multi_turn_enabled: false, history_turns: 5, + retain_retrieval_history: false, // 长期记忆:默认跟随空间设置。写 true 与不写等价,只有 false 才会 // 让这个智能体单独不读记忆。 memory_enabled: true, @@ -2524,6 +2538,14 @@ const hasAnyIntentCustomized = computed(() => intentPromptTemplates.value.some((item) => isIntentCustomized(item.id)), ); +// Agent 模式下本组只剩「保留轮数」(以及有知识库时的检索保留), +// 默认文案里的「问题改写」并不展示,故按模式分开。 +const conversationSectionDesc = computed(() => + isAgentMode.value + ? t('agentEditor.desc.conversationSectionAgent') + : t('agentEditor.desc.conversationSection'), +); + const showRewritePrompts = computed(() => !isAgentMode.value && formData.value.config.multi_turn_enabled @@ -3334,10 +3356,6 @@ watch(isAgentMode, (isAgent) => { if (isAgent && currentSection.value === 'advanced') { currentSection.value = 'basic'; } - // 如果当前在多轮对话页面但切换到了Agent模式,切换到基础设置(Agent模式下多轮对话由内部控制) - if (isAgent && currentSection.value === 'conversation') { - currentSection.value = 'basic'; - } }); // 监听设置弹窗关闭,刷新模型列表