Files
tw2/qingjian_cs/README.md
jimi 77391daf77
Some checks failed
Pre-commit / run (ubuntu-latest) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_en (ubuntu-latest, 3.10) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_zh (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.12) (push) Has been cancelled
perf: switch to single-stage routing and low-latency defaults
2026-03-03 14:36:33 +08:00

77 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Qingjian CS (AgentScope Official Multi-Agent)
按 AgentScope 官方范式实现:
- `ReActAgent`
- `Toolkit.register_tool_function(...)`
- `OpenAIChatFormatter`
- `InMemoryMemory`
- `structured_model` 输出
- `Orchestrator` 编排(单阶段直达 Specialists
## 架构
- `app/agents.py`
- `PreSalesAgent`
- `QuoteAgent`
- `AfterSalesAgent`
- `RiskAgent`
- `app/orchestrator.py`
- 统一编排与状态合并
- `app/state_machine.py`
- 售后状态机 + 迁移规则
- `app/store.py`
- 会话/事件持久化SQLite / MySQL
- `app/client.py`
- 轻简API WebSocket 收发与调度
## 环境变量
- `QINGJIAN_WS_URI` 默认 `ws://127.0.0.1:9528`
- `OPENAI_API_KEY` 必填
- `OPENAI_BASE_URL` 默认 `https://ark.cn-beijing.volces.com/api/v3`
- `OPENAI_MODEL_NAME` 默认 `doubao-seed-2-0-pro-260215`
- `AUTO_QUOTE_WAIT_SECONDS` 默认 `18`
- `MESSAGE_DEBOUNCE_SECONDS` 默认 `0.2`
- `IMAGE_MESSAGE_DEBOUNCE_SECONDS` 默认 `0.4`
- `AGENT_MAX_ITERS` 默认 `1`
- `DECISION_TIMEOUT_SECONDS` 默认 `8`
- `STORE_BACKEND` 默认 `sqlite`,可设 `mysql`
- `STORE_SQLITE_PATH` 可选
- `MYSQL_HOST/MYSQL_PORT/MYSQL_USER/MYSQL_PASSWORD/MYSQL_DATABASE`
可直接复制模板:
```powershell
copy .env.example .env
```
## 启动uv run
当前环境建议使用(避免上层工程依赖干扰):
```powershell
uv run --with websockets --with pydantic --with openai --with pymysql python run.py
```
### 生产建议(天网)
- WebSocket单实例防重复回复
- HTTP API多 worker提升并发
```powershell
uv run powershell -File .\scripts\start_tianwang_prod.ps1 -Host 127.0.0.1 -Port 6060 -ApiWorkers 2
```
## Golden 回放
```powershell
uv run --with websockets --with pydantic --with openai --with pymysql python scripts/replay_golden.py --mode heuristic
```
- `heuristic`:无模型依赖,做规则/状态机回放。
- `full`:走完整多 Agent需完整 AgentScope 运行依赖 + 有效模型 key
## 开发规则
每次开发前先阅读:[DEVELOPMENT_RULES.md](./DEVELOPMENT_RULES.md)