fix: search.ui - code→UiCode widgettype + bricks.app.root→this.parent for urlwidget sub-page
This commit is contained in:
parent
7badd6e683
commit
7792aa913e
@ -10,7 +10,7 @@
|
|||||||
"subwidgets": [
|
"subwidgets": [
|
||||||
{"widgettype": "Text", "options": {"text": "知识库:", "cfontsize": 13, "color": "#666"}},
|
{"widgettype": "Text", "options": {"text": "知识库:", "cfontsize": 13, "color": "#666"}},
|
||||||
{
|
{
|
||||||
"widgettype": "code",
|
"widgettype": "UiCode",
|
||||||
"id": "kb_selector",
|
"id": "kb_selector",
|
||||||
"options": {"name": "kb_id", "dataurl": "{{entire_url('./kb_options.dspy')}}", "text": "全部", "cwidth": 18}
|
"options": {"name": "kb_id", "dataurl": "{{entire_url('./kb_options.dspy')}}", "text": "全部", "cwidth": 18}
|
||||||
},
|
},
|
||||||
@ -47,7 +47,7 @@
|
|||||||
"event": "changed",
|
"event": "changed",
|
||||||
"actiontype": "script",
|
"actiontype": "script",
|
||||||
"target": "search_file",
|
"target": "search_file",
|
||||||
"script": "var f=this.value;if(!f)return;if(Array.isArray(f))f=f[0];if(!f)return;var kb=bricks.getWidgetById('kb_selector',bricks.app.root);var kb_id=kb?kb.getValue()||'':'all';var fd=new FormData();fd.append('file',f);var u='/rag/knowledge_bases_list/search_result.dspy?_webbricks_=1&kb_id='+encodeURIComponent(kb_id)+'&file_name='+encodeURIComponent(f.name);fetch(u,{method:'POST',body:fd}).then(function(r){return r.json()}).then(function(d){var fp=bricks.getWidgetById('search_results',bricks.app.root);if(fp){fp.clear_widgets();bricks.widgetBuild(d,fp).then(function(w){if(w)fp.add_widget(w)})}})"
|
"script": "var f=this.value;if(!f)return;if(Array.isArray(f))f=f[0];if(!f)return;var kb=bricks.getWidgetById('kb_selector',this.parent);var kb_id=kb?kb.getValue()||'':'all';var fd=new FormData();fd.append('file',f);var u='/rag/knowledge_bases_list/search_result.dspy?_webbricks_=1&kb_id='+encodeURIComponent(kb_id)+'&file_name='+encodeURIComponent(f.name);var pv=this.parent.parent;fetch(u,{method:'POST',body:fd}).then(function(r){return r.json()}).then(function(d){var fp=bricks.getWidgetById('search_results',pv);if(fp){fp.clear_widgets();bricks.widgetBuild(d,fp).then(function(w){if(w)fp.add_widget(w)})}})"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user