From 528fad30beada296979ce3e4c499f5deedcf813b Mon Sep 17 00:00:00 2001 From: huangzhuang_3rd Date: Wed, 12 Aug 2026 13:30:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20AI=20Worker=20=E5=B9=B3=E5=8F=B0=20MVP?= =?UTF-8?q?=20v1.0.0=20-=20=E5=A4=9A=E7=A7=9F=E6=88=B7/=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86/AI=20Worker/=E4=BB=BB=E5=8A=A1=E7=BC=96?= =?UTF-8?q?=E6=8E=92/HITL=E5=AE=A1=E6=A0=B8/=E6=88=90=E6=9C=AC=E6=B2=BB?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/models/artifact.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 backend/app/models/artifact.py diff --git a/backend/app/models/artifact.py b/backend/app/models/artifact.py new file mode 100644 index 0000000..9597362 --- /dev/null +++ b/backend/app/models/artifact.py @@ -0,0 +1,34 @@ +"""Artifact model - task deliverables with versioning.""" +from sqlalchemy import Column, String, Integer, Text, ForeignKey +from app.models.base import Base, TimestampMixin, TenantMixin + + +class Artifact(Base, TimestampMixin, TenantMixin): + """An artifact is a deliverable produced by a task. + + Supports versioning: each task can have multiple artifact versions. + Type: text, code, document, data, image, mixed + """ + __tablename__ = "artifacts" + + id = Column(Integer, primary_key=True, autoincrement=True) + task_id = Column(Integer, ForeignKey("tasks.id"), nullable=False, index=True) + project_id = Column(Integer, ForeignKey("projects.id"), nullable=False) + + title = Column(String(500), nullable=False) + content = Column(Text, default="") + artifact_type = Column(String(50), default="text") + + # Versioning + version = Column(Integer, default=1) + is_latest = Column(String(10), default="true") + + # Source attribution + created_by_user_id = Column(Integer, ForeignKey("users.id"), nullable=True) + created_by_worker_id = Column(Integer, ForeignKey("ai_workers.id"), nullable=True) + + # Source references (for traceability - JSON array of source citations) + sources = Column(Text, default="[]") + + def __repr__(self): + return f""