[fix] public share agent run

This commit is contained in:
Mark
2026-01-06 14:43:23 +08:00
parent 85c7e531e4
commit f59f508c4d
3 changed files with 17 additions and 11 deletions

View File

@@ -4,6 +4,8 @@ from sqlalchemy import Column, String, Boolean, DateTime, Text, ForeignKey
from sqlalchemy.dialects.postgresql import UUID, JSON
from sqlalchemy.orm import relationship
from app.db import Base
from app.models.multi_agent_model import PydanticType
from app.schemas import ModelParameters
class AgentConfig(Base):
@@ -17,14 +19,17 @@ class AgentConfig(Base):
# Agent 行为配置
system_prompt = Column(Text, nullable=True, comment="系统提示词")
default_model_config_id = Column(UUID(as_uuid=True), ForeignKey("model_configs.id"), nullable=True, index=True, comment="默认模型配置ID")
# 结构化配置(直接存储 JSON
model_parameters = Column(JSON, nullable=True, comment="模型参数配置temperature、max_tokens等")
# model_parameters = Column(JSON, nullable=True, comment="模型参数配置temperature、max_tokens等")
model_parameters = Column(PydanticType(ModelParameters), nullable=True,
comment="模型参数配置temperature、max_tokens等")
knowledge_retrieval = Column(JSON, nullable=True, comment="知识库检索配置")
memory = Column(JSON, nullable=True, comment="记忆配置")
variables = Column(JSON, default=list, nullable=True, comment="变量配置")
tools = Column(JSON, default=dict, nullable=True, comment="工具配置")
# 多 Agent 相关字段
agent_role = Column(String(20), comment="Agent 角色: master|sub|standalone")
agent_domain = Column(String(50), comment="专业领域: customer_service|technical_support|sales 等")
@@ -41,4 +46,4 @@ class AgentConfig(Base):
parent_agent = relationship("AgentConfig", remote_side=[id], backref="sub_agents")
def __repr__(self):
return f"<AgentConfig(id={self.id}, app_id={self.app_id})>"
return f"<AgentConfig(id={self.id}, app_id={self.app_id})>"