fix(bug): bug fix

This commit is contained in:
Timebomb2018
2026-03-19 17:54:32 +08:00
parent 7056865726
commit 6105d46198
3 changed files with 5 additions and 10 deletions

View File

@@ -187,7 +187,7 @@ class AppChatService:
"usage": result.get("usage", {"prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0}),
"audio_url": None
}
if files:
if processed_files:
human_meta["files"].extend(processed_files)
# 保存消息
@@ -395,13 +395,8 @@ class AppChatService:
"audio_url": None
}
if files:
for f in files:
# url = await MultimodalService(self.db).get_file_url(f)
human_meta["files"].append({
"type": f.type,
"url": f.url
})
if processed_files:
human_meta["files"].extend(processed_files)
if stream_audio_url:
assistant_meta["audio_url"] = stream_audio_url

View File

@@ -820,7 +820,6 @@ class AgentRunService:
conversation_id=conversation_id,
max_history=memory_config.get("max_history", 10)
)
print(history)
# 6. 处理多模态文件
processed_files = None

View File

@@ -713,7 +713,8 @@ class MultimodalService:
# 1. 自动检测文件编码
detect = chardet.detect(file_content)
encoding = detect.get("encoding", "utf-8").lower()
encoding = detect.get("encoding") or "utf-8"
encoding = encoding.lower()
# 2. 兼容常见中文编码
compatible_encodings = ["utf-8", "gbk", "gb18030", "gb2312", "ascii", "latin-1"]