mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-28 01:53:53 +08:00
补充sql,增加错误详情上报
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (312, 'tool_call_timeout', '30', 'number', 1, '工具调用超时时间(秒)');
|
||||||
@@ -585,4 +585,10 @@ databaseChangeLog:
|
|||||||
- sqlFile:
|
- sqlFile:
|
||||||
encoding: utf8
|
encoding: utf8
|
||||||
path: classpath:db/changelog/202603311200.sql
|
path: classpath:db/changelog/202603311200.sql
|
||||||
|
- changeSet:
|
||||||
|
id: 202604011035
|
||||||
|
author: RanChen
|
||||||
|
changes:
|
||||||
|
- sqlFile:
|
||||||
|
encoding: utf8
|
||||||
|
path: classpath:db/changelog/202604011035.sql
|
||||||
|
|||||||
@@ -1117,6 +1117,9 @@ class ConnectionHandler:
|
|||||||
try:
|
try:
|
||||||
result = future.result(timeout=tool_call_timeout)
|
result = future.result(timeout=tool_call_timeout)
|
||||||
tool_results.append((result, tool_call_data))
|
tool_results.append((result, tool_call_data))
|
||||||
|
# 使用公共方法上报工具调用结果
|
||||||
|
enqueue_tool_report(self, tool_call_data['name'], tool_input, str(result.result) if result.result else None, report_tool_call=False)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.bind(tag=TAG).error(
|
self.logger.bind(tag=TAG).error(
|
||||||
f"工具调用超时或异常: {tool_call_data['name']}, 错误: {e}"
|
f"工具调用超时或异常: {tool_call_data['name']}, 错误: {e}"
|
||||||
@@ -1126,9 +1129,8 @@ class ConnectionHandler:
|
|||||||
ActionResponse(action=Action.ERROR, result="哎呀,网络遇到点问题,请稍后再试下!"),
|
ActionResponse(action=Action.ERROR, result="哎呀,网络遇到点问题,请稍后再试下!"),
|
||||||
tool_call_data
|
tool_call_data
|
||||||
))
|
))
|
||||||
|
# 上报工具调用错误
|
||||||
# 使用公共方法上报工具调用结果
|
enqueue_tool_report(self, tool_call_data['name'], tool_input, str(e), report_tool_call=False)
|
||||||
enqueue_tool_report(self, tool_call_data['name'], tool_input, str(result.result) if result.result else None, report_tool_call=False)
|
|
||||||
|
|
||||||
# 统一处理工具调用结果
|
# 统一处理工具调用结果
|
||||||
if tool_results:
|
if tool_results:
|
||||||
|
|||||||
Reference in New Issue
Block a user