From aafc6a4be77fd57ec0a164c709329a5e7f32a4e0 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 27 Jul 2026 08:24:40 +0800 Subject: [PATCH] =?UTF-8?q?style:=20black=E6=A0=BC=E5=BC=8F=E5=8C=96?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DCode=20Quality=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/app/services/ai_service.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/api/app/services/ai_service.py b/apps/api/app/services/ai_service.py index fb52d87df..33d6ba94b 100755 --- a/apps/api/app/services/ai_service.py +++ b/apps/api/app/services/ai_service.py @@ -207,7 +207,12 @@ def semantic_match_assets( """ description = (description or "").strip() if not assets: - return {"matches": [], "source": "fallback", "description": description, "total": 0} + return { + "matches": [], + "source": "fallback", + "description": description, + "total": 0, + } client = get_doubao_client() if not client.is_available: @@ -230,7 +235,9 @@ def semantic_match_assets( tags = asset.get("tags", []) tags_str = ",".join(str(t) for t in tags[:5]) desc = str(asset.get("description", ""))[:80] - asset_summaries.append(f"ID:{aid} | 名称:{name} | 标签:[{tags_str}] | 描述:{desc}") + asset_summaries.append( + f"ID:{aid} | 名称:{name} | 标签:[{tags_str}] | 描述:{desc}" + ) asset_ids = [str(a.get("id", "")) for a in assets[:50]] @@ -248,7 +255,9 @@ def semantic_match_assets( user_prompt = ( f"目标视频描述:{description}\n\n" - f"素材列表:\n" + "\n".join(asset_summaries) + "\n\n请返回每个素材的匹配分数JSON:" + f"素材列表:\n" + + "\n".join(asset_summaries) + + "\n\n请返回每个素材的匹配分数JSON:" ) messages = [