llmage/wwwroot/api/llmusage_create.dspy

16 lines
616 B
Python

#!/usr/bin/env python3
result = {"widgettype":"Error","options":{"title":"操作失败","message":"Invalid request","cwidth":16,"cheight":9,"timeout":3}}
try:
dbname = get_module_dbname('llmage')
async with DBPools().sqlorContext(dbname) as sor:
data = params_kw
data['id'] = getID()
await sor.C('llmusage', data)
result = {"widgettype":"Message","options":{"title":"创建成功","message":"ok","cwidth":16,"cheight":9,"timeout":3}}
except Exception as e:
result["options"] = {"title":"操作失败","message":str(e),"cwidth":16,"cheight":9,"timeout":3}
return result