[fix] app api multi agent call
This commit is contained in:
@@ -9,7 +9,8 @@ from typing import Dict, Any, Optional
|
||||
from datetime import datetime
|
||||
|
||||
from app.models import AppRelease
|
||||
|
||||
from app.models.agent_app_config_model import AgentConfig
|
||||
from app.models.multi_agent_model import MultiAgentConfig
|
||||
|
||||
class AgentConfigProxy:
|
||||
"""Proxy class for AgentConfig (legacy compatibility)"""
|
||||
@@ -24,20 +25,10 @@ class AgentConfigProxy:
|
||||
self.default_model_config_id = release.default_model_config_id
|
||||
|
||||
|
||||
def agent_config_4_app_release(release: AppRelease ):
|
||||
from app.models.agent_app_config_model import AgentConfig
|
||||
# Create AgentConfig instance
|
||||
# config = {
|
||||
# "system_prompt": agent_cfg.system_prompt,
|
||||
# "model_parameters": agent_cfg.model_parameters,
|
||||
# "knowledge_retrieval": agent_cfg.knowledge_retrieval,
|
||||
# "memory": agent_cfg.memory,
|
||||
# "variables": agent_cfg.variables or [],
|
||||
# "tools": agent_cfg.tools or {},
|
||||
# }
|
||||
#
|
||||
config_dict = release.config
|
||||
def agent_config_4_app_release(release: AppRelease ) -> AgentConfig:
|
||||
|
||||
config_dict = release.config
|
||||
|
||||
agent_config = AgentConfig(
|
||||
app_id=release.app_id,
|
||||
system_prompt=config_dict.get("system_prompt"),
|
||||
@@ -51,6 +42,26 @@ def agent_config_4_app_release(release: AppRelease ):
|
||||
|
||||
return agent_config
|
||||
|
||||
def multi_agent_config_4_app_release(release: AppRelease ) -> MultiAgentConfig:
|
||||
|
||||
config_dict = release.config
|
||||
|
||||
|
||||
agent_config = MultiAgentConfig(
|
||||
app_id=release.app_id,
|
||||
default_model_config_id=release.default_model_config_id,
|
||||
model_parameters=config_dict.get("model_parameters"),
|
||||
master_agent_id=config_dict.get("master_agent_id"),
|
||||
master_agent_name=config_dict.get("master_agent_name"),
|
||||
orchestration_mode=config_dict.get("orchestration_mode", "conditional"),
|
||||
sub_agents=config_dict.get("sub_agents", []),
|
||||
routing_rules=config_dict.get("routing_rules"),
|
||||
execution_config=config_dict.get("execution_config", {}),
|
||||
aggregation_strategy=config_dict.get("aggregation_strategy", "merge"),
|
||||
|
||||
)
|
||||
|
||||
return agent_config
|
||||
|
||||
def dict_to_multi_agent_config(config_dict: Dict[str, Any], app_id: Optional[uuid.UUID] = None):
|
||||
"""Convert dict to MultiAgentConfig model object
|
||||
|
||||
Reference in New Issue
Block a user