feat(skills and model):
1. Add the "Skills" module; 2. The loading of the model square has been modified to be controlled through environment variables; 3. Dynamic scheduling of the skill binding tool; 4. Agent Integration Skills
This commit is contained in:
@@ -28,6 +28,7 @@ from .tool_model import (
|
||||
ToolExecution, ToolType, ToolStatus, AuthType, ExecutionStatus
|
||||
)
|
||||
from .memory_perceptual_model import MemoryPerceptualModel
|
||||
from .skill_model import Skill
|
||||
from .ontology_scene import OntologyScene
|
||||
from .ontology_class import OntologyClass
|
||||
from .ontology_scene import OntologyScene
|
||||
@@ -84,5 +85,6 @@ __all__ = [
|
||||
"ExecutionStatus",
|
||||
"MemoryPerceptualModel",
|
||||
"ModelBase",
|
||||
"LoadBalanceStrategy"
|
||||
"LoadBalanceStrategy",
|
||||
"Skill"
|
||||
]
|
||||
|
||||
@@ -30,6 +30,7 @@ class AgentConfig(Base):
|
||||
memory = Column(JSON, nullable=True, comment="记忆配置")
|
||||
variables = Column(JSON, default=list, nullable=True, comment="变量配置")
|
||||
tools = Column(JSON, default=dict, nullable=True, comment="工具配置")
|
||||
skill_ids = Column(JSON, default=list, nullable=True, comment="关联的技能ID列表")
|
||||
|
||||
# 多 Agent 相关字段
|
||||
agent_role = Column(String(20), comment="Agent 角色: master|sub|standalone")
|
||||
|
||||
37
api/app/models/skill_model.py
Normal file
37
api/app/models/skill_model.py
Normal file
@@ -0,0 +1,37 @@
|
||||
"""Skill 模型定义"""
|
||||
import datetime
|
||||
import uuid
|
||||
from sqlalchemy import Column, String, Boolean, DateTime, Text, ForeignKey
|
||||
from sqlalchemy.dialects.postgresql import UUID, JSON
|
||||
|
||||
from app.db import Base
|
||||
|
||||
|
||||
class Skill(Base):
|
||||
"""技能模型 - 可以关联工具(内置、MCP、自定义)"""
|
||||
__tablename__ = "skills"
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4, index=True)
|
||||
name = Column(String, nullable=False, comment="技能名称")
|
||||
description = Column(Text, comment="技能描述")
|
||||
tenant_id = Column(UUID(as_uuid=True), ForeignKey("tenants.id"), nullable=False, index=True, comment="租户ID")
|
||||
|
||||
# 关联的工具
|
||||
tools = Column(JSON, default=list, comment="关联的工具列表")
|
||||
|
||||
# 技能配置
|
||||
config = Column(JSON, default=dict, comment="技能配置")
|
||||
|
||||
# 专属提示词
|
||||
prompt = Column(Text, comment="技能专属提示词")
|
||||
|
||||
# 状态
|
||||
is_active = Column(Boolean, default=True, nullable=False, comment="是否激活")
|
||||
is_public = Column(Boolean, default=False, nullable=False, comment="是否公开到市场")
|
||||
|
||||
# 时间戳
|
||||
created_at = Column(DateTime, default=datetime.datetime.now, comment="创建时间")
|
||||
updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment="更新时间")
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Skill(id={self.id}, name={self.name})>"
|
||||
Reference in New Issue
Block a user