From c30e9bf09e2e6eeff98b05e6f9441882b7af288f Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 23 Jul 2026 17:50:18 +0800 Subject: [PATCH] feat: Droppable widget for drag-and-drop upload --- wwwroot/knowledge_bases_list/detail.ui | 43 ++++++++++++++++---------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/wwwroot/knowledge_bases_list/detail.ui b/wwwroot/knowledge_bases_list/detail.ui index acef569..68a3c51 100644 --- a/wwwroot/knowledge_bases_list/detail.ui +++ b/wwwroot/knowledge_bases_list/detail.ui @@ -53,27 +53,36 @@ }, { "widgettype": "VBox", - "options": {"id": "detail_content", "css": "filler", "padding": "16px", "spacing": "12px"}, + "options": {"id": "detail_content", "css": "filler", "padding": "0", "spacing": 0}, "subwidgets": [ - {"widgettype": "Text", "options": {"text": "📂 请选择左侧目录查看文件", "cfontsize": 14, "color": "#888"}}, { - "widgettype": "Button", + "widgettype": "Droppable", "options": { - "label": "📤 上传文件", - "bgcolor": "#3b82f6", - "color": "#fff", - "padding": "10px 24px", - "marginTop": "16px", - "cfontsize": 14 + "width": "100%", + "cheight": 6, + "bgcolor": "#f8f9fa", + "border": "2px dashed #3b82f6", + "alignItems": "center", + "justifyContent": "center" }, - "binds": [{ - "wid": "self", - "event": "click", - "actiontype": "urlwidget", - "target": "app.rag_main_content", - "mode": "replace", - "options": {"url": "{{entire_url('./upload.dspy')}}?kb_id=kb1"} - }] + "subwidgets": [ + {"widgettype": "Text", "options": {"text": "📂 拖拽文件到此处自动上传", "cfontsize": 15, "color": "#888"}}, + {"widgettype": "Text", "options": {"text": "支持 TXT/PDF/JPG/PNG/MP3/WAV/MP4", "cfontsize": 12, "color": "#aaa"}} + ], + "binds": [ + { + "wid": "self", + "event": "drop", + "actiontype": "urlwidget", + "target": "app.rag_main_content", + "mode": "replace", + "options": {"url": "{{entire_url('./upload.dspy')}}", "params": {"kb_id": "{{params_kw.kb_id}}"}} + } + ] + }, + { + "widgettype": "Text", + "options": {"text": "暂无文件,拖拽文件到上方区域上传", "cfontsize": 13, "color": "#aaa", "padding": "16px", "halign": "center"} } ] }