Skip to content

docs(ai): AI_ARCHITECTURE.md 同步 wps_* 别名已移除(PR#189) - #190

Merged
zeweihan merged 3 commits into
masterfrom
claude/wps-cleanup-docs-sync
Jul 24, 2026
Merged

docs(ai): AI_ARCHITECTURE.md 同步 wps_* 别名已移除(PR#189)#190
zeweihan merged 3 commits into
masterfrom
claude/wps-cleanup-docs-sync

Conversation

@zeweihan

Copy link
Copy Markdown
Owner

PR#189 移除了 wps_→doc_ 灰度别名,本 PR 把 docs/AI_ARCHITECTURE.md §3「工具命名与别名」与 Phase 3 待办同步为移除后的事实,避免文档与代码矛盾。docs/ 目录被 .gitignore 忽略,已 git add -f。

🤖 Generated with Claude Code

zeweihan and others added 3 commits July 24, 2026 10:39
用户在编辑器里开着文档说"帮我修订一下",模型却先 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>
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>
§3 别名清单与 Phase 3 待办中的"移除不早于 0.6.0"约定已兑现,
文档改为记录移除事实与移除后行为,避免与代码矛盾。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@zeweihan
zeweihan merged commit c2dfd4b into master Jul 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant