28 lines
1.2 KiB
Python
28 lines
1.2 KiB
Python
|
|
"""
|
|||
|
|
编排模板模型 — 保存可视化 Agent 编排画布配置
|
|||
|
|
"""
|
|||
|
|
from sqlalchemy import Column, String, Text, JSON, DateTime, ForeignKey, func
|
|||
|
|
from sqlalchemy.dialects.mysql import CHAR
|
|||
|
|
from sqlalchemy.orm import relationship
|
|||
|
|
from app.core.database import Base
|
|||
|
|
import uuid
|
|||
|
|
|
|||
|
|
|
|||
|
|
class OrchestrationTemplate(Base):
|
|||
|
|
"""Agent 编排模板表"""
|
|||
|
|
__tablename__ = "orchestration_templates"
|
|||
|
|
|
|||
|
|
id = Column(CHAR(36), primary_key=True, default=lambda: str(uuid.uuid4()), comment="模板ID")
|
|||
|
|
name = Column(String(100), nullable=False, comment="模板名称")
|
|||
|
|
description = Column(Text, comment="模板描述")
|
|||
|
|
nodes = Column(JSON, nullable=False, comment="编排节点(含Agent配置)")
|
|||
|
|
edges = Column(JSON, nullable=False, comment="编排连线")
|
|||
|
|
user_id = Column(CHAR(36), ForeignKey("users.id"), comment="创建者ID")
|
|||
|
|
created_at = Column(DateTime, default=func.now(), comment="创建时间")
|
|||
|
|
updated_at = Column(DateTime, default=func.now(), onupdate=func.now(), comment="更新时间")
|
|||
|
|
|
|||
|
|
user = relationship("User", backref="orchestration_templates")
|
|||
|
|
|
|||
|
|
def __repr__(self):
|
|||
|
|
return f"<OrchestrationTemplate(id={self.id}, name={self.name})>"
|