Files
mnote/bugs/07-ai/done/7-59-page-ai-pi-omniroute-compat-overdisable-v1.md

53 lines
1.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 7-59 Page AI Pi OmniRoute 兼容修复过度降级
## 状态
- 已修复
- 日期:2026-07-11
- Owner`07-ai`
## 症状
为处理 Pi Rust 经 OmniRoute 偶发空回复,MNote 曾在 session `models.json` 中设置:
- `supportsTools=false`
- `supportsUsageInStreaming=false`
- 将请求改经 MNote 内置代理并删除 `stream_options`
普通文本回复恢复后,Pi 的原生 function calling 实际被关闭,MNote bridge、LightRAG、MCP 和扩展工具无法由模型调用。
## 根因
`pi_agent_rust 0.1.18``supportsTools=false` 时会完全省略 OpenAI 请求的 `tools` 字段,不存在文本工具调用 fallback。
进一步实测表明:
- Pi Rust 直连当前 OmniRoute 时,`stream_options.include_usage=false``true` 均能完成真实工具调用。
- OmniRoute `freefirst` 的少量空流是上游路由偶发现象,未与 `stream_options` 建立因果关系。
- 真实 Pi RPC 在 `supportsTools=true` 下可调用 `mnote_allowed_roots_describe`,收到 `pi-rust-native-context-file` 工具结果并完成第二轮回答。
本次空回复修复中真正需要保留的是:
- `apiKey` 使用裸环境变量名 `OPENAI_API_KEY`
- 不再把 `MNOTE_PI_CONTEXT_V1` 前缀注入模型可见 prompt
## 修复
- OmniRoute provider 恢复 `supportsTools=true`
- 恢复 `supportsUsageInStreaming=true`
- Pi Rust 恢复直连配置的 OmniRoute base URL
- 删除只为移除 `stream_options` 引入的 MNote 中转路由
- 增加 models 配置单测和静态 smoke 断言
## 验证
- `cargo test -p mnote-web page_ai_pi --lib`24 passed
- `cargo fmt --check`
- `node scripts/task-pi-lab-static-smoke.js`228 checks passed
- 真实 Chromium + 3000
- `supportsTools=true`
- `supportsUsageInStreaming=true`
- 工具调用:`mnote_allowed_roots_describe`
- 工具结果:`pi-rust-native-context-file`
- 最终回复:`PI_TOOLS_RESTORED_OK_1783711633924`