Sync
This commit is contained in:
@@ -44,7 +44,7 @@ AI 客服行动层框架。粘贴你的 API,获得一个能执行真实操作
|
||||
|
||||
| 阶段 | 周期 | 内容 | 状态 | 详情 |
|
||||
|------|------|------|------|------|
|
||||
| Phase 1 | 第 1-3 周 | 核心框架 | 未开始 | [[Smart Support/Phase 1 - 核心框架]] |
|
||||
| Phase 1 | 第 1-3 周 | 核心框架 | COMPLETED (2026-03-30) | [[Smart Support/Phase 1 - 核心框架]] |
|
||||
| Phase 2 | 第 3-4 周 | 多 Agent + 安全 | 未开始 | [[Smart Support/Phase 2 - 多 Agent + 安全]] |
|
||||
| Phase 3 | 第 4-6 周 | OpenAPI 自动发现 | 未开始 | [[Smart Support/Phase 3 - OpenAPI 自动发现]] |
|
||||
| Phase 4 | 第 6-7 周 | 分析 + 回放 | 未开始 | [[Smart Support/Phase 4 - 分析 + 回放]] |
|
||||
@@ -60,6 +60,12 @@ AI 客服行动层框架。粘贴你的 API,获得一个能执行真实操作
|
||||
- 分支:`main`
|
||||
- 本地路径:`/Users/yiukai/Documents/git/smart-support`
|
||||
|
||||
## 完整文档(已同步)
|
||||
|
||||
- [[Smart Support/Architecture]] - 系统架构文档(12 章,含 ADR、数据库设计、API 协议)
|
||||
- [[Smart Support/Development Plan]] - 详细开发计划(6 Phase,任务清单 + 检查点 + 风险)
|
||||
- [[Smart Support/Phase 1 Dev Log]] - Phase 1 开发日志(88% 覆盖率,82 个单元测试)
|
||||
|
||||
## 计划文档
|
||||
|
||||
项目根目录下:
|
||||
|
||||
1248
2 - Projects/Smart Support/Architecture.md
Normal file
1248
2 - Projects/Smart Support/Architecture.md
Normal file
File diff suppressed because it is too large
Load Diff
1051
2 - Projects/Smart Support/Development Plan.md
Normal file
1051
2 - Projects/Smart Support/Development Plan.md
Normal file
File diff suppressed because it is too large
Load Diff
95
2 - Projects/Smart Support/Phase 1 Dev Log.md
Normal file
95
2 - Projects/Smart Support/Phase 1 Dev Log.md
Normal file
@@ -0,0 +1,95 @@
|
||||
---
|
||||
created: "2026-03-30"
|
||||
type: log
|
||||
project: "[[Smart Support]]"
|
||||
source: "docs/phases/phase-1-dev-log.md"
|
||||
---
|
||||
|
||||
# Phase 1: Core Framework -- Development Log
|
||||
|
||||
> Status: COMPLETED
|
||||
> Phase branch: `phase-1/core-framework`
|
||||
> Date started: 2026-03-30
|
||||
> Date completed: 2026-03-30
|
||||
> Related plan section: [Phase 1 in DEVELOPMENT-PLAN](../DEVELOPMENT-PLAN.md#phase-1-核心框架-第-1-3-周)
|
||||
|
||||
## What Was Built
|
||||
|
||||
- FastAPI WebSocket backend with `/ws` endpoint for real-time chat
|
||||
- LangGraph Supervisor (via `langgraph-supervisor`) connecting 3 agents
|
||||
- YAML-based Agent Registry with Pydantic validation
|
||||
- 3 Mock Agents: order_lookup (read), order_actions (write + interrupt), fallback
|
||||
- PostgresSaver checkpoint persistence via `langgraph-checkpoint-postgres`
|
||||
- Session TTL management with 30-minute sliding window and interrupt extension
|
||||
- LLM provider abstraction (Anthropic/OpenAI/Google) with prompt caching support
|
||||
- Token usage tracking callback handler
|
||||
- React Chat UI with streaming display, interrupt confirmation, and agent action viewer
|
||||
- Docker Compose configuration (PostgreSQL 16 + backend)
|
||||
|
||||
## Code Structure
|
||||
|
||||
### New files
|
||||
|
||||
Backend (`backend/app/`):
|
||||
- `config.py` -- pydantic-settings centralized configuration
|
||||
- `db.py` -- Async PostgreSQL pool + AsyncPostgresSaver setup
|
||||
- `llm.py` -- LLM provider factory (ChatAnthropic/ChatOpenAI/ChatGoogleGenerativeAI)
|
||||
- `callbacks.py` -- Token usage + cost tracking callback handler
|
||||
- `registry.py` -- YAML agent registry with validation + immutable config models
|
||||
- `session_manager.py` -- Session TTL with sliding window + interrupt extension
|
||||
- `graph.py` -- LangGraph Supervisor construction from registry
|
||||
- `ws_handler.py` -- WebSocket message dispatch + streaming logic
|
||||
- `main.py` -- FastAPI app entry with lifespan + WebSocket endpoint
|
||||
- `agents/__init__.py` -- Tool name-to-function bridge
|
||||
- `agents/order_lookup.py` -- Mock order status/tracking tools
|
||||
- `agents/order_actions.py` -- Mock cancel_order with interrupt()
|
||||
- `agents/fallback.py` -- Fallback response tool
|
||||
|
||||
Frontend (`frontend/src/`):
|
||||
- `types.ts` -- WebSocket message protocol TypeScript types
|
||||
- `hooks/useWebSocket.ts` -- WebSocket connection + reconnect + message dispatch
|
||||
- `components/ChatMessages.tsx` -- Streaming message display
|
||||
- `components/ChatInput.tsx` -- Message input
|
||||
- `components/InterruptPrompt.tsx` -- Approve/reject interrupt UI
|
||||
- `components/AgentAction.tsx` -- Tool call inline display
|
||||
- `pages/ChatPage.tsx` -- Main chat page composing all components
|
||||
|
||||
Infrastructure:
|
||||
- `backend/pyproject.toml` -- Dependencies + pytest + ruff config
|
||||
- `backend/agents.yaml` -- Agent registry YAML config
|
||||
- `backend/Dockerfile` -- Backend container
|
||||
- `docker-compose.yml` -- PostgreSQL 16 + backend services
|
||||
- `.gitignore` -- Updated for Python + Node artifacts
|
||||
|
||||
Tests (`backend/tests/unit/`):
|
||||
- `test_config.py` -- Settings validation tests
|
||||
- `test_registry.py` -- 17 tests for registry loading/validation
|
||||
- `test_agents.py` -- 10 tests for tool functions + tool bridge
|
||||
- `test_llm.py` -- 3 tests for LLM provider factory
|
||||
- `test_callbacks.py` -- 9 tests for token usage tracking
|
||||
- `test_session_manager.py` -- 9 tests for session TTL logic
|
||||
- `test_graph.py` -- 4 tests for supervisor construction
|
||||
- `test_db.py` -- 5 tests for database setup
|
||||
- `test_ws_handler.py` -- 12 tests for WebSocket message handling
|
||||
- `test_main.py` -- 5 tests for app configuration
|
||||
|
||||
## Test Coverage
|
||||
|
||||
- Unit test count: 82
|
||||
- Integration test count: 0 (requires running PostgreSQL)
|
||||
- E2E test count: 0 (manual verification in plan)
|
||||
- Overall coverage: 88%
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
- Used `astream(stream_mode="messages")` instead of `astream_events()` per langgraph best practices
|
||||
- Separated WebSocket handler logic into `ws_handler.py` for testability (not in original plan)
|
||||
- Session manager uses in-memory storage instead of DB-backed (sufficient for Phase 1 single-instance)
|
||||
|
||||
## Known Issues / Tech Debt
|
||||
|
||||
- Session manager not DB-backed (loses state on restart) -- acceptable for Phase 1 single-instance
|
||||
- WebSocket reconnect does not re-send pending interrupt state from server
|
||||
- No rate limiting on WebSocket endpoint (Phase 2)
|
||||
- No authentication (Phase 2)
|
||||
- `main.py` coverage at 47% -- lifespan function not unit-testable without full DB
|
||||
@@ -66,7 +66,7 @@ npm search jwt verify
|
||||
**四种预设工作流**:
|
||||
|
||||
| 工作流 | Agent 链 |
|
||||
|--------|---------|
|
||||
| -------- | ------------------------------------------------------- |
|
||||
| feature | planner → tdd-guide → code-reviewer → security-reviewer |
|
||||
| bugfix | planner → tdd-guide → code-reviewer |
|
||||
| refactor | architect → code-reviewer → tdd-guide |
|
||||
@@ -123,7 +123,7 @@ npm search jwt verify
|
||||
**核心洞察**: Hook 触发率 100%(确定性),Skill/提示词触发率仅 50-80%(概率性)。因此关键质量控制应通过 Hook 实现,而非依赖提示词。
|
||||
|
||||
| Hook 类型 | 触发时机 | 用途举例 |
|
||||
|-----------|---------|---------|
|
||||
| ------------ | ------ | ----------------- |
|
||||
| PreToolUse | 工具执行前 | 开发服务器自启、安全监控 |
|
||||
| PostToolUse | 工具执行后 | 自动格式化、类型检查 |
|
||||
| PreCompact | 上下文压缩前 | 保存会话状态到 MEMORY.md |
|
||||
|
||||
@@ -13,8 +13,8 @@ tags:
|
||||
# OpenClash 配置备份
|
||||
|
||||
> 路由器:`192.168.68.63` (iStoreOS, EasePi Pro)
|
||||
> 最后更新:2026-03-19
|
||||
> 用途:仅国内视频/音乐走代理回国,其余全部直连
|
||||
> 最后更新:2026-03-29
|
||||
> 用途:仅国内视频/音乐走代理回国,其余全部直连(小红书已改为直连)
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user