From 79db56a87b26ed654c7c389a19dd61744d8935d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=AD=86?= <2685475410@qq.com> Date: Thu, 27 Aug 2026 09:34:19 +0800 Subject: [PATCH] =?UTF-8?q?M4b=EF=BC=9A=E5=9B=BA=E5=8C=96=20ai=5Fprovider?= =?UTF-8?q?=20=E5=88=A0=E9=99=A4=E6=89=8B=E6=9C=AF=E6=B8=85=E5=8D=95?= =?UTF-8?q?=EF=BC=8830+=20=E6=96=87=E4=BB=B6=E4=BE=A6=E5=AF=9F=E7=BB=93?= =?UTF-8?q?=E8=AE=BA=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/operations/rewrite-plan.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/operations/rewrite-plan.md b/docs/operations/rewrite-plan.md index 1e4fbfd..82379ca 100644 --- a/docs/operations/rewrite-plan.md +++ b/docs/operations/rewrite-plan.md @@ -115,6 +115,13 @@ - 验收:故障注入(首字超时切道、凭证级冷却、熔断恢复)通过;usage 与 Provider 对账抽样一致;灵台内无 Provider SDK import(rg 审计为空)。 - 证据(M4a,2026-08-27):OpenAI 兼容适配器(元炁共用协议)+ `SHENSHI_ENDPOINTS` env 端点目录;候选路由(Priority+粘性置首+冷却排尾兜底)、首字超时切道(首帧前不提交响应,失败整体回退 JSON)、401/403 凭证级冷却 10 分钟 vs 429/5xx/超时绑定级 30 秒、已写字节不换道;计量(stdout JSON `shenshi_usage` + `/me/usage` 聚合)。Go 测试 10 用例全绿(含四场景故障注入:首字超时切道/凭证冷却跳过/全败 JSON/用量聚合);跨进程 E2E:灵台 `HttpShenshiClient` → 真 Go 神识 → stub 流式往返通过。假上游跨进程拨号在本沙箱受出站限制,改以 Go 进程内 httptest 覆盖(同真实 TCP 语义)。 - M4b 待办:灵台生产流量切换与 **Python ai_provider 删除**(rg 审计 Provider SDK 归零)、BYOK 密钥表与归属计量、配额三段式、usage PG 落库与对账抽样、Anthropic/Gemini 适配器、神识阁用户页。 +- M4b 手术清单(2026-08-27 侦察固化,30+ 文件): + ① 后端删除:`app/ai_provider/`(26 文件,含 anthropic/openai 格式与 billing——神识已承接)、`services/ai_provider_admin.py`、`core/config/model_config.py`、`tests/ai_provider/`(16 文件); + ② 连带退役:`application/agent/`(旧 Agent 循环,steer/follow-up/确认注册表——live UI 已随 chat 页消亡,天工阁 M8 重建);`endpoints/audio.py`(ASR/TTS 归 P1 形仪域);`endpoints/settings.py` 与 `services/preferences.py` 中模型偏好字段(切神识阁);admin 网关端点与 `test_model_gateway_endpoints.py`;`main.py` 的 `reload_provider_manager`、conftest 的 endpoint 覆盖缓存清理; + ③ runs.py 修剪:`AgentRunRegistry`/`follow-up`/confirmations 端点随旧 Agent 循环退役,保留 kernel 契约端点; + ④ 前端删除:models 页、`lib/api/gateway.ts`、`ModelGatewayPanel`/`ModelStrategyForm`、mock 与 types 中的网关类型; + ⑤ 配置:`config/models|providers|pricing.example.yaml` 归档至 shenshi 目录或删除,`.env.example` 模型段收敛为 SHENSHI_*; + ⑥ 验收:rg 审计灵台无 Provider SDK import(`rg -l 'openai|anthropic' app/` 排除 shenshi_client 为空);全量后端/前端测试绿;迁移无涉及(纯代码删除)。 ### M5 百工与司命