vault backup: 2026-04-06 16:23:54

This commit is contained in:
Yaojia Wang
2026-04-06 16:23:54 +02:00
parent e4cee2f21d
commit 7ab3575374
10 changed files with 507 additions and 635 deletions

View File

@@ -0,0 +1,41 @@
---
created: 2026-04-06
type: log
project: "[[Smart Support]]"
source: docs/phases/phase-4-dev-log.md
tags:
- dev-log
- phase-4
- analytics
- replay
- postgresql
---
# Phase 4: Conversation Replay + Analytics -- Development Log
> Status: COMPLETED
> Phase branch: `phase-4/analytics-replay`
> Date started: 2026-03-31
> Date completed: 2026-03-31
## What Was Built
- **回放模型**: StepType 枚举、ReplayStep、ReplayPage 冻结数据类。
- **检查点转换器** (`replay/transformer.py`): PostgresSaver JSONB -> 结构化 ReplayStep 时间线。
- **回放 API** (`replay/api.py`): GET /api/conversations分页列表、GET /api/replay/{thread_id}(分页时间线,默认 20 步)。
- **分析模型**: AgentUsage、InterruptStats、AnalyticsResult。
- **事件记录器** (`analytics/event_recorder.py`): AnalyticsRecorder Protocol + PostgresAnalyticsRecorder + NoOpAnalyticsRecorder。
- **分析查询** (`analytics/queries.py`): resolution_rate, agent_usage, escalation_rate, cost_per_conversation, interrupt_stats。
- **分析 API** (`analytics/api.py`): GET /api/analytics?range=Xd。
- **DB 迁移**: analytics_events 表 + conversations 列扩展resolution_type, agents_used, turn_count, ended_at
## Test Coverage
- New: 74 tests
- Total: 399 tests
- Coverage: 92.87%
## Related
- [[Smart Support]]
- [[Smart Support/Phase 4 - 分析 + 回放]]