GETDEL requires Redis 6.2+; server runs 6.0.16, so every finalize_balance
and refund_balance call failed silently ('Unknown Redis command called
from Lua script'). Consequences observed under concurrent load test:
- reserve:* keys leaked until 600s TTL instead of being released at finalize
- balance:{org} never reconciled with actual cost (over-deduction by
max_cost-actual accumulated per call)
- FAILED-request refunds silently lost
GET+DEL inside a Lua script executes atomically (single-threaded),
so the pop semantics are unchanged.
gen() try/except re-raised internal errors from uapi_request → 500 response.
Moved refund_balance to uapi_request's except block where errors are properly
handled (yield error, normal generator exit).
Two getID() calls per request (DSPY + uapi_request) under 200 concurrent
caused nanoid random state corruption → 34% duplicate IDs → IntegrityError.
uuid4 uses OS entropy, independent of nanoid state.
- balance.py: reserve_balance/finalize_balance/refund_balance with Lua
- utils.py: get_model_max_cost from llmusage history, update_model_max_cost
- init.py: register reserve_balance, finalize_balance, refund_balance on env
- chat/completions/index.dspy: reserve before inference, refund on exception
- DB migration: llm.max_cost DECIMAL(10,4) for historical max charge
getWidgetById searches DOWNWARD (children), not upward. For ancestor
sage_main_content, must search from bricks.app global root.
Using clear_widgets()+widgetBuild instead of nonexistent set_url().
Script-based getWidgetById+widgetBuild was async without await,
causing black screen. urlwidget actiontype is Bricks' built-in
navigation mechanism that properly handles async rendering.
All filter buttons now internally navigate via:
bricks.getWidgetById('sage_main_content', bricks.app)
→ clear_widgets() → widgetBuild(urlwidget)
This keeps model_plaza within the app shell instead of standalone page.
When client disconnects mid-stream, Python GC kills the generator with
GeneratorExit (BaseException subclass), which is NOT caught by except Exception.
write_llmusage at line 93 was never reached, causing ~16% usage records lost.
finally block ensures llmusage is written even on GeneratorExit.
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.
DataViewer/PageDataLoader expects {total:N, data:[...]} format.
Bare array causes d.total=undefined → NaN → infinite paging loop.
Also fixes same cate.llms attribute access bug from before.
Tabular handles paging client-side — scroll to bottom auto-loads more.
Record_view renders each model as a card (icon + name + description).
Removed all server-side pagination logic from the template.
- All filter buttons use location.href with fully server-constructed URLs
No more mixing {{active_provider}} (stale server var) with dynamic JS state
- SearchBar, category, provider, pagination all use location.href pattern
- Card uses width:100% (fill DynamicColumn slot) + cheight:14 (fixed height)
- Model plaza root is VBox (not VScrollPanel), scroll delegated to cards area
- All filter buttons now script-update rw.opts.url + rw.show_widget()
instead of urlwidget target navigation (which silently failed)
- Root wrapped in VScrollPanel so scroll position preserved
- Card cwidth 25→22 for better column fit
- Page buttons also use RefreshWidget update pattern
- Handle llm.pricing_display when it's a string (not array)
- Card cwidth 15→25 to fill DynamicColumn properly
- Added page/page_size pagination with prev/next buttons
- page param forwarded through model_plaza→plaza_model_cards
- 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)
-@ is not a valid CSS selector, Bricks parses it as '#@' and fails.
Switched all filter button binds to actiontype:script with window.location.assign().
Replaced nonexistent Input widget with KeyinText for search.
New layout:
- Search bar (top) with fuzzy name/description match
- Category tabs (wrapping, single-select)
- Provider sidebar (left, single-select)
- Card grid (right, sorted by name, refreshed on filter change)
- Both category/provider unselected = all published models
Added get_plaza_models() for flat filtered model listing.
Supports combined filtering: provider + category + search.
get_llmage_llm and get_llms_by_catelog had ORDER BY ending
at a.id — model names within same provider/catalog appeared
in arbitrary order. Added a.name as final sort key.
The ad5d8c0 commit had line number prefixes (1|, 2|, ...) baked into
file content. Also fixed cache call bugs:
- params_kw.model or 'qwen3-max' -> params_kw.model
- 'ktv_pipeline' hardcoded -> catelogid variable
- extra tab before params_kw.llmcatelogid
- missing f-string braces in debug()