llmage: 记账失败记录-原因改为toolbar按钮弹窗显示
This commit is contained in:
parent
1aa28430e0
commit
88d2fd2c86
@ -3,8 +3,34 @@
|
|||||||
"title": "记账失败记录",
|
"title": "记账失败记录",
|
||||||
"params": {
|
"params": {
|
||||||
"sortby": "failed_time desc",
|
"sortby": "failed_time desc",
|
||||||
|
"toolbar": {
|
||||||
|
"tools": [
|
||||||
|
{
|
||||||
|
"name": "show_reason",
|
||||||
|
"label": "原因",
|
||||||
|
"selected_row": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"binds": [
|
||||||
|
{
|
||||||
|
"wid": "self",
|
||||||
|
"event": "show_reason",
|
||||||
|
"actiontype": "urlwidget",
|
||||||
|
"target": "PopupWindow",
|
||||||
|
"popup_options": {
|
||||||
|
"title": "失败原因",
|
||||||
|
"cwidth": 30,
|
||||||
|
"cheight": 20
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"url": "{{entire_url('../api/show_failed_reason.dspy')}}",
|
||||||
|
"params": {"id": "${id}$"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
"browserfields": {
|
"browserfields": {
|
||||||
"exclouded": ["id"],
|
"exclouded": ["id", "failed_reason"],
|
||||||
"alters": {}
|
"alters": {}
|
||||||
},
|
},
|
||||||
"editexclouded": ["id", "llmusageid", "failed_time"],
|
"editexclouded": ["id", "llmusageid", "failed_time"],
|
||||||
|
|||||||
28
wwwroot/api/show_failed_reason.dspy
Normal file
28
wwwroot/api/show_failed_reason.dspy
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
record_id = params_kw.get('id', '')
|
||||||
|
|
||||||
|
reason = '未找到记录'
|
||||||
|
if record_id:
|
||||||
|
dbname = get_module_dbname('llmage')
|
||||||
|
async with DBPools().sqlorContext(dbname) as sor:
|
||||||
|
rows = await sor.R('llmusage_accounting_failed', {'id': record_id})
|
||||||
|
if rows:
|
||||||
|
reason = rows[0].get('failed_reason', '') or '(空)'
|
||||||
|
|
||||||
|
return {
|
||||||
|
"widgettype": "VScrollPanel",
|
||||||
|
"options": {
|
||||||
|
"width": "100%",
|
||||||
|
"height": "100%",
|
||||||
|
"css": "card",
|
||||||
|
"padding": "12px"
|
||||||
|
},
|
||||||
|
"subwidgets": [
|
||||||
|
{
|
||||||
|
"widgettype": "Text",
|
||||||
|
"options": {
|
||||||
|
"text": reason,
|
||||||
|
"i18n": False
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user