Merge pull request #1100 from XXXxx7258/dev

fix: avoid slice error when content is not sliceable
pull/1102/head
SengokuCola 2025-07-08 18:58:09 +08:00 committed by GitHub
commit 03647e3848
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -187,7 +187,11 @@ class ToolExecutor:
tool_results.append(tool_info)
logger.info(f"{self.log_prefix}工具{tool_name}执行成功,类型: {tool_info['type']}")
logger.debug(f"{self.log_prefix}工具{tool_name}结果内容: {tool_info['content'][:200]}...")
content = tool_info['content']
if not isinstance(content, (str, list, tuple)):
content = str(content)
preview = content[:200]
logger.debug(f"{self.log_prefix}工具{tool_name}结果内容: {preview}...")
except Exception as e:
logger.error(f"{self.log_prefix}工具{tool_name}执行失败: {e}")