PMFlow/backend/app/models/qa_feedback.py

29 lines
990 B
Python

"""问答反馈模型。"""
from __future__ import annotations
from typing import Any, Optional
from sqlalchemy import BigInteger, ForeignKey, Integer, Text, VARCHAR
from sqlalchemy.orm import Mapped, mapped_column
from .base import Base
from .types import JSONB
class QAFeedback(Base):
__tablename__ = "qa_feedback"
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
qa_id: Mapped[int] = mapped_column(
Integer,
ForeignKey("qa_records.id", ondelete="CASCADE"),
nullable=False,
index=True,
)
rating: Mapped[str] = mapped_column(VARCHAR(16), nullable=False, index=True)
helpfulness: Mapped[Optional[str]] = mapped_column(VARCHAR(32), nullable=True)
error_types: Mapped[Optional[Any]] = mapped_column(JSONB, nullable=True)
correct_answer: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
submitted_by: Mapped[Optional[int]] = mapped_column(BigInteger, nullable=True, index=True)