ns = params_kw.copy() kb_id = ns.get('kb_id', '') import json body = json.dumps({ "widgettype": "VBox", "options": {"spacing": "16px", "padding": "0"}, "subwidgets": [ {"widgettype": "Text", "options": {"text": "📤 上传文件", "cfontsize": 18, "fontWeight": "bold", "color": "#333"}}, {"widgettype": "Text", "options": {"text": "知识库: " + kb_id, "cfontsize": 12, "color": "#888"}}, { "widgettype": "VBox", "options": {"id": "upload_zone", "width": "100%", "cheight": 10, "bgcolor": "#f8f9fa", "padding": "24px", "css": "card", "border": "2px dashed #3b82f6", "alignItems": "center", "justifyContent": "center"}, "subwidgets": [ {"widgettype": "Text", "options": {"text": "📂", "cfontsize": 40}}, {"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": "12px"}, "binds": [{ "wid": "self", "event": "click", "actiontype": "script", "script": "var i=document.createElement('input');i.type='file';i.onchange=function(){for(var j=0;j