Commit c2dfd4b
docs(ai): AI_ARCHITECTURE.md 同步 wps_* 别名已移除(PR#189) (#190)
* fix(ai): 活跃文档上下文识别——开着的文档不再被 list/open 重新发现
用户在编辑器里开着文档说"帮我修订一下",模型却先 doc_list_project_files
再 doc_open_file 去猜目标。根因有二:
1. system_prompt.md 使用规范第 1 条写死"修改前先用 doc_open_file 打开文档",
全文没有"当前活跃文档已打开"的概念,模型是照章办事;
2. ContextAssemblerService 的 <active_document> 注入措辞被动(只说定位参考
时可用),且正文读取失败时整块静默跳过,模型完全感知不到活跃文档。
修复:
- 注入文案明确"该文档已在编辑器中打开,doc_* 工具直接作用于它,无需
doc_list_project_files / doc_open_file";正文读不到也保留 id/name 标识;
- system_prompt.md 规范第 1 条改为"优先用当前活跃文档",仅编辑其他文档
时才先打开;
- 新增 ContextAssemblerServiceTest 三条断言覆盖上述行为。
后端全量 280 测试通过。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore(ai): WPS 灰度别名到期移除与后端去 WPS 化规范清理
Phase 2.5(PR#87)的 wps_*→doc_* 工具名别名约定 ≥0.6.0 移除,现已 0.7.9,
灰度到期,本次清理:
- ToolRegistry:删除 29 条 wps_* 别名(保留 search_laws→search_web);
旧名分发将收到"未知工具"反馈,模型按系统提示自纠为 doc_*;
- 测试:别名灰度测试改为移除守护(wps_* 不再命中、别名表无 wps_ 条目);
- 回放夹具/冒烟 prompt:wps_find_replace → doc_find_replace;
- AgentStreamHandler:内部标识符去 WPS 化(onEditorStream/editorStreamBuffer
等),SSE 事件名 wps_stream_data 为前后端契约保持不变;
- PptxTools/FileTools:过时的"WPS 编辑器"注释、@tool 描述与用户面文案
改为"文档编辑器",内部方法 modifyWithWpsApi→modifyWithEditorApi。
明确保留(均为契约或存量数据,另行专项处理):
- SSE action/事件名与路由:wps_open_file / wps_reload_file / wps_command /
wps_stream_data / /api/ai/agent/wps-result(docs/ai_agent_dev.md §2.2);
- ProjectFile.wpsFileId 及 DB 列、API JSON 字段(前端广泛引用+存量数据);
- 存储路径前缀 wps-files/(存量磁盘目录);
- FileTools 返回 JSON key wps_file_id(LLM 面输出与老对话历史一致性)。
后端全量 278 测试通过。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs(ai): AI_ARCHITECTURE.md 同步 wps_* 别名已移除(PR#189)
§3 别名清单与 Phase 3 待办中的"移除不早于 0.6.0"约定已兑现,
文档改为记录移除事实与移除后行为,避免与代码矛盾。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent cf59f4b commit c2dfd4b
1 file changed
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
178 | 179 | | |
179 | 180 | | |
180 | 181 | | |
181 | | - | |
| 182 | + | |
182 | 183 | | |
183 | 184 | | |
184 | 185 | | |
| |||
0 commit comments