添加ai日志

This commit is contained in:
zk
2026-07-07 21:43:49 +08:00
parent cb94fb7bfe
commit ca0b13a45d
4 changed files with 66 additions and 9 deletions
+22
View File
@@ -0,0 +1,22 @@
"""PostgreSQL: ai_call_log 表模型"""
from datetime import datetime
from typing import Optional
from sqlalchemy import BigInteger, DateTime, String, Text
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import PgBase
class AiCallLog(PgBase):
"""AI 调用日志表"""
__tablename__ = "ai_call_log"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, comment="主键ID(雪花)")
scene: Mapped[str] = mapped_column(String(32), nullable=False, comment="场景标识: structure/major_match/skill_extract/company_enrich")
system_prompt: Mapped[str] = mapped_column(Text, nullable=False, comment="系统提示词")
user_message: Mapped[str] = mapped_column(Text, nullable=False, comment="发给AI的用户消息")
response: Mapped[Optional[str]] = mapped_column(Text, comment="AI返回原文")
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, comment="创建时间")