docs(wiki): 全量代码验证驱动更新 — 10页基于实际扫描非文档推测
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
关键数字修正: - Rust 74.5K行(原66K), Tauri命令 183(原182), SaaS路由 121 - 前端组件 104, lib/ 85文件, Store 17+4子store - TODO/FIXME 仅 8 个(前端4+Rust4) 内容增强: - 中间件完整14层注册清单含注册条件和优先级分类 - Store完整目录结构, Pipeline完整目录树 - Hands测试分布, Memory 16个Tauri命令列表 - 管家模式: 关键词路由→语义路由(TF-IDF)修正 - 代码健康度指标新增
This commit is contained in:
@@ -15,7 +15,7 @@ tags: [module, butler, interaction]
|
||||
|
||||
设计决策:
|
||||
1. **默认激活** — 所有聊天都经过 ButlerRouter,不需要用户手动开启
|
||||
2. **4 域关键词分类** — healthcare / data_report / policy / meeting,自动增强 system prompt
|
||||
2. **语义路由** — SemanticSkillRouter 用 TF-IDF 匹配 75 个技能,替代简单关键词
|
||||
3. **痛点积累** — 从对话中提取用户痛点,积累后生成方案建议
|
||||
4. **双模式 UI** — simple(纯聊天,默认) / professional(完整功能),渐进式解锁
|
||||
|
||||
@@ -26,9 +26,11 @@ tags: [module, butler, interaction]
|
||||
```
|
||||
用户消息
|
||||
→ ButlerRouter 中间件 (middleware/butler_router.rs)
|
||||
→ SemanticSkillRouter TF-IDF 匹配 75 个技能
|
||||
→ 4 域关键词分类
|
||||
→ 增强 system prompt (领域专用指令)
|
||||
→ ButlerRouterBackend trait → SemanticRouterAdapter
|
||||
→ SemanticSkillRouter (zclaw-skills/src/semantic_router.rs)
|
||||
→ TF-IDF 计算与 75 个技能的相似度
|
||||
→ 返回 RoutingHint { category, confidence, skill_id }
|
||||
→ 增强 system prompt (匹配的技能上下文)
|
||||
→ LLM 响应
|
||||
→ PainAggregator 提取痛点
|
||||
→ PainStorage (内存 Vec 热缓存 + SQLite 持久层)
|
||||
@@ -37,9 +39,21 @@ tags: [module, butler, interaction]
|
||||
→ 基于痛点生成解决方案提案
|
||||
```
|
||||
|
||||
### 语义路由桥接(kernel 层)
|
||||
|
||||
```rust
|
||||
// crates/zclaw-kernel/src/kernel/mod.rs:196-231
|
||||
struct SemanticRouterAdapter { router: Arc<SemanticSkillRouter> }
|
||||
impl ButlerRouterBackend for SemanticRouterAdapter {
|
||||
async fn classify(&self, query: &str) -> Option<RoutingHint> { ... }
|
||||
}
|
||||
```
|
||||
|
||||
这是 kernel 依赖 zclaw-runtime + zclaw-skills 的桥接点。
|
||||
|
||||
### 冷启动 (新用户引导)
|
||||
|
||||
入口: `desktop/src/hooks/use-cold-start.ts`
|
||||
入口: `desktop/src/hooks/use-cold-start.ts`(lib/ 下有同名文件)
|
||||
|
||||
```
|
||||
idle → (检测新用户) → greeting_sent → waiting_response → completed
|
||||
@@ -58,9 +72,33 @@ idle → (检测新用户) → greeting_sent → waiting_response → completed
|
||||
简洁侧边栏: `desktop/src/components/SimpleSidebar.tsx`
|
||||
管家面板: `desktop/src/components/ButlerPanel.tsx` (3 区: 洞察/方案/记忆)
|
||||
|
||||
### Tauri 命令
|
||||
|
||||
5 个 butler 命令 (已标注 @reserved):
|
||||
|
||||
```rust
|
||||
// desktop/src-tauri/src/intelligence/pain_aggregator.rs
|
||||
butler_list_pain_points
|
||||
butler_record_pain_point
|
||||
butler_generate_solution
|
||||
butler_list_proposals
|
||||
butler_update_proposal_status
|
||||
```
|
||||
|
||||
### Intelligence 层文件结构
|
||||
|
||||
```
|
||||
desktop/src-tauri/src/intelligence/
|
||||
├── compactor.rs (5 commands: token estimation + compaction)
|
||||
├── heartbeat.rs (10 commands: heartbeat engine CRUD)
|
||||
├── identity.rs (16 commands: agent identity manager)
|
||||
├── pain_aggregator.rs (5 commands: butler pain points)
|
||||
└── reflection.rs (7 commands: reflection engine)
|
||||
```
|
||||
|
||||
## 关联模块
|
||||
|
||||
- [[middleware]] — ButlerRouter 是中间件链中的一层
|
||||
- [[middleware]] — ButlerRouter 是中间件链中的第一层
|
||||
- [[chat]] — 消息流经过管家路由增强
|
||||
- [[memory]] — 痛点存储在 memory 子系统
|
||||
- [[hands-skills]] — 语义路由使用 75 个技能的 TF-IDF
|
||||
@@ -69,15 +107,12 @@ idle → (检测新用户) → greeting_sent → waiting_response → completed
|
||||
|
||||
| 文件 | 职责 |
|
||||
|------|------|
|
||||
| `crates/zclaw-runtime/src/middleware/butler_router.rs` | 管家路由器 (4域分类) |
|
||||
| `crates/zclaw-runtime/src/middleware/butler_router.rs` | 管家路由器 + ButlerRouterBackend trait |
|
||||
| `crates/zclaw-skills/src/semantic_router.rs` | SemanticSkillRouter TF-IDF 实现 |
|
||||
| `crates/zclaw-kernel/src/kernel/mod.rs:196-231` | SemanticRouterAdapter 桥接 |
|
||||
| `crates/zclaw-kernel/src/intelligence/pain_storage.rs` | 痛点双写 (内存+SQLite) |
|
||||
| `crates/zclaw-kernel/src/intelligence/solution_generator.rs` | 方案生成 |
|
||||
| `desktop/src/hooks/use-cold-start.ts` | 冷启动 4 阶段 |
|
||||
| `desktop/src/store/uiModeStore.ts` | 双模式切换 |
|
||||
| `desktop/src/components/SimpleSidebar.tsx` | 简洁模式侧边栏 |
|
||||
| `desktop/src/components/ButlerPanel.tsx` | 管家面板 (洞察/方案/记忆) |
|
||||
|
||||
## Tauri 命令
|
||||
|
||||
6 个 butler 专属命令 (已标注 @reserved):
|
||||
`butler_get_pain_points`, `butler_get_solutions`, `butler_delegate_task`, 等
|
||||
|
||||
Reference in New Issue
Block a user