From 8e9ab5008c9e2f70eae4944bcdfabb74d1df75c1 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 1 Jun 2026 14:39:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20get=5Fllm=5Fllmusage=E7=94=A8JOIN?= =?UTF-8?q?=E4=BB=8Ellm=5Fapi=5Fmap=E8=8E=B7=E5=8F=96query=5Fapiname?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=BC=82=E6=AD=A5=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E8=BD=AE=E8=AF=A2=E5=8D=A1=E5=9C=A8CREATED?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- llmage/asyncinference.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/llmage/asyncinference.py b/llmage/asyncinference.py index c21044d..fb57544 100644 --- a/llmage/asyncinference.py +++ b/llmage/asyncinference.py @@ -141,9 +141,15 @@ async def get_llm_llmusage(luid): return if llmusage.status == 'FAILED': return - llms = await sor.R('llm', {'id': llmusage.llmid}) + # Use JOIN to get query_apiname/query_period from llm_api_map + sql = """select a.id, a.name, a.model, a.upappid, a.ownerid, a.status, +m.apiname, m.query_apiname, m.query_period, m.ppid +from llm a +join llm_api_map m on a.id = m.llmid +where a.id = ${llmid}$ and m.isdefaultcatelog = '1'""" + llms = await sor.sqlExe(sql, {'llmid': llmusage.llmid}) if len(llms) == 0: - e = Exception(f'{llmusage.llmid=} not found in llm') + e = Exception(f'{llmusage.llmid=} not found in llm/llm_api_map') exception(f'{e}') raise e llm = llms[0]