From 93e3f17a67233f59aadceff1e5dce13bd95ba6b9 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 31 May 2026 19:53:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=81=A2=E5=A4=8Dproviderid/upappid?= =?UTF-8?q?=E7=9A=84alters=E9=85=8D=E7=BD=AE=EF=BC=8Cllm=5Flist.dspy?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=5Ftext=E5=AD=97=E6=AE=B5=E7=94=A8=E4=BA=8E?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- json/llm.json | 8 ++++++++ wwwroot/api/llm_list.dspy | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/json/llm.json b/json/llm.json index 8e4365e..ab7dcb6 100644 --- a/json/llm.json +++ b/json/llm.json @@ -36,6 +36,14 @@ "dataurl":"{{entire_url('/pricing/get_all_pricing_programs.dspy')}}", "textField": "name", "valueField": "id" + }, + "providerid": { + "uitype": "code", + "dataurl": "{{entire_url('../api/get_organizations.dspy')}}" + }, + "upappid": { + "uitype": "code", + "dataurl": "{{entire_url('../api/get_upapps.dspy')}}" } } }, diff --git a/wwwroot/api/llm_list.dspy b/wwwroot/api/llm_list.dspy index a13b467..5225bc4 100644 --- a/wwwroot/api/llm_list.dspy +++ b/wwwroot/api/llm_list.dspy @@ -51,6 +51,44 @@ try: """ rows = await sor.sqlExe(data_sql, {**filterdic, 'limit': rows_per_page, 'offset': offset}) result['rows'] = [dict(r) for r in (rows or [])] + + # Build text mappings for providerid and upappid + if result['rows']: + provider_ids = list(set(r['providerid'] for r in result['rows'] if r.get('providerid'))) + upapp_ids = list(set(r['upappid'] for r in result['rows'] if r.get('upappid'))) + + # Query organization table for providerid mapping + provider_map = {} + if provider_ids: + try: + async with get_sor_context(request._run_ns, 'rbac') as rbac_sor: + orgs = await rbac_sor.sqlExe( + "select id, orgname from organization", {} + ) + if orgs: + provider_map = {str(r.id): r.orgname or '' for r in orgs} + except Exception as e: + debug(f'get organization mapping error: {e}') + + # Query upapp table for upappid mapping + upapp_map = {} + if upapp_ids: + try: + async with get_sor_context(request._run_ns, 'uapi') as uapi_sor: + apps = await uapi_sor.sqlExe( + "select id, name from upapp", {} + ) + if apps: + upapp_map = {str(r.id): r.name or '' for r in apps} + except Exception as e: + debug(f'get upapp mapping error: {e}') + + # Attach text fields to rows + for row in result['rows']: + if row.get('providerid'): + row['providerid_text'] = provider_map.get(str(row['providerid'])) + if row.get('upappid'): + row['upappid_text'] = upapp_map.get(str(row['upappid'])) result['total'] = total result['success'] = True