llmage/wwwroot/get_my_asynctasks.dspy
yumoqing 90c93dbe07 feat: get_my_asynctasks 返回记录增加 llmcatelogid 属性
通过 llmid 查询 llm_api_map 表获取对应的 llmcatelogid
2026-06-04 15:12:29 +08:00

24 lines
608 B
Plaintext

userid = await get_user()
tasks = await get_today_asynctask_list(userid)
async with get_sor_context(request._run_ns, 'llmage') as sor:
for t in tasks:
bin = await read_webpath(t.ioinfo)
t.ioinfo = json.loads(bin.decode('utf-8'))
# 查询 llmcatelogid
llmcatelogid = None
if hasattr(t, 'llmid') and t.llmid:
sql = '''select m.llmcatelogid from llm_api_map m where m.llmid = ${llmid}$ limit 1'''
recs = await sor.sqlExe(sql, {'llmid': t.llmid})
if recs:
llmcatelogid = recs[0].llmcatelogid
t.llmcatelogid = llmcatelogid
return {
'status': 'ok',
'data': {
'tasks': tasks
}
}