mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-05 19:11:52 +00:00
feat(agent):Fix agent bug (#1953)
Co-authored-by: aries_ckt <916701291@qq.com>
This commit is contained in:
@@ -82,10 +82,10 @@ class ActionOutput(BaseModel):
|
||||
class Action(ABC, Generic[T]):
|
||||
"""Base Action class for defining agent actions."""
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, language: str = "en"):
|
||||
"""Create an action."""
|
||||
self.resource: Optional[Resource] = None
|
||||
self.language: str = "en"
|
||||
self.language: str = language
|
||||
|
||||
def init_resource(self, resource: Optional[Resource]):
|
||||
"""Initialize the resource."""
|
||||
|
@@ -12,9 +12,9 @@ logger = logging.getLogger(__name__)
|
||||
class BlankAction(Action):
|
||||
"""Blank action class."""
|
||||
|
||||
def __init__(self):
|
||||
"""Create a blank action."""
|
||||
super().__init__()
|
||||
def __init__(self, **kwargs):
|
||||
"""Blank action init."""
|
||||
super().__init__(**kwargs)
|
||||
|
||||
@property
|
||||
def ai_out_schema(self) -> Optional[str]:
|
||||
|
@@ -127,9 +127,6 @@ class AgentManager(BaseComponent):
|
||||
def list_agents(self):
|
||||
"""Return a list of all registered agents and their descriptions."""
|
||||
result = []
|
||||
from datetime import datetime
|
||||
|
||||
logger.info(f"List Agent Begin:{datetime.now()}")
|
||||
for name, value in self._agents.items():
|
||||
result.append(
|
||||
{
|
||||
@@ -137,7 +134,6 @@ class AgentManager(BaseComponent):
|
||||
"desc": value[1].goal,
|
||||
}
|
||||
)
|
||||
logger.info(f"List Agent End:{datetime.now()}")
|
||||
return result
|
||||
|
||||
|
||||
|
@@ -673,7 +673,7 @@ class ConversableAgent(Role, Agent):
|
||||
self.actions = []
|
||||
for idx, action in enumerate(actions):
|
||||
if issubclass(action, Action):
|
||||
self.actions.append(action())
|
||||
self.actions.append(action(language=self.language))
|
||||
|
||||
async def _a_append_message(
|
||||
self, message: AgentMessage, role, sender: Agent
|
||||
|
@@ -40,7 +40,7 @@ class PlanAction(Action[List[PlanInput]]):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
"""Create a plan action."""
|
||||
super().__init__()
|
||||
super().__init__(**kwargs)
|
||||
self._render_protocol = VisAgentPlans()
|
||||
|
||||
@property
|
||||
|
Reference in New Issue
Block a user