From c2c0f93001bd47fcffb68e86a3ab64a0ba1dcac2 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 26 Jun 2026 11:30:05 +0800 Subject: [PATCH] llmage: hide usages/ioinfo columns, add toolbar buttons with popup windows --- json/llmusage.json | 52 ++++++++++++++++++++++++++++-- scripts/load_path.py | 2 ++ wwwroot/llmusage_ioinfo_display.ui | 35 ++++++++++++++++++++ wwwroot/llmusage_usages_display.ui | 35 ++++++++++++++++++++ 4 files changed, 121 insertions(+), 3 deletions(-) create mode 100644 wwwroot/llmusage_ioinfo_display.ui create mode 100644 wwwroot/llmusage_usages_display.ui diff --git a/json/llmusage.json b/json/llmusage.json index b263aa8..8e409d0 100644 --- a/json/llmusage.json +++ b/json/llmusage.json @@ -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')}}" diff --git a/scripts/load_path.py b/scripts/load_path.py index a9a7f66..d8aa50e 100644 --- a/scripts/load_path.py +++ b/scripts/load_path.py @@ -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", diff --git a/wwwroot/llmusage_ioinfo_display.ui b/wwwroot/llmusage_ioinfo_display.ui new file mode 100644 index 0000000..25ec9b3 --- /dev/null +++ b/wwwroot/llmusage_ioinfo_display.ui @@ -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 }} + } + } + ] + } + ] +} diff --git a/wwwroot/llmusage_usages_display.ui b/wwwroot/llmusage_usages_display.ui new file mode 100644 index 0000000..ee7a112 --- /dev/null +++ b/wwwroot/llmusage_usages_display.ui @@ -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 }} + } + } + ] + } + ] +}