chore: update gitignore; feat: 新增customer_agent业务模块与api路由
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"""Audit-log persistence adapter for anonymous customer-service events."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
from sqlalchemy import text
|
||||
|
||||
|
||||
async def write_anonymous_sensitive_audit(db, *, session_id: str, trace_id: str) -> None:
|
||||
statement = text(
|
||||
"""
|
||||
INSERT INTO audit_log
|
||||
(user_id, username, module, action, target, detail, trace_id, status)
|
||||
VALUES
|
||||
(:user_id, :username, :module, :action, :target, :detail, :trace_id, :status)
|
||||
"""
|
||||
)
|
||||
await db.execute(
|
||||
statement,
|
||||
{
|
||||
"user_id": None,
|
||||
"username": None,
|
||||
"module": "customer_agent",
|
||||
"action": "anon_sensitive_input",
|
||||
"target": session_id,
|
||||
"detail": json.dumps({"session_id": session_id}, ensure_ascii=False),
|
||||
"trace_id": trace_id,
|
||||
"status": "成功",
|
||||
},
|
||||
)
|
||||
await db.commit()
|
||||
Reference in New Issue
Block a user