docs: sync features docs with current project state
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
Update docs/features/ to reflect latest architecture: - Tauri commands: 177 (160 @connected + 16 @reserved) - Zustand stores: 18 (including chatStore 4 sub-stores) - SaaS API routes: 131 (12 modules, 34 data tables) - Workers: 7 (added AggregateUsage + GenerateEmbedding) - React 19 + Tailwind 4 tech stack - Schema v8, subtaskStatus taskId threading
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# ZCLAW SaaS 平台 — 总览
|
||||
|
||||
> 最后更新: 2026-04-01 | 实施状态: Phase 1-4 全部完成 + 架构重构完成,10 个后端模块 + Worker + Scheduler + Admin V2 (Vite + Ant Design Pro) + 桌面端完整集成
|
||||
> 最后更新: 2026-04-06 | 实施状态: Phase 1-4 全部完成 + 架构重构完成,12 个后端模块 + Worker + Scheduler + Admin V2 (Vite + Ant Design Pro) + 桌面端完整集成
|
||||
|
||||
## 架构概述
|
||||
|
||||
@@ -29,8 +29,8 @@ ZCLAW SaaS 平台为桌面端用户提供云端能力,包括模型中转(Key
|
||||
## 数据库
|
||||
|
||||
- **引擎**: PostgreSQL (sqlx 异步驱动)
|
||||
- **Schema 版本**: v6 (TIMESTAMPTZ 时间戳类型)
|
||||
- **数据表**: 25 张 (accounts, providers, models, relay_tasks, prompt_templates, agent_templates, telemetry_reports 等)
|
||||
- **Schema 版本**: v8 (TIMESTAMPTZ 时间戳类型)
|
||||
- **数据表**: 34 张 (accounts, providers, models, relay_tasks, prompt_templates, agent_templates, telemetry_reports, knowledge_bases, knowledge_documents, billing_plans, billing_subscriptions, billing_usage 等)
|
||||
- **种子数据**: 3 个系统角色 (super_admin, admin, user),3 个内置 Prompt 模板
|
||||
- **迁移系统**: 声明式 SQL 文件 (`crates/zclaw-saas/migrations/`),按文件名排序执行
|
||||
- **连接池**: 50 max / 5 min 连接,10s 获取超时,300s 空闲超时,1800s 最大生命周期
|
||||
@@ -49,9 +49,11 @@ ZCLAW SaaS 平台为桌面端用户提供云端能力,包括模型中转(Key
|
||||
| Agent 模板 | 100% | 5 | 模板 CRUD + tools/capabilities/model 绑定 + 可见性控制 |
|
||||
| 遥测 (Telemetry) | 100% | 4 | 批量 Token 用量上报 + 模型聚合统计 + 每日统计 + 审计摘要 |
|
||||
| 定时任务 (Scheduled Task) | 100% | 2 | 用户定时任务 CRUD (创建/列表/更新/删除),30s 轮询执行 |
|
||||
| **Worker 系统** | 100% | — | 5 个 Worker (log_operation, cleanup_rate_limit, cleanup_refresh_tokens, record_usage, update_last_used),mpsc 异步调度,自动重试 |
|
||||
| 知识库 (Knowledge) | 100% | 23 | 知识库 CRUD + 文档上传/解析/向量化 + 语义搜索 + pgvector |
|
||||
| 计费 (Billing) | 100% | 10 | 套餐管理 + 订阅 + 配额实时递增 + 用量聚合 + Mock 支付 |
|
||||
| **Worker 系统** | 100% | — | 7 个 Worker (log_operation, cleanup_rate_limit, cleanup_refresh_tokens, record_usage, update_last_used, aggregate_usage, generate_embedding),mpsc 异步调度,自动重试 |
|
||||
| **声明式 Scheduler** | 100% | — | TOML 配置定时任务,灵活间隔 (30s/5m/1h/1d),run_on_start,内置 DB 清理 |
|
||||
| **合计** | — | **58** | — |
|
||||
| **合计** | — | **131** | — |
|
||||
|
||||
## API 端点一览
|
||||
|
||||
@@ -266,7 +268,7 @@ llm_routing=local:
|
||||
| 文件 | 职责 |
|
||||
|------|------|
|
||||
| `src/main.rs` | 服务启动 + 路由注册 + 后台任务 (速率限制清理 + 设备清理) |
|
||||
| `src/db.rs` | 数据库初始化 + Schema v6 + TIMESTAMPTZ 迁移 + 25 张表 + Admin 引导 |
|
||||
| `src/db.rs` | 数据库初始化 + Schema v8 + TIMESTAMPTZ 迁移 + 34 张表 + Admin 引导 |
|
||||
| `src/state.rs` | AppState (PgPool + Config + JWT Secret + 速率限制 DashMap + WorkerDispatcher) |
|
||||
| `src/config.rs` | SaaSConfig (Server/Database/Auth/Relay/RateLimit/Scheduler),多环境配置加载 |
|
||||
| `src/error.rs` | SaasError 16 种变体 + HTTP 状态码映射 |
|
||||
@@ -283,9 +285,9 @@ llm_routing=local:
|
||||
| `src/agent_template/` | Agent 模板 CRUD + 可见性控制 |
|
||||
| `src/telemetry/` | Token 用量上报 + 模型统计 + 每日统计 + 审计摘要 |
|
||||
| `src/scheduled_task/` | 用户定时任务 CRUD (创建/列表/更新/删除) + 30s 轮询执行 |
|
||||
| `src/workers/` | Worker 系统 (5 Worker: log_operation, cleanup_rate_limit, cleanup_refresh_tokens, record_usage, update_last_used) |
|
||||
| `src/workers/` | Worker 系统 (7 Worker: log_operation, cleanup_rate_limit, cleanup_refresh_tokens, record_usage, update_last_used, aggregate_usage, generate_embedding) |
|
||||
| `src/scheduler.rs` | 声明式 Scheduler (TOML 定时任务配置 + DB 清理任务) |
|
||||
| `migrations/` | SQL 迁移文件 (Schema v6, TIMESTAMPTZ) |
|
||||
| `migrations/` | SQL 迁移文件 (Schema v8, TIMESTAMPTZ) |
|
||||
|
||||
### Admin 管理后台 (admin-v2/)
|
||||
|
||||
@@ -325,4 +327,4 @@ llm_routing=local:
|
||||
|
||||
---
|
||||
|
||||
**最后更新**: 2026-04-01
|
||||
**最后更新**: 2026-04-06
|
||||
|
||||
Reference in New Issue
Block a user