fix: 机器人收到重复图片时也回复OCR识别结果给用户

This commit is contained in:
EduBrain Dev
2026-04-14 14:00:28 +08:00
parent 36a6debcb3
commit 2954f3cb5e

View File

@@ -283,10 +283,12 @@ class WeComBotService:
if status == "duplicate": if status == "duplicate":
dup_id = result.get("duplicate_of", "?") dup_id = result.get("duplicate_of", "?")
ocr_text = result.get("ocr_text", "")
preview = ocr_text[:200].replace("\n", " ") if ocr_text else "无识别内容"
await self.ws_client.reply_stream( await self.ws_client.reply_stream(
frame, frame,
stream_id, stream_id,
f"该图片内容已存在于知识库中ID: {dup_id}),无需重复录入。", f"🔄 该图片内容已存在于知识库中ID: {dup_id}),无需重复录入。\n\n识别内容:\n{preview}{'...' if len(ocr_text) > 200 else ''}",
True, True,
) )
elif status == "completed": elif status == "completed":