mirror of
https://github.com/escalante29/WealthySmart.git
synced 2026-07-17 10:08:46 +02:00
Add retained chat and API request diagnostics
This commit is contained in:
@@ -25,6 +25,7 @@ from agent_framework_ag_ui import AGUIThreadSnapshot
|
||||
from sqlmodel import Session, select
|
||||
|
||||
from app.db import engine
|
||||
from app.agent.chat_audit import current_chat_run_id, finalize_chat_run_in_session
|
||||
from app.models.models import ChatThreadSnapshot
|
||||
from app.timeutil import utcnow
|
||||
|
||||
@@ -130,6 +131,14 @@ class PostgresSnapshotStore:
|
||||
row.interrupt = snapshot.interrupt
|
||||
row.updated_at = utcnow()
|
||||
session.add(row)
|
||||
run_id = current_chat_run_id()
|
||||
if run_id is not None:
|
||||
finalize_chat_run_in_session(
|
||||
session,
|
||||
run_id=run_id,
|
||||
response_thread_id=thread_id,
|
||||
messages=row.messages,
|
||||
)
|
||||
session.commit()
|
||||
|
||||
await asyncio.to_thread(_save)
|
||||
|
||||
Reference in New Issue
Block a user