merge main

This commit is contained in:
StyleZhang
2024-03-26 15:25:02 +08:00
34 changed files with 443 additions and 214 deletions

View File

@ -143,7 +143,7 @@ class BaseAgentRunner(AppRunner):
result += f"result link: {response.message}. please tell user to check it."
elif response.type == ToolInvokeMessage.MessageType.IMAGE_LINK or \
response.type == ToolInvokeMessage.MessageType.IMAGE:
result += "image has been created and sent to user already, you should tell user to check it now."
result += "image has been created and sent to user already, you do not need to create it, just tell the user to check it now."
else:
result += f"tool response: {response.message}."
@ -497,7 +497,11 @@ class BaseAgentRunner(AppRunner):
tools = tools.split(';')
tool_calls: list[AssistantPromptMessage.ToolCall] = []
tool_call_response: list[ToolPromptMessage] = []
tool_inputs = json.loads(agent_thought.tool_input)
try:
tool_inputs = json.loads(agent_thought.tool_input)
except Exception as e:
logging.warning("tool execution error: {}, tool_input: {}.".format(str(e), agent_thought.tool_input))
tool_inputs = { agent_thought.tool: agent_thought.tool_input }
for tool in tools:
# generate a uuid for tool call
tool_call_id = str(uuid.uuid4())
@ -530,4 +534,4 @@ class BaseAgentRunner(AppRunner):
db.session.close()
return result
return result