fix initialize (#1214)

This commit is contained in:
Robert Brennan 2024-04-18 13:19:33 -04:00 committed by GitHub
parent 2826e39056
commit 9e85550b46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -91,13 +91,6 @@ class AgentUnit:
match action:
case ActionType.INIT:
# FIXME: the parameters need be compared, to confirm whether reinit is needed
if self.controller is not None:
# Agent already started, no need to create a new one
if data.get('args', {}).get('reconnect', 'false') != 'true':
await self.controller.reset_task()
await self.init_done()
return
await self.create_controller(data)
case ActionType.START:
await self.start_task(data)
@ -149,6 +142,7 @@ class AgentUnit:
max_iterations = self.get_arg_or_default(args, ConfigType.MAX_ITERATIONS)
max_chars = self.get_arg_or_default(args, ConfigType.MAX_CHARS)
logger.info(f'Creating agent {agent_cls} using LLM {model}')
llm = LLM(model=model, api_key=api_key, base_url=api_base)
try:
self.controller = AgentController(