Files
TJWaterAgent/.opencode/skills/examples.md
T

77 lines
2.0 KiB
Markdown
Raw 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.
# 示例(基于 opencode Agent + tjwater-cli 工具调用链)
## 示例 1:简单查询 SCADA 数据
用户意图:查询设备 `170490` 在时间范围内的 `monitored_value`
opencode agent 调用 `tjwater_cli`
```json
{
"reason": "查询设备170490在最近24小时的monitored_value数据",
"command": "data timeseries scada query --device-id 170490 --field monitored_value --start-time 2026-03-29T07:57:47+08:00 --end-time 2026-03-30T07:57:47+08:00"
}
```
## 示例 2:前端工具 — 地图定位
用户消息:"帮我找到管道 P-001 和 P-002"
opencode agent 直接调用前端工具 `locate_features`
```json
{
"reason": "在地图上定位用户请求的管道",
"ids": ["P-001", "P-002"],
"feature_type": "pipe"
}
```
## 示例 3:对话内图表
用户消息:"展示节点 J-001 最近一天的压力变化曲线"
典型链路:
1. `tjwater_cli(command="data timeseries realtime nodes --start-time ... --end-time ... --node-ids J-001")`
2. 处理返回的 pressure 数据为 x_data + series 格式
3. 调用 `show_chart` 渲染 ECharts 图表
## 示例 4:前端工具 — SCADA 监测面板
用户消息:"我想看看 J-001 的监测数据"
opencode agent 调用工具 `view_scada`
```json
{
"reason": "打开J-001的SCADA监测面板",
"device_ids": ["J-001"],
"start_time": "2026-03-29T00:00:00+08:00",
"end_time": "2026-03-30T00:00:00+08:00"
}
```
## 示例 5:命令发现
opencode agent 需要了解可用的 CLI 命令时:
```
tjwater_cli(command="help") → 获取一级命令清单
tjwater_cli(command="help analysis") → 获取 analysis 子命令详情
```
帮助输出 JSON 格式,含 `commands` 数组和 `summary`
## 示例 6:记住用户偏好
用户消息:"以后回答尽量简洁,先给结论再解释。"
opencode agent 调用 `memory_manager`
```json
{
"action": "add",
"reason": "用户明确给出了长期有效的回答风格偏好",
"scope": "user",
"content": "用户偏好先给结论、再补必要解释,整体风格尽量简洁。"
}
```