This commit is contained in:
yumoqing 2026-07-15 13:46:56 +08:00
parent 66db401fcb
commit b2bca68160

View File

@ -1529,7 +1529,9 @@ WHERE resource_ref_id = ${llm_id}$ AND product_type = 'llm_model' LIMIT 1"""
await consume_accounting(sor, orderid, accounting_items) await consume_accounting(sor, orderid, accounting_items)
# Mark llmusage as accounted # Mark llmusage as accounted
async with db.sqlorContext('llmage') as sor: from ahserver.serverenv import ServerEnv
lmage_dbname = ServerEnv().get_module_dbname('llmage')
async with db.sqlorContext(lmage_dbname) as sor:
await sor.U('llmusage', { await sor.U('llmusage', {
'id': llmusage.id, 'id': llmusage.id,
'accounting_status': 'accounted' 'accounting_status': 'accounted'
@ -1565,7 +1567,9 @@ WHERE resource_ref_id = ${llm_id}$ AND product_type = 'llm_model' LIMIT 1"""
await self.product_accounting(lu) await self.product_accounting(lu)
# Clean up failed records # Clean up failed records
try: try:
async with DBPools().sqlorContext('llmage') as sor: from ahserver.serverenv import ServerEnv
lmage_dbname = ServerEnv().get_module_dbname('llmage')
async with DBPools().sqlorContext(lmage_dbname) as sor:
await sor.execute( await sor.execute(
"DELETE FROM llmusage_accounting_failed WHERE llmusageid=${luid}$", "DELETE FROM llmusage_accounting_failed WHERE llmusageid=${luid}$",
{'luid': lu.id}) {'luid': lu.id})