PMFlow/backend/app/models/context_node.py

18 lines
757 B
Python

"""上下文节点模型"""
from .base import Base
from .types import Vector, JSONB
from sqlalchemy.orm import Mapped, mapped_column
from sqlalchemy import BigInteger, Text, Integer, VARCHAR
from typing import Optional
class ContextNode(Base):
__tablename__ = "context_nodes"
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
content: Mapped[str] = mapped_column(Text, nullable=False)
embedding: Mapped[Optional[object]] = mapped_column(Vector(768), nullable=True)
version: Mapped[int] = mapped_column(Integer, nullable=False, default=1)
status: Mapped[str] = mapped_column(VARCHAR(20), nullable=False, default="active")
ai_insights: Mapped[Optional[object]] = mapped_column(JSONB, nullable=True)