【等待审核】feat(agent): 渐进式标题更新——话题漂移自动重生 + 专用模型配置#1144
Draft
climashscape wants to merge 1 commit into
Draft
Conversation
b75a611 to
2976d3a
Compare
- 普通主会话累计轮次达阈值且检测到话题漂移时,自动基于最近消息重新生成标题
- 新增 REGENERATE_TITLE IPC 通道,支持手动触发重生成(走同一漂移检测逻辑)
- settings 新增 progressiveTitleUpdateEnabled / titleModelChannelId / titleModelId,标题生成可绑定独立模型
- AgentSessionMeta 新增 lastTitleTurn 节流字段,AgentGenerateTitleInput 支持 messages/currentTitle 二选一
- sendMessage 入口持久化 channelId/modelId 到 meta,resolveTitleModel 回退路径对老会话不再秒退
- AgentHeader 的 Sparkles 按钮仅普通主会话渲染,与后端会话类型闸门对齐
- REGENERATE_TITLE IPC 返回结构化 RegenerateTitleResult { ok, reason, title },前端按 reason 给准确提示,不再用 null 一刀切误报"未偏离"
- bump packages/shared 版本号
2976d3a to
95eacc1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
实现渐进式会话标题更新:当对话话题显著偏离当前标题时,自动检测并重新生成标题,使侧边栏与顶栏始终反映最新对话主题。
核心机制
三道闸门节流:仅在普通主会话(排除子会话/定时会话)中生效,设置开关可控,距上次生成≥5轮才触发漂移检测,平衡"锚点稳定"与"及时更新"。
漂移判定:取最近6条消息做摘要,发往LLM比对当前标题——相同则只推进
lastTitleTurn不修改标题,不同则写回新标题。normalizeTitle归一化全角/半角标点空格差异避免假阳性漂移。CAS 并发安全:LLM调用期间若用户推进了新轮次(
lastTitleTurn已变),放弃写回让新一轮完成后重新判断。用户可操作
reason精�确提示(未漂移/无模型/无消息/不支持)改动
packages/shared/src/types/agent.ts(+32)AgentGenerateTitleInput扩展(messages/currentTitle)、RegenerateTitleResult、lastTitleTurn、REGENERATE_TITLE通道常量packages/shared/package.jsonapps/electron/src/main/lib/agent-orchestrator.ts(+403)apps/electron/src/main/lib/agent-service.ts(+8)regenerateAgentTitle导出apps/electron/src/main/lib/agent-session-manager.ts(+2)updateAgentSessionMeta的 Pick 追加lastTitleTurnapps/electron/src/main/lib/settings-service.ts(+3)progressiveTitleUpdateEnabled默认值(true)apps/electron/src/main/ipc.ts(+20)REGENERATE_TITLEhandler + 全窗口广播 TITLE_UPDATEDapps/electron/src/preload/index.ts(+7)regenerateAgentTitle桥接apps/electron/src/types/settings.ts(+6)apps/electron/src/renderer/atoms/ui-preferences.ts(+44)apps/electron/src/renderer/components/agent/AgentHeader.tsx(+68)apps/electron/src/renderer/components/settings/GeneralSettings.tsx(+50)apps/electron/src/renderer/main.tsx(+20)UiPreferencesInitializer扩展测试
紧急度
常规
备注
Closes #1079