Merge branch 'dev' of https://github.com/MoFox-Studio/MoFox_Bot into dev
This commit is contained in:
@@ -19,6 +19,7 @@ dependencies = [
|
|||||||
"faiss-cpu>=1.11.0",
|
"faiss-cpu>=1.11.0",
|
||||||
"fastapi>=0.116.0",
|
"fastapi>=0.116.0",
|
||||||
"google>=3.0.0",
|
"google>=3.0.0",
|
||||||
|
"filetype>=1.2.0",
|
||||||
"google-genai>=1.29.0",
|
"google-genai>=1.29.0",
|
||||||
"httpx>=0.28.1",
|
"httpx>=0.28.1",
|
||||||
"json-repair>=0.47.6",
|
"json-repair>=0.47.6",
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ dotenv
|
|||||||
faiss-cpu
|
faiss-cpu
|
||||||
fastapi
|
fastapi
|
||||||
fastmcp
|
fastmcp
|
||||||
|
filetype
|
||||||
rjieba
|
rjieba
|
||||||
jsonlines
|
jsonlines
|
||||||
maim_message
|
maim_message
|
||||||
|
|||||||
@@ -254,7 +254,8 @@ class ChineseTypoGenerator:
|
|||||||
all_combinations = itertools.product(*candidates)
|
all_combinations = itertools.product(*candidates)
|
||||||
|
|
||||||
# 获取rjieba词典和词频信息
|
# 获取rjieba词典和词频信息
|
||||||
dict_path = os.path.join(os.path.dirname(rjieba.__file__), "dict.txt")
|
base_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
|
||||||
|
dict_path = os.path.join(base_dir, "depends-data", "dict.txt")
|
||||||
valid_words = {} # 改用字典存储词语及其频率
|
valid_words = {} # 改用字典存储词语及其频率
|
||||||
with open(dict_path, encoding="utf-8") as f:
|
with open(dict_path, encoding="utf-8") as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import base64
|
import base64
|
||||||
import datetime
|
import datetime
|
||||||
import imghdr
|
import filetype
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
@@ -238,11 +238,11 @@ class ContentService:
|
|||||||
continue
|
continue
|
||||||
image_bytes = await resp.read()
|
image_bytes = await resp.read()
|
||||||
|
|
||||||
image_format = imghdr.what(None, image_bytes)
|
kind = filetype.guess(image_bytes)
|
||||||
if not image_format:
|
if kind is None:
|
||||||
logger.error(f"无法识别图片格式: {image_url}")
|
logger.error(f"无法识别图片格式: {image_url}")
|
||||||
return None
|
return None
|
||||||
|
image_format = kind.extension
|
||||||
image_base64 = base64.b64encode(image_bytes).decode("utf-8")
|
image_base64 = base64.b64encode(image_bytes).decode("utf-8")
|
||||||
|
|
||||||
vision_model_name = self.get_config("models.vision_model", "vlm")
|
vision_model_name = self.get_config("models.vision_model", "vlm")
|
||||||
|
|||||||
Reference in New Issue
Block a user