|
@@ -1,7 +1,7 @@
|
|
#! /usr/bin/env python
|
|
#! /usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
# -*- coding: utf-8 -*-
|
|
# vim:fenc=utf-8
|
|
# vim:fenc=utf-8
|
|
-
|
|
|
|
|
|
+import json
|
|
import re
|
|
import re
|
|
import signal
|
|
import signal
|
|
import sys
|
|
import sys
|
|
@@ -475,9 +475,14 @@ class AgentService:
|
|
agent_config = get_agent_abtest_config('chat', main_agent.user_id,
|
|
agent_config = get_agent_abtest_config('chat', main_agent.user_id,
|
|
self.service_module_manager, self.agent_config_manager)
|
|
self.service_module_manager, self.agent_config_manager)
|
|
if agent_config:
|
|
if agent_config:
|
|
|
|
+ try:
|
|
|
|
+ tool_names = json.loads(agent_config.tools)
|
|
|
|
+ except json.JSONDecodeError:
|
|
|
|
+ logger.error(f"Invalid JSON in agent tools: {agent_config.tools}")
|
|
|
|
+ tool_names = []
|
|
chat_agent = MessageReplyAgent(model=agent_config.execution_model,
|
|
chat_agent = MessageReplyAgent(model=agent_config.execution_model,
|
|
system_prompt=agent_config.system_prompt,
|
|
system_prompt=agent_config.system_prompt,
|
|
- tools=get_tools(agent_config.tools))
|
|
|
|
|
|
+ tools=get_tools(tool_names))
|
|
else:
|
|
else:
|
|
chat_agent = MessageReplyAgent()
|
|
chat_agent = MessageReplyAgent()
|
|
chat_responses = chat_agent.generate_message(
|
|
chat_responses = chat_agent.generate_message(
|