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)
This commit is contained in:
parent
cb53b9aeeb
commit
7148656f99
@ -274,11 +274,11 @@ def erase_apikey(e):
|
|||||||
async def get_llmproviders():
|
async def get_llmproviders():
|
||||||
env = ServerEnv()
|
env = ServerEnv()
|
||||||
async with get_sor_context(env, 'llmage') as sor:
|
async with get_sor_context(env, 'llmage') as sor:
|
||||||
sql = """select a.providerid, a.iconid, b.orgname
|
sql = """select a.providerid, b.orgname
|
||||||
from llm a, organization b
|
from llm a, organization b
|
||||||
where a.providerid = b.id
|
where a.providerid = b.id
|
||||||
and a.status = 'published'
|
and a.status = 'published'
|
||||||
group by a.providerid, a.iconid, b.orgname"""
|
group by a.providerid, b.orgname"""
|
||||||
return await sor.sqlExe(sql, {})
|
return await sor.sqlExe(sql, {})
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|||||||
@ -16,40 +16,19 @@
|
|||||||
"options": {"otext": "模型广场", "i18n": true, "halign": "left"}
|
"options": {"otext": "模型广场", "i18n": true, "halign": "left"}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"widgettype": "HBox",
|
"widgettype": "SearchBar",
|
||||||
"options": {"width": "100%", "cheight": 4, "gap": "6px", "alignItems": "center"},
|
"id": "plaza_search",
|
||||||
"subwidgets": [
|
"options": {
|
||||||
{
|
"placeholder": "搜索模型名称或描述...",
|
||||||
"widgettype": "KeyinText",
|
"value": "{{active_search}}",
|
||||||
"id": "plaza_search_input",
|
"search_label": "搜索",
|
||||||
"options": {
|
"clear_label": "清除",
|
||||||
"cwidth": 40,
|
"width": "100%"
|
||||||
"cheight": 3,
|
},
|
||||||
"name": "search",
|
"binds": [{
|
||||||
"css": "plaza-search-input"
|
"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": "Button",
|
|
||||||
"id": "btn_search",
|
|
||||||
"options": {"label": "搜索", "css": "plaza-search-btn", "cwidth": 8, "cheight": 3},
|
|
||||||
"binds": [{
|
|
||||||
"wid": "self", "event": "click", "actiontype": "script", "target": "self",
|
|
||||||
"script": "var w=bricks.getWidgetById('plaza_search_input',bricks.app);var q=w?w.text:'';window.location.assign('{{entire_url('model_plaza.ui')}}?providerid={{active_provider}}&catelogid={{active_catelog}}&search='+encodeURIComponent(q));"
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
{% if active_search %}
|
|
||||||
{
|
|
||||||
"widgettype": "Button",
|
|
||||||
"options": {"label": "清除", "css": "plaza-clear-btn", "cwidth": 6, "cheight": 3},
|
|
||||||
"binds": [{
|
|
||||||
"wid": "self", "event": "click", "actiontype": "script", "target": "self",
|
|
||||||
"script": "window.location.assign('{{entire_url('model_plaza.ui')}}?providerid={{active_provider}}&catelogid={{active_catelog}}');"
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
{% endif %}
|
|
||||||
{"widgettype": "Filler"}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -70,8 +49,9 @@
|
|||||||
"cwidth": 8, "cheight": 2
|
"cwidth": 8, "cheight": 2
|
||||||
},
|
},
|
||||||
"binds": [{
|
"binds": [{
|
||||||
"wid": "self", "event": "click", "actiontype": "script", "target": "self",
|
"wid": "self", "event": "click", "actiontype": "urlwidget",
|
||||||
"script": "window.location.assign('{{entire_url('model_plaza.ui')}}?providerid={{active_provider}}&search={{active_search}}');"
|
"target": "sage_main_content", "mode": "replace",
|
||||||
|
"options": {"url": "{{entire_url('model_plaza.ui')}}?providerid={{active_provider}}&search={{active_search}}"}
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
{% for c in catelogs %}
|
{% for c in catelogs %}
|
||||||
@ -84,8 +64,9 @@
|
|||||||
"cwidth": 10, "cheight": 2
|
"cwidth": 10, "cheight": 2
|
||||||
},
|
},
|
||||||
"binds": [{
|
"binds": [{
|
||||||
"wid": "self", "event": "click", "actiontype": "script", "target": "self",
|
"wid": "self", "event": "click", "actiontype": "urlwidget",
|
||||||
"script": "window.location.assign('{{entire_url('model_plaza.ui')}}?providerid={{active_provider}}&catelogid={{c.id}}&search={{active_search}}');"
|
"target": "sage_main_content", "mode": "replace",
|
||||||
|
"options": {"url": "{{entire_url('model_plaza.ui')}}?providerid={{active_provider}}&catelogid={{c.id}}&search={{active_search}}"}
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@ -122,8 +103,9 @@
|
|||||||
"cwidth": 18
|
"cwidth": 18
|
||||||
},
|
},
|
||||||
"binds": [{
|
"binds": [{
|
||||||
"wid": "self", "event": "click", "actiontype": "script", "target": "self",
|
"wid": "self", "event": "click", "actiontype": "urlwidget",
|
||||||
"script": "window.location.assign('{{entire_url('model_plaza.ui')}}?catelogid={{active_catelog}}&search={{active_search}}');"
|
"target": "sage_main_content", "mode": "replace",
|
||||||
|
"options": {"url": "{{entire_url('model_plaza.ui')}}?catelogid={{active_catelog}}&search={{active_search}}"}
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
{% for p in providers %}
|
{% for p in providers %}
|
||||||
@ -136,8 +118,9 @@
|
|||||||
"cwidth": 18
|
"cwidth": 18
|
||||||
},
|
},
|
||||||
"binds": [{
|
"binds": [{
|
||||||
"wid": "self", "event": "click", "actiontype": "script", "target": "self",
|
"wid": "self", "event": "click", "actiontype": "urlwidget",
|
||||||
"script": "window.location.assign('{{entire_url('model_plaza.ui')}}?providerid={{p.providerid}}&catelogid={{active_catelog}}&search={{active_search}}');"
|
"target": "sage_main_content", "mode": "replace",
|
||||||
|
"options": {"url": "{{entire_url('model_plaza.ui')}}?providerid={{p.providerid}}&catelogid={{active_catelog}}&search={{active_search}}"}
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user