feat: 添加 AI Agent 对话测试工具 + 代码优化

主要变更:

- 新增 tests/test_ai_chat.py: AI Agent 对话测试工具

- 优化 core/pydantic_ai_agent.py 和 db/chat_log_db.py

- 清理归档文件,更新文档

Made-with: Cursor
This commit is contained in:
2026-02-28 16:19:35 +08:00
parent a6c42d505a
commit c39840fe15
49 changed files with 2453 additions and 8556 deletions

View File

@@ -177,17 +177,8 @@ def cmd_live(refresh: int = 3):
try:
while True:
import sqlite3
conn = sqlite3.connect(db._DB_PATH)
conn.row_factory = sqlite3.Row
rows = conn.execute("""
SELECT id, customer_id, customer_name, direction, message, timestamp
FROM chat_logs
ORDER BY id DESC LIMIT 20
""").fetchall()
conn.close()
new_rows = [dict(r) for r in rows if r["id"] not in seen_ids]
rows = db.get_latest_messages(20)
new_rows = [r for r in rows if r["id"] not in seen_ids]
if new_rows:
new_rows.reverse()
for r in new_rows: