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",
"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"}
}
]
}