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():