✨ feat: 整体更新同步
This commit is contained in:
@@ -51,13 +51,23 @@
|
||||
|
||||
## 三、接口规格
|
||||
|
||||
### 3.1 aide decide(提交数据)
|
||||
### 3.1 命令一览
|
||||
|
||||
```
|
||||
aide decide {submit,result} ...
|
||||
|
||||
子命令:
|
||||
submit <json> 提交待定项数据并启动 Web 服务
|
||||
result 获取用户决策结果
|
||||
```
|
||||
|
||||
### 3.2 aide decide submit(提交数据)
|
||||
|
||||
**用途**:提交待定项数据并启动 Web 服务
|
||||
|
||||
**语法**:
|
||||
```
|
||||
aide decide '<json数据>'
|
||||
aide decide submit '<json数据>'
|
||||
```
|
||||
|
||||
**输入**:待定项 JSON 数据(见数据格式章节)
|
||||
@@ -67,9 +77,19 @@ aide decide '<json数据>'
|
||||
→ Web 服务已启动
|
||||
→ 请访问: http://localhost:3721
|
||||
→ 等待用户完成决策...
|
||||
✓ 决策已完成
|
||||
```
|
||||
|
||||
### 3.2 aide decide result
|
||||
**配置项**(见 [配置格式文档](../formats/config.md)):
|
||||
|
||||
| 配置项 | 默认值 | 说明 |
|
||||
|--------|--------|------|
|
||||
| `decide.port` | 3721 | 起始端口 |
|
||||
| `decide.bind` | `"127.0.0.1"` | 监听地址 |
|
||||
| `decide.url` | `""` | 自定义访问地址 |
|
||||
| `decide.timeout` | 0 | 超时时间(秒) |
|
||||
|
||||
### 3.3 aide decide result
|
||||
|
||||
**用途**:获取用户决策结果
|
||||
|
||||
@@ -90,11 +110,13 @@ aide decide result
|
||||
|
||||
**错误情况**:
|
||||
```
|
||||
✗ 尚无决策结果,请等待用户完成操作
|
||||
✗ 尚无决策结果
|
||||
建议: 请等待用户在 Web 界面完成操作
|
||||
```
|
||||
|
||||
```
|
||||
✗ 未找到待定项数据,请先执行 aide decide '<json>'
|
||||
✗ 未找到待定项数据
|
||||
建议: 请先执行 aide decide submit '<json>'
|
||||
```
|
||||
|
||||
---
|
||||
@@ -112,7 +134,7 @@ participant "aide decide" as Decide
|
||||
participant "Web Server" as Web
|
||||
participant User
|
||||
|
||||
LLM -> Decide : aide decide '<json>'
|
||||
LLM -> Decide : aide decide submit '<json>'
|
||||
Decide -> Decide : 解析 JSON
|
||||
Decide -> Decide : 保存待定项数据
|
||||
Decide -> Web : 启动 HTTP 服务
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
- Web 前端:使用纯 HTML/CSS/JavaScript,无需构建工具,直接嵌入 Python 代码或作为静态资源
|
||||
|
||||
2. **服务生命周期**:
|
||||
- `aide decide '<json>'` 启动服务并阻塞等待
|
||||
- `aide decide submit '<json>'` 启动服务并阻塞等待
|
||||
- 用户在 Web 界面提交决策后,服务自动关闭
|
||||
- 服务关闭后,LLM 调用 `aide decide result` 获取结果
|
||||
|
||||
@@ -159,7 +159,7 @@ participant "Web Browser" as Browser
|
||||
participant User
|
||||
|
||||
== 提交待定项 ==
|
||||
LLM -> CLI : aide decide '<json>'
|
||||
LLM -> CLI : aide decide submit '<json>'
|
||||
CLI -> CLI : 解析并验证 JSON
|
||||
CLI -> CLI : 保存到 pending.json
|
||||
CLI -> Server : 启动 HTTP 服务
|
||||
|
||||
@@ -4,19 +4,27 @@
|
||||
|
||||
`aide decide` 提供两个子命令:
|
||||
|
||||
```
|
||||
aide decide {submit,result} ...
|
||||
|
||||
子命令:
|
||||
submit <json> 提交待定项数据并启动 Web 服务
|
||||
result 获取用户决策结果
|
||||
```
|
||||
|
||||
| 子命令 | 语法(API 约定) | 成功输出 | 主要用途 |
|
||||
|--------|------------------|----------|----------|
|
||||
| (默认) | `aide decide '<json>'` | 输出访问链接,阻塞等待 | 提交待定项数据并启动 Web 服务 |
|
||||
| submit | `aide decide submit '<json>'` | 输出访问链接,阻塞等待 | 提交待定项数据并启动 Web 服务 |
|
||||
| result | `aide decide result` | 输出 JSON 结果 | 获取用户决策结果 |
|
||||
|
||||
## 二、命令详细规格
|
||||
|
||||
### 2.1 aide decide(提交数据并启动服务)
|
||||
### 2.1 aide decide submit(提交数据并启动服务)
|
||||
|
||||
**语法**:
|
||||
|
||||
```
|
||||
aide decide '<json_data>'
|
||||
aide decide submit '<json_data>'
|
||||
```
|
||||
|
||||
**参数**:
|
||||
@@ -25,6 +33,15 @@ aide decide '<json_data>'
|
||||
|------|------|------|------|
|
||||
| `<json_data>` | string | 是 | 待定项 JSON 数据,需用引号包裹 |
|
||||
|
||||
**配置项**(见 [配置格式文档](../../formats/config.md)):
|
||||
|
||||
| 配置项 | 默认值 | 说明 |
|
||||
|--------|--------|------|
|
||||
| `decide.port` | 3721 | 起始端口 |
|
||||
| `decide.bind` | `"127.0.0.1"` | 监听地址,设为 `"0.0.0.0"` 可允许外部访问 |
|
||||
| `decide.url` | `""` | 自定义访问地址,为空时自动生成 |
|
||||
| `decide.timeout` | 0 | 超时时间(秒),0 表示不超时 |
|
||||
|
||||
**输入数据格式**:
|
||||
|
||||
见 `aide-program/docs/formats/data.md` 的"待定项数据格式"章节。
|
||||
@@ -143,12 +160,12 @@ aide decide result
|
||||
|
||||
```
|
||||
✗ 未找到待定项数据
|
||||
建议: 请先执行 aide decide '<json>'
|
||||
建议: 请先执行 aide decide submit '<json>'
|
||||
```
|
||||
|
||||
```
|
||||
✗ 决策结果已过期
|
||||
建议: 请重新执行 aide decide '<json>'
|
||||
建议: 请重新执行 aide decide submit '<json>'
|
||||
```
|
||||
|
||||
**行为流程**:
|
||||
@@ -283,7 +300,7 @@ stop
|
||||
|
||||
```bash
|
||||
# 1. LLM 提交待定项数据
|
||||
$ aide decide '{"task":"实现用户认证","source":"task.md","items":[...]}'
|
||||
$ aide decide submit '{"task":"实现用户认证","source":"task.md","items":[...]}'
|
||||
→ Web 服务已启动
|
||||
→ 请访问: http://localhost:3721
|
||||
→ 等待用户完成决策...
|
||||
@@ -298,7 +315,7 @@ $ aide decide result
|
||||
|
||||
```bash
|
||||
# 配置了超时时间的情况
|
||||
$ aide decide '{"task":"...","source":"...","items":[...]}'
|
||||
$ aide decide submit '{"task":"...","source":"...","items":[...]}'
|
||||
→ Web 服务已启动
|
||||
→ 请访问: http://localhost:3721
|
||||
→ 等待用户完成决策...
|
||||
@@ -315,7 +332,7 @@ $ aide decide result
|
||||
/aide:prep 流程中:
|
||||
1. LLM 分析任务,识别待定项
|
||||
2. LLM 构造 JSON 数据
|
||||
3. LLM 调用 aide decide '<json>'
|
||||
3. LLM 调用 aide decide submit '<json>'
|
||||
4. LLM 告知用户访问链接
|
||||
5. 用户在 Web 界面完成决策
|
||||
6. LLM 调用 aide decide result 获取结果
|
||||
|
||||
@@ -26,10 +26,10 @@ aide decide 的数据存储负责管理待定项数据和决策记录的持久
|
||||
**用途**:存储当前待处理的待定项数据
|
||||
|
||||
**生命周期**:
|
||||
- 创建:`aide decide '<json>'` 执行时
|
||||
- 创建:`aide decide submit '<json>'` 执行时
|
||||
- 读取:Web 前端通过 API 获取
|
||||
- 保留:决策完成后保留,用于 `aide decide result` 验证匹配性
|
||||
- 覆盖:下次 `aide decide '<json>'` 执行时覆盖
|
||||
- 覆盖:下次 `aide decide submit '<json>'` 执行时覆盖
|
||||
|
||||
**内容格式**:与输入数据格式相同(DecideInput)
|
||||
|
||||
@@ -202,7 +202,7 @@ save_atomic(path: Path, data: dict) -> None:
|
||||
|
||||
| 文件 | 创建时机 | 删除时机 |
|
||||
|------|----------|----------|
|
||||
| pending.json | `aide decide '<json>'` | 不自动删除,下次覆盖 |
|
||||
| pending.json | `aide decide submit '<json>'` | 不自动删除,下次覆盖 |
|
||||
| {session_id}.json | 用户提交决策 | 不自动删除 |
|
||||
|
||||
### 5.2 历史记录清理
|
||||
@@ -238,7 +238,7 @@ ensure_decisions_dir(root: Path) -> Path:
|
||||
|
||||
```
|
||||
✗ 无法解析 pending.json: <具体错误>
|
||||
建议: 文件可能已损坏,请重新执行 aide decide '<json>'
|
||||
建议: 文件可能已损坏,请重新执行 aide decide submit '<json>'
|
||||
```
|
||||
|
||||
### 6.2 文件缺失
|
||||
@@ -246,7 +246,7 @@ ensure_decisions_dir(root: Path) -> Path:
|
||||
| 场景 | 错误信息 |
|
||||
|------|----------|
|
||||
| .aide/ 不存在 | `✗ .aide 目录不存在,请先执行 aide init` |
|
||||
| pending.json 不存在 | `✗ 未找到待定项数据,请先执行 aide decide '<json>'` |
|
||||
| pending.json 不存在 | `✗ 未找到待定项数据,请先执行 aide decide submit '<json>'` |
|
||||
| 历史记录不存在 | `✗ 尚无决策结果,请等待用户完成操作` |
|
||||
|
||||
### 6.3 数据不一致
|
||||
@@ -255,7 +255,7 @@ ensure_decisions_dir(root: Path) -> Path:
|
||||
|
||||
```
|
||||
✗ 决策结果已过期
|
||||
建议: pending.json 已被更新,请重新执行 aide decide '<json>'
|
||||
建议: pending.json 已被更新,请重新执行 aide decide submit '<json>'
|
||||
```
|
||||
|
||||
## 七、方法签名原型
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
**步骤**:
|
||||
|
||||
1. 执行 `aide decide '<valid_json>'`
|
||||
1. 执行 `aide decide submit '<valid_json>'`
|
||||
|
||||
**期望**:
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
**步骤**:
|
||||
|
||||
1. 执行 `aide decide 'invalid json'`
|
||||
1. 执行 `aide decide submit 'invalid json'`
|
||||
|
||||
**期望**:
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
**步骤**:
|
||||
|
||||
1. 执行 `aide decide '{"task":"test"}'`(缺少必填字段)
|
||||
1. 执行 `aide decide submit '{"task":"test"}'`(缺少必填字段)
|
||||
|
||||
**期望**:
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
|
||||
**步骤**:
|
||||
|
||||
1. 执行 `aide decide '<json>'` 并立即中断(Ctrl+C)
|
||||
1. 执行 `aide decide submit '<json>'` 并立即中断(Ctrl+C)
|
||||
2. 执行 `aide decide result`
|
||||
|
||||
**期望**:
|
||||
@@ -94,7 +94,7 @@
|
||||
**步骤**:
|
||||
|
||||
1. 占用端口 3721(如 `nc -l 3721`)
|
||||
2. 执行 `aide decide '<json>'`
|
||||
2. 执行 `aide decide submit '<json>'`
|
||||
|
||||
**期望**:
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
**步骤**:
|
||||
|
||||
1. 占用端口 3721-3730
|
||||
2. 执行 `aide decide '<json>'`
|
||||
2. 执行 `aide decide submit '<json>'`
|
||||
|
||||
**期望**:
|
||||
|
||||
@@ -294,7 +294,7 @@
|
||||
|
||||
**步骤**:
|
||||
|
||||
1. 执行 `aide decide '<json>'`
|
||||
1. 执行 `aide decide submit '<json>'`
|
||||
2. 检查 `.aide/decisions/pending.json`
|
||||
|
||||
**期望**:
|
||||
@@ -321,9 +321,9 @@
|
||||
|
||||
**步骤**:
|
||||
|
||||
1. 执行 `aide decide '<json1>'`
|
||||
1. 执行 `aide decide submit '<json1>'`
|
||||
2. 中断服务
|
||||
3. 执行 `aide decide '<json2>'`
|
||||
3. 执行 `aide decide submit '<json2>'`
|
||||
4. 检查 pending.json
|
||||
|
||||
**期望**:
|
||||
@@ -349,7 +349,7 @@
|
||||
|
||||
**步骤**:
|
||||
|
||||
1. 执行 `aide decide '<json>'`
|
||||
1. 执行 `aide decide submit '<json>'`
|
||||
2. 在浏览器中打开链接
|
||||
3. 选择所有选项
|
||||
4. 添加备注
|
||||
@@ -384,7 +384,7 @@
|
||||
**步骤**:
|
||||
|
||||
1. 删除 .aide 目录
|
||||
2. 执行 `aide decide '<json>'`
|
||||
2. 执行 `aide decide submit '<json>'`
|
||||
|
||||
**期望**:
|
||||
|
||||
@@ -408,7 +408,7 @@
|
||||
**步骤**:
|
||||
|
||||
1. 构造包含 100 个待定项的 JSON
|
||||
2. 执行 `aide decide '<json>'`
|
||||
2. 执行 `aide decide submit '<json>'`
|
||||
|
||||
**期望**:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user