From 733f76b280f2e9a7cc65fd7eac0533f460b90ca4 Mon Sep 17 00:00:00 2001 From: SengokuCola <1026294844@qq.com> Date: Sat, 14 Jun 2025 20:38:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=85=BC=E5=AE=B9=E6=97=A7=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat/utils/utils_image.py | 22 +++++++++++++++------- src/config/config.py | 2 +- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/chat/utils/utils_image.py b/src/chat/utils/utils_image.py index 8062fd418..968846d15 100644 --- a/src/chat/utils/utils_image.py +++ b/src/chat/utils/utils_image.py @@ -381,13 +381,20 @@ class ImageManager: existing_image = Images.get_or_none(Images.emoji_hash == image_hash) if existing_image: - # print(f"图片已存在: {existing_image.image_id}") - # print(f"图片描述: {existing_image.description}") - # print(f"图片计数: {existing_image.count}") - # 更新计数 - existing_image.count += 1 - existing_image.save() - return existing_image.image_id, f"[picid:{existing_image.image_id}]" + # 检查是否缺少必要字段,如果缺少则创建新记录 + if (not hasattr(existing_image, 'image_id') or not existing_image.image_id or + not hasattr(existing_image, 'count') or existing_image.count is None or + not hasattr(existing_image, 'vlm_processed') or existing_image.vlm_processed is None): + logger.debug(f"图片记录缺少必要字段,补全旧记录: {image_hash}") + image_id = str(uuid.uuid4()) + else: + # print(f"图片已存在: {existing_image.image_id}") + # print(f"图片描述: {existing_image.description}") + # print(f"图片计数: {existing_image.count}") + # 更新计数 + existing_image.count += 1 + existing_image.save() + return existing_image.image_id, f"[picid:{existing_image.image_id}]" else: # print(f"图片不存在: {image_hash}") image_id = str(uuid.uuid4()) @@ -411,6 +418,7 @@ class ImageManager: type="image", timestamp=current_timestamp, vlm_processed=False, + count=1, ) # 启动异步VLM处理 diff --git a/src/config/config.py b/src/config/config.py index 986b392cf..67a8b6a25 100644 --- a/src/config/config.py +++ b/src/config/config.py @@ -48,7 +48,7 @@ TEMPLATE_DIR = "template" # 考虑到,实际上配置文件中的mai_version是不会自动更新的,所以采用硬编码 # 对该字段的更新,请严格参照语义化版本规范:https://semver.org/lang/zh-CN/ -MMC_VERSION = "0.7.4-snapshot.1" +MMC_VERSION = "0.8.0-snapshot.1" def update_config():