v3.1 + 批次0: 智能回复重构基线 - ApprovalMatcher + 关键词降级 + 文档速修 + v4.0任务书面化

This commit is contained in:
Simon
2026-07-17 23:08:59 +08:00
parent 5a77a89ab1
commit 3ed86d5fb3
181 changed files with 19738 additions and 2655 deletions
+27
View File
@@ -207,6 +207,33 @@ async def receive_message(
extra_data: dict = {}
if msg_type == "image":
extra_data["pic_url"] = pic_url
# 下载企微图片到本地服务器,避免临时URL过期
if media_id:
try:
import os
import uuid
# 下载图片二进制数据
image_data = await wecom_service.download_temp_media(media_id)
# 生成保存路径
file_ext = ".jpg" # 企微返回的图片通常是 jpg
file_name = f"{uuid.uuid4()}{file_ext}"
upload_dir = os.path.join("uploads", "images")
os.makedirs(upload_dir, exist_ok=True)
file_path = os.path.join(upload_dir, file_name)
# 保存到本地
with open(file_path, "wb") as f:
f.write(image_data)
# 构建本地访问 URL
local_media_url = f"/media/images/{file_name}"
extra_data["local_media_url"] = local_media_url
logger.info(f"企微图片已下载到本地: media_id={media_id}, path={file_path}")
except Exception as img_err:
# 下载失败不影响消息处理,记录错误继续
logger.warning(f"企微图片下载失败: media_id={media_id}, error={img_err}")
elif msg_type == "voice":
extra_data["format"] = msg_format
elif msg_type == "video":