diff --git a/wwwroot/get_type_llms.dspy b/wwwroot/get_type_llms.dspy index 14cae11..aa241a1 100644 --- a/wwwroot/get_type_llms.dspy +++ b/wwwroot/get_type_llms.dspy @@ -1,33 +1,36 @@ lt = params_kw.catelogid or 't2v' -async with get_sor_context(request._run_ns, 'llmage') as sor: - sql = '''select distinct a.*, e.input_fields from llm a -join llm_api_map m on a.id = m.llmid -join llmcatelog b on m.llmcatelogid = b.id -join uapi d on d.upappid = a.upappid and a.apiname = d.name -join uapiio e on d.ioid = e.id -where (b.id=${lt}$ OR b.name=${lt}$) - and a.enabled_date <= ${biz_date}$ - and ${biz_date}$ < a.expired_date - and a.status = 'published' - and m.ppid is not NULL''' - biz_date = await get_business_date(sor) - recs = await sor.sqlExe(sql, { - 'biz_date': biz_date, - 'lt': lt - }) - for r in recs: - r.input_fields = json.loads(r.input_fields) +debug(f'{lt=}') +try: + async with get_sor_context(request._run_ns, 'llmage') as sor: + sql = '''select distinct a.*, e.input_fields from llm a + join llm_api_map m on a.id = m.llmid + join llmcatelog b on m.llmcatelogid = b.id + join uapi d on d.upappid = a.upappid and a.apiname = d.name + join uapiio e on d.ioid = e.id + where (b.id=${lt}$ OR b.name=${lt}$) + and a.enabled_date <= ${biz_date}$ + and ${biz_date}$ < a.expired_date + and a.status = 'published' + and m.ppid is not NULL''' + biz_date = await get_business_date(sor) + recs = await sor.sqlExe(sql, { + 'biz_date': biz_date, + 'lt': lt + }) + for r in recs: + r.input_fields = json.loads(r.input_fields) + return { + 'status': 'ok', + 'data': recs + } return { - 'status': 'ok', - 'data': recs + 'status': 'error', + 'data':{ + 'message': 'server error' + } } -return { - 'status': 'error', - 'data':{ - 'message': 'server error' - } -} - +except Exception as e: + debug(f'{lt=},{e},{format_exc()}')