llmage/wwwroot/get_my_asynctasks.dspy

28 lines
727 B
Plaintext

userid = await get_user()
llmcatelogid = params_kw.get('llmcatelogid', 't2t')
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
catid = 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:
catid = recs[0].llmcatelogid
t.llmcatelogid = catid
# 按 llmcatelogid 过滤
tasks = [t for t in tasks if t.llmcatelogid == llmcatelogid]
return {
'status': 'ok',
'data': {
'tasks': tasks
}
}