llmage: hide usages/ioinfo columns, add toolbar buttons with popup windows

This commit is contained in:
yumoqing 2026-06-26 11:30:05 +08:00
parent dcb0cd5cba
commit c2c0f93001
4 changed files with 121 additions and 3 deletions

View File

@ -3,13 +3,59 @@
"title": "模型使用",
"params": {
"sortby": "use_time desc",
"toolbar": {
"tools": [
{
"name": "show_usages",
"label": "使用信息",
"selected_row": true,
"icon": "{{entire_url('/bricks/imgs/database.svg')}}"
},
{
"name": "show_ioinfo",
"label": "交互内容",
"selected_row": true,
"icon": "{{entire_url('/bricks/imgs/chat-user.svg')}}"
}
]
},
"binds": [
{
"wid": "self",
"event": "show_usages",
"actiontype": "urlwidget",
"target": "PopupWindow",
"popup_options": {
"title": "使用信息",
"width": "70%",
"height": "70%"
},
"options": {
"url": "{{entire_url('../llmusage_usages_display.ui')}}?id=${id}$"
}
},
{
"wid": "self",
"event": "show_ioinfo",
"actiontype": "urlwidget",
"target": "PopupWindow",
"popup_options": {
"title": "交互内容",
"width": "70%",
"height": "70%"
},
"options": {
"url": "{{entire_url('../llmusage_ioinfo_display.ui')}}?id=${id}$"
}
}
],
"browserfields": {
"exclouded": ["id"],
"exclouded": ["id", "usages", "ioinfo"],
"alters": {}
},
"editexclouded": ["id"],
"editexclouded": ["id", "usages", "ioinfo"],
"editable": {
"get_data_url": "{{entire_url(get_llmusage.dspy')}}?pagerows=50",
"get_data_url": "{{entire_url('get_llmusage.dspy')}}?pagerows=50",
"new_data_url": "{{entire_url('../api/llmusage_create.dspy')}}",
"update_data_url": "{{entire_url('../api/llmusage_update.dspy')}}",
"delete_data_url": "{{entire_url('../api/llmusage_delete.dspy')}}"

View File

@ -155,6 +155,8 @@ PATHS_LOGINED = [
f"/{MOD}/llmusage/delete_llmusage.dspy",
f"/{MOD}/llmusage/get_llmusage.dspy",
f"/{MOD}/llmusage/update_llmusage.dspy",
f"/{MOD}/llmusage_usages_display.ui",
f"/{MOD}/llmusage_ioinfo_display.ui",
# CRUD 子目录 — llmusage_accounting_failed/
f"/{MOD}/llmusage_accounting_failed/index.ui",

View File

@ -0,0 +1,35 @@
{% set sor = db.sqlorContext() %}
{% set row = sor.execute_sql('select llmid, ioinfo from llmusage where id = ${id}$').first() %}
{% set ioinfo = row.ioinfo if row and row.ioinfo else '' %}
{% set model_id = row.llmid if row else '' %}
{
"widgettype": "VScrollPanel",
"options": {
"width": "100%",
"height": "100%"
},
"subwidgets": [
{
"widgettype": "VBox",
"options": {
"width": "100%",
"padding": "16px",
"spacing": 12
},
"subwidgets": [
{
"widgettype": "Title4",
"options": {
"text": "Model: {{ model_id }}"
}
},
{
"widgettype": "Text",
"options": {
"text": {{ ioinfo | tojson }}
}
}
]
}
]
}

View File

@ -0,0 +1,35 @@
{% set sor = db.sqlorContext() %}
{% set row = sor.execute_sql('select llmid, usages from llmusage where id = ${id}$').first() %}
{% set usages = row.usages if row and row.usages else '' %}
{% set model_id = row.llmid if row else '' %}
{
"widgettype": "VScrollPanel",
"options": {
"width": "100%",
"height": "100%"
},
"subwidgets": [
{
"widgettype": "VBox",
"options": {
"width": "100%",
"padding": "16px",
"spacing": 12
},
"subwidgets": [
{
"widgettype": "Title4",
"options": {
"text": "Model: {{ model_id }}"
}
},
{
"widgettype": "Text",
"options": {
"text": {{ usages | tojson }}
}
}
]
}
]
}