@@ -257,8 +257,9 @@ def get_models(dialog):
257257 raise Exception ("**ERROR**: Knowledge bases use different embedding models." )
258258
259259 if embedding_list :
260- embd_model_config = get_model_config_by_type_and_name (dialog .tenant_id , LLMType .EMBEDDING , embedding_list [0 ])
261- embd_mdl = LLMBundle (dialog .tenant_id , embd_model_config )
260+ embd_owner_tenant_id = kbs [0 ].tenant_id
261+ embd_model_config = get_model_config_by_type_and_name (embd_owner_tenant_id , LLMType .EMBEDDING , embedding_list [0 ])
262+ embd_mdl = LLMBundle (embd_owner_tenant_id , embd_model_config )
262263 if not embd_mdl :
263264 raise LookupError ("Embedding model(%s) not found" % embedding_list [0 ])
264265
@@ -1367,8 +1368,9 @@ async def async_ask(question, kb_ids, tenant_id, chat_llm_name=None, search_conf
13671368
13681369 is_knowledge_graph = all ([kb .parser_id == ParserType .KG for kb in kbs ])
13691370 retriever = settings .retriever if not is_knowledge_graph else settings .kg_retriever
1370- embd_model_config = get_model_config_by_type_and_name (tenant_id , LLMType .EMBEDDING , embedding_list [0 ])
1371- embd_mdl = LLMBundle (tenant_id , embd_model_config )
1371+ embd_owner_tenant_id = kbs [0 ].tenant_id
1372+ embd_model_config = get_model_config_by_type_and_name (embd_owner_tenant_id , LLMType .EMBEDDING , embedding_list [0 ])
1373+ embd_mdl = LLMBundle (embd_owner_tenant_id , embd_model_config )
13721374 chat_model_config = get_model_config_by_type_and_name (tenant_id , LLMType .CHAT , chat_llm_name )
13731375 chat_mdl = LLMBundle (tenant_id , chat_model_config )
13741376 if rerank_id :
@@ -1449,9 +1451,11 @@ async def gen_mindmap(question, kb_ids, tenant_id, search_config={}):
14491451 tenant_ids = list (set ([kb .tenant_id for kb in kbs ]))
14501452 if tenant_embedding_list [0 ]:
14511453 embd_model_config = get_model_config_by_id (tenant_embedding_list [0 ])
1454+ embd_owner_tenant_id = kbs [0 ].tenant_id
14521455 else :
1453- embd_model_config = get_model_config_by_type_and_name (tenant_id , LLMType .EMBEDDING , kbs [0 ].embd_id )
1454- embd_mdl = LLMBundle (tenant_id , embd_model_config )
1456+ embd_owner_tenant_id = kbs [0 ].tenant_id
1457+ embd_model_config = get_model_config_by_type_and_name (embd_owner_tenant_id , LLMType .EMBEDDING , kbs [0 ].embd_id )
1458+ embd_mdl = LLMBundle (embd_owner_tenant_id , embd_model_config )
14551459 chat_id = search_config .get ("chat_id" , "" )
14561460 if chat_id :
14571461 chat_model_config = get_model_config_by_type_and_name (tenant_id , LLMType .CHAT , chat_id )
0 commit comments