Skip to content

[Cleanup] 处理 windows/tauri/src/features/ai 历史遗留 AI 前端(无后端、默认不可用) #957

Description

@puppyben1

Problem to solve / 要解决的问题

windows/tauri/src/features/ai/(113 个文件)是历史遗留代码。#440 已判定它"裁剪自其他开源项目,不作为本方案的参考依据",但它仍然留在仓库里参与构建,而且会误导人。

它现在的实际状态是没有后端的前端:

  • 前端调用 get_acp_status、acp_*、get_available_agents 等命令,但 windows/tauri/src-tauri 从未实现过这些命令:platform.rs 只特判 ai_commit_*,translate() 里没有任何 agent 命令,未命中时会直接返回 Windows platform command is not implemented。
  • backend-capabilities.ts 里 agent: false,capabilityForCommand 会把上述命令全部判成 agent 能力并在 invoke 前直接拒绝;defaultSettings.coreFeatures.aiChat 也是 false。
  • windows/tauri/src/mocks/tauri-api-mock.ts 用 mock 顶替了这些命令,文件注释写得很直白:"allows the UI to compile and run without the Rust backend"。

造成的影响:

  • 贡献者会误判 Windows 已经有 Agent 实现。我就因此把它当成可复用的地基,直到翻了 platform_invoke 和 translate() 才发现是死代码。
  • 它仍然参与 typecheck 和前端测试,是纯维护成本。
  • 将来做 Windows Agent 面板时,很容易被人顺手复用,等于把 [Feature] Agent 对话模块:以 ACP 客户端方式接入外部 Agent #440 已经否掉的设计带回来。

Proposed solution / 建议方案

请维护者二选一,选完我来执行:

  1. 删除(倾向):移除 windows/tauri/src/features/ai/,同步清理 backend-capabilities.ts 的 agent 判定、tauri-api-mock.ts、i18n 文案、设置页 ai-settings、sidebar-history 的 agent 会话分支、pane-container 的 agent tab 分支及相关测试。
  2. 隔离:移到明确的遗留目录并在 docs/ 标注为非参考实现,写清它不接任何后端。保留的唯一理由是参考 UI 形状,而 [Feature] Agent 对话模块:以 ACP 客户端方式接入外部 Agent #440 已经判定不能参考。

需要先确认的边界

windows/tauri/src/features/editor/inline-edit/* 会 import features/ai 的 provider 代码(provider-fetch、ai-token-service、use-available-providers 等),fixed 与 settings-effects.ts 也有引用。如果 inline edit 是打算保留的产品能力,这部分 provider/HTTP 代码需要先搬到中立目录,删除范围只覆盖 Agent 与 chat 相关文件。

Target platform / 目标平台

Windows

Additional context / 补充信息

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform:windowsWindows平台需求review: mediumghfind author score; see https://ghfind.com

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions