diff --git a/rag/__pycache__/init.cpython-310.pyc b/rag/__pycache__/init.cpython-310.pyc index f655d8a..f8b6738 100644 Binary files a/rag/__pycache__/init.cpython-310.pyc and b/rag/__pycache__/init.cpython-310.pyc differ diff --git a/wwwroot/knowledge_bases_list/detail.ui b/wwwroot/knowledge_bases_list/detail.ui index d938087..4f90d99 100644 --- a/wwwroot/knowledge_bases_list/detail.ui +++ b/wwwroot/knowledge_bases_list/detail.ui @@ -1,92 +1,226 @@ { - "widgettype": "VBox", - "options": {"cheight": 40, "width": "100%", "padding": "0", "spacing": 0}, - "subwidgets": [ + "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": "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": "← 知识库列表", + "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": {"css": "filler", "width": "100%", "spacing": 0}, - "subwidgets": [ + "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, + "overflow": "hidden", + "flexShrink": "0" + }, + "subwidgets": [ + { + "widgettype": "HBox", + "options": { + "padding": "10px 12px", + "bgcolor": "#f0f0f0", + "borderBottom": "1px solid #e0e0e0" + }, + "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": { - "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": "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": "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