llmage/wwwroot/model_plaza.ui
yumoqing 7148656f99 fix: dedupe providers, SearchBar input, urlwidget internal nav
- Removed iconid from get_llmproviders GROUP BY (caused duplicates)
- Replaced KeyinText with SearchBar (built-in input+search+clear)
- Switched navigation from window.location.assign to urlwidget
  targeting sage_main_content (stays in workspace, no full reload)
2026-07-29 13:22:53 +08:00

148 lines
7.4 KiB
XML

{% set active_provider = params_kw.get('providerid', '') %}
{% set active_catelog = params_kw.get('catelogid', '') %}
{% set active_search = params_kw.get('search', '') %}
{% set catelogs = get_llmcatelogs() %}
{% set providers = get_llmproviders() %}
{
"widgettype": "VBox",
"options": {"css": "filler", "width": "100%", "height": "100%", "gap": "8px"},
"subwidgets": [
{
"widgettype": "VBox",
"options": {"css": "plaza-header", "width": "100%"},
"subwidgets": [
{
"widgettype": "Title2",
"options": {"otext": "模型广场", "i18n": true, "halign": "left"}
},
{
"widgettype": "SearchBar",
"id": "plaza_search",
"options": {
"placeholder": "搜索模型名称或描述...",
"value": "{{active_search}}",
"search_label": "搜索",
"clear_label": "清除",
"width": "100%"
},
"binds": [{
"wid": "self", "event": "search", "actiontype": "script", "target": "self",
"script": "var u='{{entire_url('model_plaza.ui')}}?providerid={{active_provider}}&catelogid={{active_catelog}}&search='+encodeURIComponent(event.keyword||'');var t=bricks.getWidgetById('sage_main_content',bricks.app);if(t){t.clear_widgets();bricks.widgetBuild({widgettype:'urlwidget',options:{url:u}},t);}"
}]
}
]
},
{
"widgettype": "VBox",
"options": {"width": "100%"},
"subwidgets": [
{
"widgettype": "HBox",
"options": {"css": "plaza-catelog-bar", "width": "100%", "wrap": true, "gap": "4px", "padding": "4px 0"},
"subwidgets": [
{
"widgettype": "Button",
"id": "cat_all",
"options": {
"label": "全部",
"css": "{{'plaza-cat-btn selected' if not active_catelog else 'plaza-cat-btn'}}",
"cwidth": 8, "cheight": 2
},
"binds": [{
"wid": "self", "event": "click", "actiontype": "urlwidget",
"target": "sage_main_content", "mode": "replace",
"options": {"url": "{{entire_url('model_plaza.ui')}}?providerid={{active_provider}}&search={{active_search}}"}
}]
}
{% for c in catelogs %}
,{
"widgettype": "Button",
"id": "cat_{{c.id}}",
"options": {
"label": "{{c.name}}",
"css": "{{'plaza-cat-btn selected' if active_catelog==c.id else 'plaza-cat-btn'}}",
"cwidth": 10, "cheight": 2
},
"binds": [{
"wid": "self", "event": "click", "actiontype": "urlwidget",
"target": "sage_main_content", "mode": "replace",
"options": {"url": "{{entire_url('model_plaza.ui')}}?providerid={{active_provider}}&catelogid={{c.id}}&search={{active_search}}"}
}]
}
{% endfor %}
]
}
]
},
{
"widgettype": "HBox",
"options": {"width": "100%", "height": "100%", "flex": "1", "gap": "8px"},
"subwidgets": [
{
"widgettype": "VBox",
"options": {"css": "plaza-sidebar", "cwidth": 20},
"subwidgets": [
{
"widgettype": "Title6",
"options": {"otext": "供应商", "i18n": true, "marginBottom": "4px"}
},
{
"widgettype": "VScrollPanel",
"options": {"css": "filler", "flex": "1"},
"subwidgets": [
{
"widgettype": "VBox",
"options": {"gap": "2px"},
"subwidgets": [
{
"widgettype": "Button",
"id": "prov_all",
"options": {
"label": "全部供应商",
"css": "{{'plaza-prov-btn selected' if not active_provider else 'plaza-prov-btn'}}",
"cwidth": 18
},
"binds": [{
"wid": "self", "event": "click", "actiontype": "urlwidget",
"target": "sage_main_content", "mode": "replace",
"options": {"url": "{{entire_url('model_plaza.ui')}}?catelogid={{active_catelog}}&search={{active_search}}"}
}]
}
{% for p in providers %}
,{
"widgettype": "Button",
"id": "prov_{{p.providerid}}",
"options": {
"label": "{{p.orgname}}",
"css": "{{'plaza-prov-btn selected' if active_provider==p.providerid else 'plaza-prov-btn'}}",
"cwidth": 18
},
"binds": [{
"wid": "self", "event": "click", "actiontype": "urlwidget",
"target": "sage_main_content", "mode": "replace",
"options": {"url": "{{entire_url('model_plaza.ui')}}?providerid={{p.providerid}}&catelogid={{active_catelog}}&search={{active_search}}"}
}]
}
{% endfor %}
]
}
]
}
]
},
{
"widgettype": "RefreshWidget",
"id": "plaza_cards",
"options": {
"period_seconds": 0,
"url": "{{entire_url('plaza_model_cards.ui')}}?providerid={{active_provider}}&catelogid={{active_catelog}}&search={{active_search}}",
"css": "filler",
"width": "100%",
"height": "100%"
}
}
]
}
]
}