- New llm_api_map table: extract ability-specific fields (apiname, query_apiname, query_period, ppid) from llm table to support one-model-multi-ability without redundancy - Remove uapiset from llmage JOIN chain: upapp.apisetid now directly joins uapi.apisetid - Updated BufferedLLMs.get_llm() to JOIN llm_api_map for query_apiname/query_period/ppid fields - Updated llmcheck.dspy and list_paging_catelog_llms.dspy to remove uapiset references - Added migration script to generate llm_api_map INSERTs from existing llm data
55 lines
1.6 KiB
Plaintext
55 lines
1.6 KiB
Plaintext
llmid = params_kw.llmid
|
|
today= params_kw.today
|
|
msgs = []
|
|
async with get_sor_context(request._run_ns, 'llmage') as sor:
|
|
sql = "select * from llm where id=${llmid}$ and enabled_date <= ${today}$ and expired_date > ${today}$"
|
|
ns = {'llmid': llmid, 'today': today}
|
|
recs = await sor.sqlExe(sql, ns.copy())
|
|
if recs:
|
|
msgs.append('llm read ok')
|
|
else:
|
|
msgs.append(f'llm not found: {llmid=}, {today=}')
|
|
return msgs
|
|
sql = """select a.* from llm a, upapp b
|
|
where a.id=${llmid}$
|
|
and a.upappid = b.id
|
|
and a.enabled_date <= ${today}$
|
|
and a.expired_date > ${today}$"""
|
|
recs = await sor.sqlExe(sql, ns.copy())
|
|
if recs:
|
|
msgs.append('llm join upapp read ok')
|
|
else:
|
|
msgs.append('llm join upapp not found: {llmid=}, {today=}')
|
|
return msgs
|
|
|
|
sql = """select a.*, e.ioid, e.stream
|
|
from llm a
|
|
join upapp c on a.upappid = c.id
|
|
join uapi e on c.apisetid = e.apisetid and a.apiname = e.name
|
|
where a.id=${llmid}$
|
|
and a.expired_date > ${today}$
|
|
and a.enabled_date <= ${today}$"""
|
|
recs = await sor.sqlExe(sql, ns.copy())
|
|
if recs:
|
|
msgs.append('llm join upapp join uapi read ok')
|
|
else:
|
|
msgs.append('llm join upapp join uapi not found: {llmid=}, {today=}')
|
|
return msgs
|
|
|
|
sql = """select a.*, e.ioid, e.stream
|
|
from llm a
|
|
join upapp c on a.upappid = c.id
|
|
join uapi e on c.apisetid = e.apisetid and a.apiname = e.name
|
|
join uapiio b on e.ioid = b.id
|
|
where a.id=${llmid}$
|
|
and a.expired_date > ${today}$
|
|
and a.enabled_date <= ${today}$"""
|
|
recs = await sor.sqlExe(sql, ns.copy())
|
|
if recs:
|
|
msgs.append('llm join upapp join uapi join uapiio read ok')
|
|
else:
|
|
msgs.append('llm join upapp join uapi join uapiio not found: {llmid=}, {today=}')
|
|
return msgs
|
|
return msgs
|
|
return msgs
|