"""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="创建时间")