config:change some parameters
This commit is contained in:
@@ -180,32 +180,38 @@ def _log_conversation_messages(
|
||||
for idx, msg in enumerate(conversation_messages, start_idx):
|
||||
role_name = msg.role.value if hasattr(msg.role, "value") else str(msg.role)
|
||||
|
||||
# 处理内容 - 显示完整内容,不截断
|
||||
if isinstance(msg.content, str):
|
||||
full_content = msg.content
|
||||
content_type = "文本"
|
||||
elif isinstance(msg.content, list):
|
||||
text_parts = [item for item in msg.content if isinstance(item, str)]
|
||||
image_count = len([item for item in msg.content if isinstance(item, tuple)])
|
||||
full_content = "".join(text_parts) if text_parts else ""
|
||||
content_type = f"混合({len(text_parts)}段文本, {image_count}张图片)"
|
||||
else:
|
||||
full_content = str(msg.content)
|
||||
content_type = "未知"
|
||||
# # 处理内容 - 显示完整内容,不截断
|
||||
# if isinstance(msg.content, str):
|
||||
# full_content = msg.content
|
||||
# content_type = "文本"
|
||||
# elif isinstance(msg.content, list):
|
||||
# text_parts = [item for item in msg.content if isinstance(item, str)]
|
||||
# image_count = len([item for item in msg.content if isinstance(item, tuple)])
|
||||
# full_content = "".join(text_parts) if text_parts else ""
|
||||
# content_type = f"混合({len(text_parts)}段文本, {image_count}张图片)"
|
||||
# else:
|
||||
# full_content = str(msg.content)
|
||||
# content_type = "未知"
|
||||
|
||||
# 构建单条消息的日志信息
|
||||
msg_info = f"\n========================================\n[消息 {idx}] 角色: {role_name} 内容类型: {content_type}\n-----------------------------"
|
||||
# msg_info = f"\n========================================\n[消息 {idx}] 角色: {role_name} 内容类型: {content_type}\n-----------------------------"
|
||||
msg_info = f"\n========================================\n[消息 {idx}] 角色: {role_name}\n-----------------------------"
|
||||
|
||||
if full_content:
|
||||
msg_info += f"\n{full_content}"
|
||||
# if full_content:
|
||||
# msg_info += f"\n{full_content}"
|
||||
if msg.content:
|
||||
msg_info += f"\n{msg.content}"
|
||||
|
||||
if msg.tool_calls:
|
||||
msg_info += f"\n 工具调用: {len(msg.tool_calls)}个"
|
||||
for tool_call in msg.tool_calls:
|
||||
msg_info += f"\n - {tool_call}"
|
||||
msg_info += f"\n - {tool_call.func_name}: {json.dumps(tool_call.args, ensure_ascii=False)}"
|
||||
|
||||
if msg.tool_call_id:
|
||||
msg_info += f"\n 工具调用ID: {msg.tool_call_id}"
|
||||
# if msg.tool_call_id:
|
||||
# msg_info += f"\n 工具调用ID: {msg.tool_call_id}"
|
||||
|
||||
log_lines.append(msg_info)
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ async def search_chat_history(
|
||||
return "未找到相关聊天记录"
|
||||
|
||||
# 如果匹配结果超过20条,不返回具体记录,只返回提示和所有相关关键词
|
||||
if len(filtered_records) > 20:
|
||||
if len(filtered_records) > 15:
|
||||
# 统计所有记录上的关键词并去重
|
||||
all_keywords_set = set()
|
||||
for record in filtered_records:
|
||||
|
||||
Reference in New Issue
Block a user