llmage/wwwroot/list_paging_catelog_llms.dspy
yumoqing 5b3c7d4d02 refactor: 废弃llm_catalog_rel表, 分类关系改用llm_api_map
- 删除 llm_catalog_rel 表定义(models/json/xlsx)、CRUD文件、管理页面、迁移脚本
- utils.py: get_llms_by_catelog/get_llms_by_catelog_to_customer 的SQL从 llm_catalog_rel 改为 llm_api_map (加distinct去重)
- init.py: 缓存清除事件从 llm_catalog_rel 改为 llm_api_map
- menu.ui/index.ui: 移除类型关联菜单项
- dspy文件: v1/chat/completions, t2t, get_type_llms, list_catelog_models, list_paging_catelog_llms, llmcatelog_delete 全部改为 join llm_api_map
- 迁移脚本: 添加try/except兼容旧表不存在的情况
2026-05-21 16:22:59 +08:00

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 distinct a.*, b.hfid, e.ioid, e.stream
from llm a
join llm_api_map m on a.id = m.llmid
join llmcatelog b on m.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 m.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 {}