revert: back to server-side Jinja2 rendering, Tabular AJAX had 401 session issues

Tabular widget makes client-side HTTP calls to data_url DSPY which
fail with 401 because session cookie not passed in AJAX requests.
Server-side Jinja2 loop avoids this entirely — all model data rendered
in initial page load.
This commit is contained in:
yumoqing 2026-07-29 16:04:07 +08:00
parent 15b4ad38fb
commit 7aa1efc6d8

View File

@ -1,25 +1,33 @@
{% set providerid = params_kw.get('providerid', '') %} {% set providerid = params_kw.get('providerid', '') %}
{% set catelogid = params_kw.get('catelogid', '') %} {% set catelogid = params_kw.get('catelogid', '') %}
{% set search = params_kw.get('search', '') %} {% set search = params_kw.get('search', '') %}
{% set all_data = get_plaza_models(providerid, catelogid, search) %}
{% set ns = namespace(first=true) %}
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": {"css": "filler", "width": "100%", "height": "100%"}, "options": {"css": "filler", "width": "100%", "height": "100%"},
"subwidgets": [ "subwidgets": [
{ {
"widgettype": "Tabular", "widgettype": "VScrollPanel",
"options": {"css": "filler", "flex": "1", "width": "100%"},
"subwidgets": [
{
"widgettype": "DynamicColumn",
"options": { "options": {
"css": "filler", "css": "plaza-grid",
"width": "100%", "width": "100%",
"height": "100%", "col_cwidth": 22,
"data_url": "{{entire_url('api/get_plaza_models.dspy')}}?providerid={{providerid}}&catelogid={{catelogid}}&search={{search}}", "col_cgap": 1
"pagerows": 20, },
"record_view": { "subwidgets": [
{% for llm in all_data %}
{% if not ns.first %},{% endif %}
{
"widgettype": "VBox", "widgettype": "VBox",
"options": { "options": {
"css": "card plaza-card", "css": "card plaza-card",
"width": "100%", "width": "100%",
"cheight": 10, "cheight": 14
"marginBottom": "8px"
}, },
"subwidgets": [ "subwidgets": [
{ {
@ -28,23 +36,53 @@
"subwidgets": [ "subwidgets": [
{ {
"widgettype": "Svg", "widgettype": "Svg",
"options": {"rate": 1.5, "url": "{{entire_url('/appbase/show_icon.dspy')}}?id=${iconid}"} "options": {"rate": 1.5, "url": "{{entire_url('/appbase/show_icon.dspy')}}?id={{llm.iconid}}"}
}, },
{ {
"widgettype": "Title6", "widgettype": "Title6",
"options": {"text": "${name}"} "options": {"text": "{{llm.name}}"}
} }
] ]
}, },
{
"widgettype": "VScrollPanel",
"options": {"css": "filler", "flex": "1"},
"subwidgets": [
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"height": "auto", "height": "auto",
"text": "${description}", "text": {{json.dumps(llm.description, ensure_ascii=False)}},
"wrap": true, "wrap": true,
"halign": "left" "halign": "left"
} }
} }
{% if llm.pricing_display %}
{% if llm.pricing_display is string %}
{% set pricing_items = [llm.pricing_display] %}
{% else %}
{% set pricing_items = llm.pricing_display %}
{% endif %}
,{
"widgettype": "VBox",
"options": {"css": "filler"},
"subwidgets": [
{% for pt in pricing_items %}
{
"widgettype": "Text",
"options": {
"text": {{json.dumps(pt, ensure_ascii=False)}},
"wrap": true,
"halign": "left",
"css": "pricing-text"
}
}{% if not loop.last %},{% endif %}
{% endfor %}
]
}
{% endif %}
]
}
], ],
"binds": [ "binds": [
{ {
@ -53,7 +91,7 @@
"actiontype": "urlwidget", "actiontype": "urlwidget",
"target": "PopupWindow", "target": "PopupWindow",
"popup_options": { "popup_options": {
"title": "${name}", "title": "{{llm.name}}",
{% if int(params_kw._is_mobile or 0) %} {% if int(params_kw._is_mobile or 0) %}
"width": "100%", "width": "100%",
"height": "100%" "height": "100%"
@ -63,13 +101,17 @@
{% endif %} {% endif %}
}, },
"options": { "options": {
"params": {"id": "${id}"}, "params": {"id": "{{llm.id}}"},
"url": "{{entire_url('./llm_dialog.ui')}}" "url": "{{entire_url('./llm_dialog.ui')}}"
} }
} }
] ]
} }
} {% set ns.first = false %}
{% endfor %}
]
}
]
} }
] ]
} }