移除对 copilot 的兼容。更新示例和文档,统一使用 session_id 代替 conversationId
This commit is contained in:
+11
-11
@@ -3,17 +3,17 @@
|
||||
## 1) 总体原则
|
||||
|
||||
- Skills 负责“告诉模型可做什么”。
|
||||
- `chat/stream` 内部启动 LLM 会话,并注册工具 `dynamic_http_call`。
|
||||
- LLM 通过工具调用后端能力,不直接发 HTTP。
|
||||
- Sidecar 执行器负责“代表当前用户调真实后端 API”(动态路径,无白名单)。
|
||||
- `chat/stream` 内部启动 opencode 会话,并注册工具 `dynamic_http_call`。
|
||||
- opencode agent 通过工具调用后端能力,不直接发 HTTP。
|
||||
- TJWaterAgent 执行器负责“代表当前用户调真实后端 API”(动态路径,无白名单)。
|
||||
|
||||
## 2) 请求入口(前端)
|
||||
|
||||
- `POST /api/v1/copilot/chat/stream`(唯一前端入口)
|
||||
- `POST /api/v1/agent/chat/stream`(唯一前端入口)
|
||||
|
||||
不提供 `/execute` 对外调用路径,统一通过 `chat/stream` + 工具调用链执行。
|
||||
|
||||
## 3) 工具参数约定(LLM 调用工具时)
|
||||
## 3) 工具参数约定(opencode agent 调用工具时)
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -53,18 +53,18 @@
|
||||
前端工具(`locate_features`, `view_history`, `view_scada`, `show_chart`)的调用链与 `dynamic_http_call` 不同:
|
||||
|
||||
```
|
||||
用户消息 → LLM → function calling → 调用前端工具 (如 locate_features)
|
||||
用户消息 → opencode agent → tool calling → 调用前端工具 (如 locate_features)
|
||||
↓
|
||||
tool handler:
|
||||
1) 推送 SSE tool_call 事件到前端
|
||||
2) 返回简短确认给 LLM("已定位到管道")
|
||||
2) 返回简短确认给 opencode agent("已定位到管道")
|
||||
↓
|
||||
前端同时收到:
|
||||
- SSE event: tool_call → 前端执行操作(定位地图/打开面板/渲染图表)
|
||||
- SSE event: token → 渲染 LLM 文字回复
|
||||
- SSE event: token → 渲染 opencode agent 文字回复
|
||||
```
|
||||
|
||||
关键区别:
|
||||
- `dynamic_http_call`:Sidecar 代理 HTTP 请求,结果返回给 LLM 做后续分析。
|
||||
- 前端工具:Sidecar 仅推送 SSE 事件,前端直接执行,结果不返回 LLM。
|
||||
- `show_chart`:LLM 先通过 `dynamic_http_call` 查询数据,处理为 x_data + series 格式后调用 `show_chart`,前端直接渲染图表,不再请求后端。
|
||||
- `dynamic_http_call`:TJWaterAgent 代理 HTTP 请求,结果返回给 opencode agent 做后续分析。
|
||||
- 前端工具:TJWaterAgent 仅推送 SSE 事件,前端直接执行,结果不返回 opencode agent。
|
||||
- `show_chart`:opencode agent 先通过 `dynamic_http_call` 查询数据,处理为 x_data + series 格式后调用 `show_chart`,前端直接渲染图表,不再请求后端。
|
||||
|
||||
Reference in New Issue
Block a user