Files
group_xinghuo_jinrong/scripts/dev/dump_session.py
T
zhanghongyu_0626 647c07062e feat(trade): Enhance trade processing and context handling in customer service
- Introduced `pending_trade` handling in the chat API to manage trade requests more effectively.
- Updated the `submit_trade_api` to allow advisors to access customer trades based on assigned roles.
- Added new methods in `GatewayRepository` for managing core holdings during trade subscriptions and redemptions.
- Implemented context-aware trade dialogue management in the customer service layer to improve user experience during multi-turn interactions.
- Enhanced the tool service to support trade actions and suitability checks, ensuring accurate processing of user requests.

This update significantly improves the trade interaction flow, providing a more robust and user-friendly experience for customers engaging in trading activities.
2026-09-13 17:45:04 +08:00

43 lines
1.4 KiB
Python

"""Dump agent_message + recent audit for a session id (local debug)."""
import sys
from sqlalchemy import text
from app.config.database import get_agent_session_local
def main() -> None:
sid = sys.argv[1] if len(sys.argv) > 1 else "sess-16d0331d027"
Session = get_agent_session_local()
with Session() as s:
rows = s.execute(
text(
"SELECT seq_no, role, intent, content FROM agent_message "
"WHERE session_id=:sid ORDER BY seq_no"
),
{"sid": sid},
).fetchall()
print(f"session={sid} messages={len(rows)}")
for seq, role, intent, content in rows:
print(f"\n=== seq={seq} role={role} intent={intent} ===")
print(content[:2000] if content else "")
try:
audits = s.execute(
text(
"SELECT id, created_at, event_type, path, status_code, "
"LEFT(COALESCE(payload,''), 600) "
"FROM audit_log WHERE session_id=:sid "
"ORDER BY id DESC LIMIT 20"
),
{"sid": sid},
).fetchall()
except Exception as e:
print("audit_log query failed:", e)
audits = []
print(f"\naudit rows={len(audits)}")
for row in audits:
print(row)
if __name__ == "__main__":
main()