From 607a290a0622393948426d49e7e6def6cb18349a Mon Sep 17 00:00:00 2001 From: yhjun1026 <460342015@qq.com> Date: Wed, 13 Mar 2024 11:00:11 +0800 Subject: [PATCH] bug(agent):agent bug fix 1.Fix autoplan mode rely message miss 2.Fix ToolExpert use plugin hub load bug 3.Modify Agent message output logic --- dbgpt/agent/memory/gpts_memory.py | 7 +++---- dbgpt/serve/agent/team/layout/agent_operator.py | 12 +++++++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/dbgpt/agent/memory/gpts_memory.py b/dbgpt/agent/memory/gpts_memory.py index bcdf6ca32..c66386271 100644 --- a/dbgpt/agent/memory/gpts_memory.py +++ b/dbgpt/agent/memory/gpts_memory.py @@ -174,11 +174,10 @@ async def _messages_to_agents_vis( "markdown": view_info, } ) - return await vis_client.get(VisAgentMessages.vis_tag()).disply( - content=messages_view - ) + vis_compent = vis_client.get(VisAgentMessages.vis_tag()) + return await vis_compent.display(content=messages_view) async def _messages_to_plan_vis(self, messages: List[Dict]): if messages is None or len(messages) <= 0: return "" - return await vis_client.get(VisAgentPlans.vis_tag()).disply(content=messages) + return await vis_client.get(VisAgentPlans.vis_tag()).display(content=messages) diff --git a/dbgpt/serve/agent/team/layout/agent_operator.py b/dbgpt/serve/agent/team/layout/agent_operator.py index 5a4c7c207..662d8cd9b 100644 --- a/dbgpt/serve/agent/team/layout/agent_operator.py +++ b/dbgpt/serve/agent/team/layout/agent_operator.py @@ -1,7 +1,7 @@ from abc import ABC from typing import Dict, List, Optional -from dbgpt.agent.agents.agent import Agent, AgentGenerateContext +from dbgpt.agent.agents.agent_new import Agent, AgentGenerateContext from dbgpt.agent.agents.agents_manage import agent_manage from dbgpt.agent.agents.base_agent_new import ConversableAgent from dbgpt.agent.agents.llm.llm import LLMConfig @@ -191,6 +191,7 @@ async def map( agent_context=input_value.agent_context, resource_loader=input_value.resource_loader, llm_client=input_value.llm_client, + round_index=agent.consecutive_auto_reply_counter, ) async def get_agent( @@ -208,11 +209,19 @@ async def get_agent( llm_config = LLMConfig(llm_client=input_value.llm_client) else: llm_config = LLMConfig(llm_client=self.llm_client) + else: + if not llm_config.llm_client: + if input_value.llm_client: + llm_config.llm_client = input_value.llm_client + else: + llm_config.llm_client = self.llm_client + kwargs = {} if self.awel_agent.role_name: kwargs["name"] = self.awel_agent.role_name if self.awel_agent.fixed_subgoal: kwargs["fixed_subgoal"] = self.awel_agent.fixed_subgoal + agent = ( await agent_cls(**kwargs) .bind(input_value.memory) @@ -222,6 +231,7 @@ async def get_agent( .bind(input_value.resource_loader) .build() ) + return agent