From ac75d75ec45d469c68a16ccc2825827af5d156fe Mon Sep 17 00:00:00 2001 From: Hermes Date: Tue, 28 Jul 2026 15:07:07 +0800 Subject: [PATCH] fix: detail.ui restore tree + file_list.dspy with node_selected bind --- wwwroot/knowledge_bases_list/detail.ui | 299 +++++++------------------ 1 file changed, 78 insertions(+), 221 deletions(-) diff --git a/wwwroot/knowledge_bases_list/detail.ui b/wwwroot/knowledge_bases_list/detail.ui index 4f90d99..64f2904 100644 --- a/wwwroot/knowledge_bases_list/detail.ui +++ b/wwwroot/knowledge_bases_list/detail.ui @@ -1,226 +1,83 @@ { - "widgettype": "VBox", - "options": { - "cheight": 40, - "width": "100%", - "padding": "0", - "spacing": 0 - }, - "subwidgets": [ - { - "widgettype": "HBox", - "options": { - "width": "100%", - "bgcolor": "#f8f9fa", - "padding": "10px 16px", - "alignItems": "center", - "borderBottom": "1px solid #e0e0e0" - }, - "subwidgets": [ + "widgettype": "VBox", + "options": {"cheight": 40, "width": "100%", "padding": "0", "spacing": 0}, + "subwidgets": [ { - "widgettype": "Text", - "options": { - "text": "← 知识库列表", - "css": "clickable", - "cfontsize": 14, - "color": "#4a90d9" - }, - "binds": [ - { - "wid": "self", - "event": "click", - "actiontype": "urlwidget", - "target": "app.rag_main_content", - "mode": "replace", - "options": { - "url": "{{entire_url('/rag/knowledge_bases_list/index.ui')}}" - } - } - ] + "widgettype": "HBox", + "options": {"width": "100%", "bgcolor": "#f8f9fa", "padding": "10px 16px", "alignItems": "center", "borderBottom": "1px solid #e0e0e0"}, + "subwidgets": [ + {"widgettype": "Text", "options": {"text": "← 知识库列表", "css": "clickable", "cfontsize": 14, "color": "#4a90d9"}, "binds": [ + {"wid": "self", "event": "click", "actiontype": "urlwidget", "target": "app.rag_main_content", "mode": "replace", + "options": {"url": "{{entire_url('/rag/knowledge_bases_list/index.ui')}}"}} + ]}, + {"widgettype": "Text", "options": {"text": " / ", "cfontsize": 14, "color": "#ccc"}}, + {"widgettype": "Text", "options": {"text": "📚 {{params_kw.kb_name or '知识库'}}", "cfontsize": 16, "fontWeight": "bold", "color": "#333"}}, + {"widgettype": "Text", "options": {"text": "", "css": "filler"}} + ] }, { - "widgettype": "Text", - "options": { - "text": " / ", - "cfontsize": 14, - "color": "#ccc" - } - }, - { - "widgettype": "Text", - "options": { - "text": "📚 {{params_kw.kb_name or '知识库'}}", - "cfontsize": 16, - "fontWeight": "bold", - "color": "#333" - } - }, - { - "widgettype": "Text", - "options": { - "text": "", - "css": "filler" - } + "widgettype": "HBox", + "options": {"css": "filler", "width": "100%", "spacing": 0}, + "subwidgets": [ + { + "widgettype": "VBox", + "options": {"cwidth": 16, "bgcolor": "#fafafa", "borderRight": "1px solid #e0e0e0", "spacing": 0}, + "subwidgets": [ + { + "widgettype": "HBox", + "options": {"padding": "10px 12px", "bgcolor": "#f0f0f0", "borderBottom": "1px solid #e0e0e0"}, + "subwidgets": [ + {"widgettype": "Text", "options": {"text": "📁 目录结构", "cfontsize": 13, "fontWeight": "bold", "color": "#666"}} + ] + }, + { + "widgettype": "Tree", + "options": { + "id": "dir_tree", + "parentField": "parentid", + "idField": "id", + "textField": "label", + "dataurl": "{{entire_url('./get_tree_data.dspy')}}?kb_id={{params_kw.kb_id}}", + "newdata_params": {"kb_id": "{{params_kw.kb_id}}"}, + "editable": { + "fields": [ + {"name": "name", "title": "名称", "type": "str", "length": 255, "uitype": "str", "label": "名称"} + ], + "add_url": "{{entire_url('./new_tree_item.dspy')}}", + "update_url": "{{entire_url('./update_tree_item.dspy')}}", + "delete_url": "{{entire_url('./delete_tree_item.dspy')}}" + } + } + } + ] + }, + { + "widgettype": "VBox", + "id": "detail_content", + "options": {"css": "filler", "padding": "16px", "spacing": "0"}, + "subwidgets": [ + { + "widgettype": "urlwidget", + "id": "file_list_panel", + "options": { + "url": "{{entire_url('./file_list.dspy')}}?kb_id={{params_kw.kb_id}}&id=__root__" + } + } + ], + "binds": [ + { + "wid": "dir_tree", + "event": "node_selected", + "actiontype": "urlwidget", + "target": "file_list_panel", + "mode": "replace", + "options": { + "url": "{{entire_url('./file_list.dspy')}}?kb_id={{params_kw.kb_id}}" + } + } + ] + } + ] } - ] - }, - { - "widgettype": "HBox", - "options": { - "css": "filler", - "width": "100%", - "spacing": 0 - }, - "subwidgets": [ - { - "widgettype": "VBox", - "options": { - "cwidth": 16, - "bgcolor": "#fafafa", - "borderRight": "1px solid #e0e0e0", - "spacing": 0, - "overflow": "hidden", - "flexShrink": "0" - }, - "subwidgets": [ - { - "widgettype": "HBox", - "options": { - "padding": "10px 12px", - "bgcolor": "#f0f0f0", - "borderBottom": "1px solid #e0e0e0" - }, - "subwidgets": [ - { - "widgettype": "Text", - "options": { - "text": "📁 目录结构", - "cfontsize": 13, - "fontWeight": "bold", - "color": "#666" - } - } - ] - }, - { - "widgettype": "Tree", - "options": { - "title": "目录", - "id": "dir_tree", - "parentField": "parentid", - "idField": "id", - "textField": "label", - "dataurl": "{{entire_url('./get_tree_data.dspy')}}?kb_id={{params_kw.kb_id}}", - "newdata_params": { - "kb_id": "{{params_kw.kb_id}}" - }, - "editable": { - "fields": [ - { - "name": "name", - "title": "名称", - "type": "str", - "length": 255, - "uitype": "str", - "label": "名称" - } - ], - "add_url": "{{entire_url('./new_tree_item.dspy')}}", - "update_url": "{{entire_url('./update_tree_item.dspy')}}", - "delete_url": "{{entire_url('./delete_tree_item.dspy')}}" - } - }, - "binds": [ - { - "wid": "self", - "event": "selected", - "actiontype": "script", - "script": "window._rag_current_folder = event.params.id ? event.params.id : ''" - } - ] - } - ] - }, - { - "widgettype": "VBox", - "options": { - "id": "detail_content", - "css": "filler", - "padding": "16px", - "spacing": "12px" - }, - "subwidgets": [ - { - "widgettype": "VBox", - "options": { - "id": "drop_zone", - "width": "100%", - "cheight": 8, - "bgcolor": "#f8f9fa", - "padding": "16px", - "css": "card", - "border": "2px dashed #3b82f6", - "alignItems": "center", - "justifyContent": "center" - }, - "subwidgets": [ - { - "widgettype": "Text", - "options": { - "text": "📂 点击选择文件上传", - "cfontsize": 15, - "color": "#888" - } - }, - { - "widgettype": "Text", - "options": { - "text": "支持 TXT/PDF/JPG/PNG/MP3/WAV/MP4", - "cfontsize": 12, - "color": "#aaa" - } - }, - { - "widgettype": "Button", - "options": { - "label": "选择文件", - "bgcolor": "#3b82f6", - "color": "#fff", - "marginTop": "8px" - }, - "binds": [ - { - "wid": "self", - "event": "click", - "actiontype": "script", - "script": "var i=document.createElement('input');i.type='file';i.multiple=true;i.onchange=function(){var u=new URL(window.location.href);var kb=u.searchParams.get('kb_id')||'';var fd=window._rag_current_folder||'';for(var j=0;j