From fe93d69c54abe8009dcbb047d0a000557c266728 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 30 Mar 2026 15:13:15 +0800 Subject: [PATCH] bugfix --- llmage/llmclient.py | 54 --------------------------------------------- 1 file changed, 54 deletions(-) diff --git a/llmage/llmclient.py b/llmage/llmclient.py index d388cfd..0a4f445 100644 --- a/llmage/llmclient.py +++ b/llmage/llmclient.py @@ -209,57 +209,3 @@ async def llm_query_price(llmid, config_data): prices = await env.pricing_program_charging(sor, llm.ppid, config_data) return prices -async def add_new_llmusage_output(luid, rzt): - env = ServerEnv() - async with get_sor_context(env, 'llmage') as sor: - recs = await sor.R('llmusage', {'id': luid}) - if recs: - r = recs[0] - io = json.loads(r.ioinfo) - out = io.get('output', []) - out.append(out) - io['output'] = out - r.ioinfo = json.dumps({ - 'input': io.get('input',{}), - 'output': out - }) - await sor.U('llmusage', r) - return - -async def query_task_status(request, upappid, apinames, luid, userid, taskid): - async with get_sor_context(env, 'llmage') as sor: - uapi = UAPI(request, sor) - for apiname in apinames: - try: - ns = {'taskid': taskid} - b = await uapi.call(upappid, apiname, userid, params=ns) - if isinstance(b, bytes): - b = b.decode('utf-8') - d = json.loads(b) - rzt = DictObject(**d) - await add_new_llmusage_output(luid, rzt) - if rzt.status == 'FAILED': - return - if rzt.status == 'SUCCEEDED': - if llm.ppid: - try: - chargings = await llm_charging(sor, - llm.ppid, callerid, usage) - llmusage.amount = chargings.amount - llmusage.cost = chargings.cost - except Exception as e: - e = Exception(f'{llm.pid} charging error{e}') - exception(f'{e}') - else: - llmusage.amount = 0 - llmusage.cost = 0 - await llm_accounting(request, llmusage) - - except Exception as e: - exception(f'{e=},{format_exc()}') - estr = erase_apikey(e) - recs = sor.R('llmusage', {'id': luid}) - ed = {"error": f"ERROR:{estr}", "status": "FAILED", 'taskid': taskid} - await add_new_llmusage_output(luid, ed) - return -