- 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
39 lines
1.1 KiB
Plaintext
39 lines
1.1 KiB
Plaintext
if int(params_kw._is_mobile) == 1:
|
|
pagerows = 80
|
|
else:
|
|
pagerows = 260
|
|
page = int(params_kw.get('page', 1))
|
|
dbname = get_module_dbname('llmage')
|
|
db = DBPools()
|
|
async with db.sqlorContext(dbname) as sor:
|
|
sql = """select x.*,
|
|
z.input_fields,
|
|
y.system_message,
|
|
y.user_message,
|
|
y.assisant_message
|
|
from (
|
|
select a.*, b.hfid, e.ioid, e.stream
|
|
from llm a
|
|
join llm_catalog_rel rel on a.id = rel.llmid
|
|
join llmcatelog b on rel.llmcatelogid = b.id
|
|
join upapp c on a.upappid = c.id
|
|
join uapi e on c.apisetid = e.apisetid and a.apiname = e.name
|
|
) x left join historyformat y on x.hfid = y.id
|
|
left join uapiio z on x.ioid = z.id
|
|
where rel.llmcatelogid = ${llmcatelogid}$
|
|
and x.id != ${llmid}$
|
|
"""
|
|
ns = params_kw.copy()
|
|
ns.page = page
|
|
ns.pagerows = pagerows
|
|
recs = await sor.sqlPaging(sql, ns)
|
|
for r in recs.get('rows', []):
|
|
r.llmid = r.id
|
|
r.modelname = r.name
|
|
r.description = ''.join(''.join(r.description.split('\n')).split('\r'))
|
|
r.response_mode = r.stream
|
|
r.icon = entire_url('/appbase/show_icon.dspy') + f'?id={r.iconid}'
|
|
r.url = entire_url('/llmage/llminference.dspy')
|
|
return recs
|
|
return {}
|