From a093e616cf27c35c06078678ea4ce4ba2248087b Mon Sep 17 00:00:00 2001 From: Magicbook1108 Date: Thu, 8 Jan 2026 16:12:08 +0800 Subject: [PATCH] Fix: add multimodel models in chat api (#12496) ### What problem does this PR solve? Fix: add multimodel models in chat api #11986 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Co-authored-by: Kevin Hu --- api/apps/sdk/chat.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/apps/sdk/chat.py b/api/apps/sdk/chat.py index 1efb628f1..4321d7366 100644 --- a/api/apps/sdk/chat.py +++ b/api/apps/sdk/chat.py @@ -51,7 +51,9 @@ async def create(tenant_id): req["llm_id"] = llm.pop("model_name") if req.get("llm_id") is not None: llm_name, llm_factory = TenantLLMService.split_model_name_and_factory(req["llm_id"]) - if not TenantLLMService.query(tenant_id=tenant_id, llm_name=llm_name, llm_factory=llm_factory, model_type="chat"): + model_type = llm.get("model_type") + model_type = model_type if model_type in ["chat", "image2text"] else "chat" + if not TenantLLMService.query(tenant_id=tenant_id, llm_name=llm_name, llm_factory=llm_factory, model_type=model_type): return get_error_data_result(f"`model_name` {req.get('llm_id')} doesn't exist") req["llm_setting"] = req.pop("llm") e, tenant = TenantService.get_by_id(tenant_id)