feat: Droppable widget for drag-and-drop upload

This commit is contained in:
yumoqing 2026-07-23 17:50:18 +08:00
parent bbdafd5d99
commit c30e9bf09e

View File

@ -53,27 +53,36 @@
}, },
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": {"id": "detail_content", "css": "filler", "padding": "16px", "spacing": "12px"}, "options": {"id": "detail_content", "css": "filler", "padding": "0", "spacing": 0},
"subwidgets": [ "subwidgets": [
{"widgettype": "Text", "options": {"text": "📂 请选择左侧目录查看文件", "cfontsize": 14, "color": "#888"}},
{ {
"widgettype": "Button", "widgettype": "Droppable",
"options": { "options": {
"label": "📤 上传文件", "width": "100%",
"bgcolor": "#3b82f6", "cheight": 6,
"color": "#fff", "bgcolor": "#f8f9fa",
"padding": "10px 24px", "border": "2px dashed #3b82f6",
"marginTop": "16px", "alignItems": "center",
"cfontsize": 14 "justifyContent": "center"
}, },
"binds": [{ "subwidgets": [
"wid": "self", {"widgettype": "Text", "options": {"text": "📂 拖拽文件到此处自动上传", "cfontsize": 15, "color": "#888"}},
"event": "click", {"widgettype": "Text", "options": {"text": "支持 TXT/PDF/JPG/PNG/MP3/WAV/MP4", "cfontsize": 12, "color": "#aaa"}}
"actiontype": "urlwidget", ],
"target": "app.rag_main_content", "binds": [
"mode": "replace", {
"options": {"url": "{{entire_url('./upload.dspy')}}?kb_id=kb1"} "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"}
} }
] ]
} }