test: add unit/integration/E2E test suites, fix create_session bug, update docs

- Unit tests: test_session.py (27), test_error_kb.py (24), test_agent.py hardened
- Integration tests: test_api_integration.py (25) with FastAPI TestClient
- E2E tests: main-flows.spec.ts (8) with Playwright + API mocking
- Bug fix: backend/session.py create_session() missing session_id parameter
- Config: frontend/playwright.config.ts, npm run test:e2e
- Docs: update CLAUDE.md v9, .gitignore for test artifacts/eval reports
This commit is contained in:
2026-05-23 08:38:29 +08:00
parent b444303055
commit 1952d75f13
11 changed files with 1029 additions and 12 deletions
+4 -3
View File
@@ -34,10 +34,11 @@ def generate_session_id() -> str:
return uuid.uuid4().hex[:12]
def create_session(name: str = "", agent_state: Optional[dict] = None) -> dict:
"""创建新会话,返回会话元数据。"""
def create_session(name: str = "", agent_state: Optional[dict] = None,
session_id: Optional[str] = None) -> dict:
"""创建新会话,返回会话元数据。session_id 可选——传入时使用指定 ID。"""
_ensure_dir()
sid = generate_session_id()
sid = session_id or generate_session_id()
now = _now_iso()
agent_state = agent_state or {}
agent_state["session_id"] = sid