superagent请求问题修复

This commit is contained in:
andy committed 2026-09-06 01:40:15 +08:00
1 parent ee9d2d7cf1
commit 7243319bbb
19 files changed
+388 -74

No files matched your search

+15
View File
@@ -51,6 +51,20 @@ Nginx 不再直接调用 DashScope。它只负责 TLS、精确公开路径、基
这样保留了当前应急辅助场景的失败语义:断流或 Provider 协议不完整时,客户端不会把半截模型文本误当成已完成方案。代价是首版没有逐字动画;如后续必须实时输出,需要独立安全决策、取消/失败 UX 和新 Spec。
### 4.1 SuperAgent Trace 模式
上游消息流的 `include_trace` 由 `FIRE_SAFETY_SUPERAGENT_INCLUDE_TRACE` 控制,默认值为
`false`。两种模式都要求最终 AI 消息和顶层 `event: end`,但严格成功条件不同:
- 无 Trace:最终 AI 消息的 `finish_reason=stop` + 非空顶层 `message.final` + 顶层 `end`。
- Trace:最终内容 + `run.completed(status=success)` + 顶层 `end`。
无 Trace 只是不向调用方返回公开工具/步骤轨迹,不等于禁止 SuperAgent 执行中调用 MCP;Agent
是否实际调用消防工具仍必须通过完整对话和 `/mcp` 日志验证。当前受控诊断中,应用策略关闭
Trace 时 `include_trace=true` 返回 HTTP 403、Provider code `open_agent_trace_disabled`,
同一 Key 改为 `include_trace=false` 返回 HTTP 200。因此测试环境默认保持无 Trace;只有在外部
应用策略显式启用 `trace_policy.enabled=true` 后才可切换为 Trace 模式。
测试页面使用浏览器 `fetch` 发起 POST,以便同时设置 `xtoken` 并读取 SSE;它不会把 Token
写进 HTML、Cookie、localStorage、sessionStorage、URL 或服务端配置。用户每次打开页面都要手动
输入测试 `xtoken`,页面只在本次页面生命周期内使用该值。页面可展示用户输入的问题和最终回答,
@@ -79,4 +93,5 @@ Nginx 不再直接调用 DashScope。它只负责 TLS、精确公开路径、基
- [`chat-api-v1.md`](chat-api-v1.md)
- [`../workflows/user-chat.md`](../workflows/user-chat.md)
- [`../project/operations/nginx-public-entry.md`](../project/operations/nginx-public-entry.md)
- [`../project/integrations/superagent-openapi.md`](../project/integrations/superagent-openapi.md)
- [`../specs/fire-safety-ymd-chat-page-v1.md`](../specs/fire-safety-ymd-chat-page-v1.md)