fix: popup auto_close=false, submit→refresh KB list

This commit is contained in:
yumoqing 2026-07-23 13:51:52 +08:00
parent d4d1933c7b
commit 7711d6ce82
4 changed files with 51 additions and 2 deletions

View File

@ -12,5 +12,8 @@ async with db.sqlorContext(dbname) as sor:
"INSERT INTO knowledge_bases (id, name, description, org_id, embedding_engine, vdb_collection, doc_count, total_size, chunk_count, status, created_at) "
"VALUES (${id}$, ${name}$, ${desc}$, ${org_id}$, 'CLIP ViT-H-14', 'rag_collection', 0, 0, 0, 'active', NOW())",
{"id": kb_id, "name": name, "desc": desc, "org_id": userorgid})
return {"status": "SUCCEEDED", "kb_id": kb_id}
return {
"widgettype": "urlwidget",
"options": {"url": entire_url('/knowledge_bases_list/index.ui')}
}
return {"error": "failed"}

View File

@ -15,6 +15,7 @@
{"widgettype": "Button", "options": {"label": "+ 新建知识库", "bgcolor": "#4a90d9", "color": "#fff"}, "binds": [
{"wid": "self", "event": "click", "actiontype": "urlwidget",
"target": "Popup",
"popup_options": {"auto_close": false},
"options": {"url": "{{entire_url('/knowledge_bases_list/new_kb_form.ui')}}"}}
]}
]

View File

@ -20,7 +20,8 @@
"wid": "kb_form",
"event": "submit",
"actiontype": "urlwidget",
"target": "self",
"target": "app.rag_main_content",
"mode": "replace",
"options": {
"url": "{{entire_url('./create_kb.dspy')}}"
}

View File

@ -0,0 +1,44 @@
ns = params_kw.copy()
kb_id = ns.get('kb_id', '')
result = {
"widgettype": "VBox",
"options": {"width": "100%", "padding": "0", "spacing": "16px"},
"subwidgets": [
{"widgettype": "Text", "options": {"text": "📤 上传文件", "cfontsize": 20, "fontWeight": "bold", "color": "#333"}},
{
"widgettype": "VBox",
"options": {
"id": "drop_zone",
"width": "100%",
"cheight": 12,
"bgcolor": "#f8f9fa",
"padding": "32px",
"css": "card",
"border": "2px dashed #3b82f6",
"alignItems": "center",
"justifyContent": "center"
},
"subwidgets": [
{"widgettype": "Text", "options": {"text": "📂", "cfontsize": 40}},
{"widgettype": "Text", "options": {"text": "点击或拖拽文件到此处上传", "cfontsize": 16, "color": "#555"}},
{"widgettype": "Text", "options": {"text": "支持: TXT, PDF, JPG, PNG, MP3, WAV, MP4, AVI", "cfontsize": 12, "color": "#999"}},
{"widgettype": "Text", "options": {"text": "单个文件最大 500MB · 自动向量化入库", "cfontsize": 12, "color": "#999"}}
]
},
{
"widgettype": "VBox",
"options": {
"id": "upload_status",
"width": "100%",
"padding": "12px",
"bgcolor": "#f0fdf4",
"border": "1px solid #86efac"
},
"subwidgets": [
{"widgettype": "Text", "options": {"text": "⏳ 等待上传...", "cfontsize": 13, "color": "#666", "id": "status_text"}}
]
}
]
}
result