From 6165795aa742d7539c758ff4ef370d24f3caaee7 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 17 Jul 2026 18:11:47 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=20build=5Fkimi?= =?UTF-8?q?=5Fcontent=20(=E8=BF=81=E7=A7=BB=E8=87=B3=20llmage/utils)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ahserver/filestorage.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/ahserver/filestorage.py b/ahserver/filestorage.py index c324a0f..8d901d4 100644 --- a/ahserver/filestorage.py +++ b/ahserver/filestorage.py @@ -238,22 +238,6 @@ def webpath_to_base64(webpath): b64 = base64.b64encode(f.read()).decode('utf-8') return f'data:{mime};base64,{b64}' -def build_kimi_content(prompt='', image_files=None, video_files=None): - """构造 kimi 多模态 content 数组 JSON""" - import json - parts = [] - if prompt: - parts.append({"type": "text", "text": prompt}) - for f in (image_files or []): - b64 = webpath_to_base64(f) - if b64: - parts.append({"type": "image_url", "image_url": b64}) - for f in (video_files or []): - b64 = webpath_to_base64(f) - if b64: - parts.append({"type": "video_url", "video_url": b64}) - return json.dumps(parts, ensure_ascii=False) - async def base642file(b64str): filename = getFilenameFromBase64(b64str) if ',' in b64str: @@ -299,6 +283,5 @@ async def data2qrpath(data, logo=None): from .serverenv import ServerEnv ServerEnv().webpath_to_base64 = webpath_to_base64 -ServerEnv().build_kimi_content = build_kimi_content