fix:兼容旧图片格式
This commit is contained in:
@@ -381,13 +381,20 @@ class ImageManager:
|
|||||||
existing_image = Images.get_or_none(Images.emoji_hash == image_hash)
|
existing_image = Images.get_or_none(Images.emoji_hash == image_hash)
|
||||||
|
|
||||||
if existing_image:
|
if existing_image:
|
||||||
# print(f"图片已存在: {existing_image.image_id}")
|
# 检查是否缺少必要字段,如果缺少则创建新记录
|
||||||
# print(f"图片描述: {existing_image.description}")
|
if (not hasattr(existing_image, 'image_id') or not existing_image.image_id or
|
||||||
# print(f"图片计数: {existing_image.count}")
|
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):
|
||||||
existing_image.count += 1
|
logger.debug(f"图片记录缺少必要字段,补全旧记录: {image_hash}")
|
||||||
existing_image.save()
|
image_id = str(uuid.uuid4())
|
||||||
return existing_image.image_id, f"[picid:{existing_image.image_id}]"
|
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:
|
else:
|
||||||
# print(f"图片不存在: {image_hash}")
|
# print(f"图片不存在: {image_hash}")
|
||||||
image_id = str(uuid.uuid4())
|
image_id = str(uuid.uuid4())
|
||||||
@@ -411,6 +418,7 @@ class ImageManager:
|
|||||||
type="image",
|
type="image",
|
||||||
timestamp=current_timestamp,
|
timestamp=current_timestamp,
|
||||||
vlm_processed=False,
|
vlm_processed=False,
|
||||||
|
count=1,
|
||||||
)
|
)
|
||||||
|
|
||||||
# 启动异步VLM处理
|
# 启动异步VLM处理
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ TEMPLATE_DIR = "template"
|
|||||||
|
|
||||||
# 考虑到,实际上配置文件中的mai_version是不会自动更新的,所以采用硬编码
|
# 考虑到,实际上配置文件中的mai_version是不会自动更新的,所以采用硬编码
|
||||||
# 对该字段的更新,请严格参照语义化版本规范:https://semver.org/lang/zh-CN/
|
# 对该字段的更新,请严格参照语义化版本规范:https://semver.org/lang/zh-CN/
|
||||||
MMC_VERSION = "0.7.4-snapshot.1"
|
MMC_VERSION = "0.8.0-snapshot.1"
|
||||||
|
|
||||||
|
|
||||||
def update_config():
|
def update_config():
|
||||||
|
|||||||
Reference in New Issue
Block a user