Skip to content

Commit

Permalink
feat(agent):
Browse files Browse the repository at this point in the history
1.Modify the controller's dependence on the management agent
  • Loading branch information
yhjun1026 committed Jan 8, 2024
1 parent 39af413 commit 2d4525e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 29 deletions.
32 changes: 4 additions & 28 deletions dbgpt/serve/agent/agents/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from dbgpt._private.config import Config
from dbgpt.agent.agents.agent import Agent, AgentContext
from dbgpt.agent.agents.agents_mange import agent_mange
from dbgpt.agent.agents.plan_group_chat import PlanChat, PlanChatManager
from dbgpt.agent.agents.planner_agent import PlannerAgent

from dbgpt.agent.agents.user_proxy_agent import UserProxyAgent
from dbgpt.agent.common.schema import Status
from dbgpt.agent.memory.gpts_memory import GptsMemory
Expand All @@ -21,6 +20,7 @@
from dbgpt.model.cluster import WorkerManagerFactory
from dbgpt.model.cluster.client import DefaultLLMClient
from dbgpt.serve.agent.model import PagenationFilter, PluginHubFilter
from dbgpt.serve.agent.team.plan.team_auto_plan import AutoPlanChatManager

from ..db.gpts_conversations_db import GptsConversationsDao, GptsConversationsEntity
from ..db.gpts_mange_db import GptsInstanceDao, GptsInstanceEntity
Expand Down Expand Up @@ -148,15 +148,6 @@ async def agent_team_chat(
memory=self.memory,
)
agents.append(agent)
agent_map[name] = agent

groupchat = PlanChat(agents=agents, messages=[], max_round=50)
planner = PlannerAgent(
agent_context=context,
memory=self.memory,
plan_chat=groupchat,
)
agent_map[planner.name] = planner

manager = await self._build_chat_manger(context, mode, agents)
user_proxy = UserProxyAgent(memory=self.memory, agent_context=context)
Expand Down Expand Up @@ -212,9 +203,6 @@ async def plan_chat(
):
context = await self._build_agent_context(name, conv_id)

# create agent instance
agent_map = defaultdict()

### default plan excute mode
agents = []
for name in context.agents:
Expand All @@ -226,24 +214,13 @@ async def plan_chat(
agents.append(agent)
agent_map[name] = agent

groupchat = PlanChat(agents=agents, messages=[], max_round=50)
planner = PlannerAgent(
agent_context=context,
memory=self.memory,
plan_chat=groupchat,
)
agent_map[planner.name] = planner

manager = PlanChatManager(
manager = AutoPlanChatManager(
agent_context=context,
memory=self.memory,
plan_chat=groupchat,
planner=planner,
)
agent_map[manager.name] = manager
manager.hire(agents)

user_proxy = UserProxyAgent(memory=self.memory, agent_context=context)
agent_map[user_proxy.name] = user_proxy

gpts_conversation = self.gpts_conversations.get_by_conv_id(conv_id)
if gpts_conversation is None:
Expand Down Expand Up @@ -277,7 +254,6 @@ async def plan_chat(
try:
await user_proxy.a_retry_chat(
recipient=manager,
agent_map=agent_map,
memory=self.memory,
)
except Exception as e:
Expand Down
1 change: 0 additions & 1 deletion dbgpt/serve/agent/team/plan/team_auto_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from dbgpt.agent.agents.base_agent import ConversableAgent
from dbgpt.agent.agents.agent import Agent, AgentContext
from dbgpt.serve.agent.team.base import MangerAgent
from dbgpt.agent.common.schema import Status
from dbgpt.agent.memory.base import GptsPlan
from dbgpt.agent.memory.gpts_memory import GptsMemory
Expand Down

0 comments on commit 2d4525e

Please sign in to comment.