diff --git a/llmage/utils.py b/llmage/utils.py index 3439f3b..5f78b37 100644 --- a/llmage/utils.py +++ b/llmage/utils.py @@ -274,11 +274,11 @@ def erase_apikey(e): async def get_llmproviders(): env = ServerEnv() 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 where a.providerid = b.id and a.status = 'published' -group by a.providerid, a.iconid, b.orgname""" +group by a.providerid, b.orgname""" return await sor.sqlExe(sql, {}) return [] diff --git a/wwwroot/model_plaza.ui b/wwwroot/model_plaza.ui index 5dba068..a93ce28 100644 --- a/wwwroot/model_plaza.ui +++ b/wwwroot/model_plaza.ui @@ -16,40 +16,19 @@ "options": {"otext": "模型广场", "i18n": true, "halign": "left"} }, { - "widgettype": "HBox", - "options": {"width": "100%", "cheight": 4, "gap": "6px", "alignItems": "center"}, - "subwidgets": [ - { - "widgettype": "KeyinText", - "id": "plaza_search_input", - "options": { - "cwidth": 40, - "cheight": 3, - "name": "search", - "css": "plaza-search-input" - } - }, - { - "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"} - ] + "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);}" + }] } ] }, @@ -70,8 +49,9 @@ "cwidth": 8, "cheight": 2 }, "binds": [{ - "wid": "self", "event": "click", "actiontype": "script", "target": "self", - "script": "window.location.assign('{{entire_url('model_plaza.ui')}}?providerid={{active_provider}}&search={{active_search}}');" + "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 %} @@ -84,8 +64,9 @@ "cwidth": 10, "cheight": 2 }, "binds": [{ - "wid": "self", "event": "click", "actiontype": "script", "target": "self", - "script": "window.location.assign('{{entire_url('model_plaza.ui')}}?providerid={{active_provider}}&catelogid={{c.id}}&search={{active_search}}');" + "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 %} @@ -122,8 +103,9 @@ "cwidth": 18 }, "binds": [{ - "wid": "self", "event": "click", "actiontype": "script", "target": "self", - "script": "window.location.assign('{{entire_url('model_plaza.ui')}}?catelogid={{active_catelog}}&search={{active_search}}');" + "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 %} @@ -136,8 +118,9 @@ "cwidth": 18 }, "binds": [{ - "wid": "self", "event": "click", "actiontype": "script", "target": "self", - "script": "window.location.assign('{{entire_url('model_plaza.ui')}}?providerid={{p.providerid}}&catelogid={{active_catelog}}&search={{active_search}}');" + "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 %}