llmage/wwwroot/llmcheck.dspy
yumoqing d6e4221a7b feat: add model publish/unpublish (上架/下架) functionality
- llm table: add status field (published/unpublished, default unpublished)
- User-facing queries: filter by status='published' in 11 query points:
  - utils.py: get_llms_by_catelog_to_customer, get_llms_by_catelog,
    get_llm, get_llmproviders, get_llms_sort_by_provider
  - v1 endpoints: chat/completions, image/generations, video/generations
  - user pages: t2t, get_type_llms, list_catelog_models,
    list_paging_catelog_llms, llmcheck
- CRUD: status column visible/editable with select dropdown
- Admin CRUD list shows ALL models regardless of status
- Migration SQL: sql/add_status_field.sql (existing models set to published)
2026-05-28 23:42:29 +08:00

55 lines
1.7 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}$ and status = 'published'"
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