Merge branch 'dev' of https://github.com/MoFox-Studio/MoFox_Bot into dev
This commit is contained in:
@@ -7,7 +7,7 @@ import io
|
||||
import asyncio
|
||||
import numpy as np
|
||||
|
||||
from typing import Optional, Tuple
|
||||
from typing import Optional, Tuple, Dict, Any
|
||||
from PIL import Image
|
||||
from rich.traceback import install
|
||||
|
||||
@@ -24,6 +24,22 @@ install(extra_lines=3)
|
||||
logger = get_logger("chat_image")
|
||||
|
||||
|
||||
def is_image_message(message: Dict[str, Any]) -> bool:
|
||||
"""
|
||||
判断消息是否为图片消息
|
||||
|
||||
Args:
|
||||
message: 消息字典
|
||||
|
||||
Returns:
|
||||
bool: 是否为图片消息
|
||||
"""
|
||||
return message.get("type") == "image" or (
|
||||
isinstance(message.get("content"), dict) and
|
||||
message["content"].get("type") == "image"
|
||||
)
|
||||
|
||||
|
||||
class ImageManager:
|
||||
_instance = None
|
||||
IMAGE_DIR = "data" # 图像存储根目录
|
||||
|
||||
Reference in New Issue
Block a user