修复: DOC-02+03+04 模块文档+使用手册重写对齐真实代码
- DOC-02 df-nodes: 8 节点虚构→3 实际(Ai/Script/Human 全完整实现),删 5 虚构节点(Docker/Git/Notify/HTTP/Subflow)+5 虚构 *_node.rs 文件行,补每节点真实实现要点。 - DOC-03 df-ai: 删虚构 router.rs(ModelRouter)+stream.rs(StreamCollector),trait 删 supported_features 改 endpoint(),工具数 12→19(tool_registry.rs 实际核对,核对报告 §3 称 13 亦滞后)。 - DOC-04 使用手册: 7 处过期修正(bun→npm / 任务状态 4→7 态 / 优先级 P0→P3 数字越小越高 / 节点 Script/Ai/Human / EventBus tokio broadcast 非 WebSocket / 多 Provider / 知识库 Tier1 AI 提炼+向量检索)。 主代理抽查:df-nodes 虚构节点仅历史说明残留 / 使用手册 bun 零命中。批3
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
| Anthropic Provider(流式)| ✅ Sprint 8 |
|
||||
| ContextManager(分组滑窗)| ✅ Sprint 11 |
|
||||
| embed() 向量生成 | ✅ Sprint 15 |
|
||||
| AiToolRegistry(基础设施)| ✅ Sprint 5(12 工具注册在 commands/ai.rs)|
|
||||
| AiToolRegistry(基础设施)| ✅ Sprint 5(19 工具注册在 commands/ai/tool_registry.rs)|
|
||||
| coordinator | ⬜ 空壳(B 路线待填)|
|
||||
|
||||
---
|
||||
@@ -28,17 +28,17 @@
|
||||
|
||||
```
|
||||
crates/df-ai/src/
|
||||
├── lib.rs — 公共导出
|
||||
├── provider.rs — LlmProvider trait(含 embed 默认实现)
|
||||
├── lib.rs — 公共导出 + build_provider 工厂(按协议选 OpenAICompatProvider / AnthropicCompatProvider)
|
||||
├── provider.rs — LlmProvider trait(含 embed 默认实现 + endpoint 默认实现)
|
||||
├── openai_compat.rs — OpenAI 兼容实现(chat + embed)
|
||||
├── anthropic_compat.rs — Anthropic Messages API 实现(Sprint 8)
|
||||
├── context.rs — ContextManager 分组滑动窗口(Sprint 11)
|
||||
├── ai_tools.rs — AiToolRegistry + 12 工具定义
|
||||
├── coordinator.rs — AgentCoordinator 空壳(B 路线)
|
||||
├── router.rs — ModelRouter 模型路由空壳(route() 按 TaskType 选模型,当前全返回 default_model)
|
||||
└── stream.rs — StreamCollector 流式辅助(累积 chunk.delta 文本 + 跟踪 finished 标志)
|
||||
├── ai_tools.rs — AiToolRegistry + AiTool + RiskLevel(仅基础设施;具体工具定义在 src-tauri/commands/ai/tool_registry.rs)
|
||||
└── coordinator.rs — AgentCoordinator 空壳(B 路线,有意保留勿删)
|
||||
```
|
||||
|
||||
> 注:历史文档曾列 `router.rs`(ModelRouter)与 `stream.rs`(StreamCollector)两个文件,实际均不存在(已删,见全量核对报告 §3)。
|
||||
|
||||
|
||||
---
|
||||
|
||||
@@ -66,11 +66,15 @@ pub trait LlmProvider: Send + Sync {
|
||||
// Provider 名称(必填)
|
||||
fn name(&self) -> &str;
|
||||
|
||||
// 支持的特性(必填:streaming / function_calling / vision)
|
||||
fn supported_features(&self) -> ProviderFeatures;
|
||||
// 实际请求端点(默认回落 name(),provider 覆盖返真实 URL,供 401/网络错误诊断)
|
||||
fn endpoint(&self) -> String {
|
||||
self.name().to_string()
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> 注:历史文档曾列 `supported_features() -> ProviderFeatures`(已删),当前 trait 末项为 `endpoint()`。
|
||||
|
||||
---
|
||||
|
||||
## OpenAI 兼容 Provider(openai_compat.rs)
|
||||
@@ -169,13 +173,13 @@ GLM 端对 `tool_use_id` 为 `None`/空串的 `tool_result` 块会返 500 卡死
|
||||
|
||||
> 归属:`ai_tools.rs` 仅提供基础设施(`RiskLevel` / `AiTool` / `AiToolRegistry`);工具的具体定义与注册在 `src-tauri/src/commands/ai/tool_registry.rs::build_ai_tool_registry`,handler 即唯一执行路径(schema+risk+实现同源)。
|
||||
|
||||
13 个内置工具,按风险分级:
|
||||
19 个内置工具,按风险分级(核对 `build_ai_tool_registry`,2026-06-15):
|
||||
|
||||
| 风险 | 工具 |
|
||||
|------|------|
|
||||
| Low(自动执行)| list_projects / list_tasks / list_ideas / read_file / list_directory |
|
||||
| Medium(需审批)| update_project / create_project / create_task / create_idea / write_file |
|
||||
| High(需审批)| delete_project / run_workflow / run_command |
|
||||
| Low(自动执行,6)| list_projects / list_tasks / list_ideas / list_trash / read_file / list_directory |
|
||||
| Medium(需审批,7)| update_project / create_project / bind_directory / create_task / update_task / create_idea / write_file |
|
||||
| High(需审批,6)| delete_task / delete_project / restore_project / purge_project / run_workflow / run_command |
|
||||
|
||||
工具执行结果写 `ai_tool_executions` 表(审计日志)。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user