From 8ee2eccc5594976b8a7f3edbabcb2215a04f3235 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 12 Jun 2026 11:28:16 +0800 Subject: [PATCH] feat: add pricing display to model cards - utils.py: get_llms_by_catelog now queries all distinct ppids for each model and calls get_pricing_display to get pricing text - show_llms_cards.ui: added Filler with pricing-box CSS to display pricing info - model_plaza.css: added styles for pricing-box and pricing-text (light/dark mode) --- llmage/utils.py | 15 +++++++++++++++ wwwroot/model_plaza.css | 23 +++++++++++++++++++++++ wwwroot/show_llms_cards.ui | 21 ++++++++++++++++++++- 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/llmage/utils.py b/llmage/utils.py index 5a5fb72..946af8f 100644 --- a/llmage/utils.py +++ b/llmage/utils.py @@ -353,6 +353,21 @@ async def get_llms_by_catelog(catelogid=None, orderby='providerid'): cid = '' x = None for r in recs: + # 查询该模型的所有定价信息 + pp_sql = """select distinct m.ppid + from llm_api_map m + where m.llmid = ${llmid}$ and m.ppid is not null""" + pp_recs = await sor.sqlExe(pp_sql, {'llmid': r.id}) + + pricing_list = [] + for pp in pp_recs: + try: + pd = await env.get_pricing_display(pp.ppid) + pricing_list.append(pd.get('display_text', '')) + except: + pass + r.pricing_display = pricing_list + if cid != r.catelog_id: x = { 'catelogid': r.catelog_id, diff --git a/wwwroot/model_plaza.css b/wwwroot/model_plaza.css index 1fd9bf7..2bf7687 100644 --- a/wwwroot/model_plaza.css +++ b/wwwroot/model_plaza.css @@ -103,3 +103,26 @@ line-height: 1.5; opacity: 0.85; } + +/* Pricing display area */ +.pricing-box { + margin-top: 8px; + padding-top: 8px; + border-top: 1px solid var(--sage-border, #e2e8f0); + gap: 6px; +} + +.pricing-text { + font-size: 0.85em; + line-height: 1.4; + opacity: 0.75; + white-space: pre-wrap; +} + +[data-theme="dark"] .pricing-box { + border-top-color: #475569; +} + +[data-theme="dark"] .pricing-text { + color: #94A3B8; +} diff --git a/wwwroot/show_llms_cards.ui b/wwwroot/show_llms_cards.ui index 8bb4a2f..04051ef 100644 --- a/wwwroot/show_llms_cards.ui +++ b/wwwroot/show_llms_cards.ui @@ -26,7 +26,7 @@ "options":{ "css":"card plaza-card", "cwidth":25, - "cheight":12 + "cheight":16 }, "subwidgets":[ { @@ -57,6 +57,25 @@ "wrap":true, "halign":"left" } + }, + { + "widgettype":"Filler", + "options":{ + "css":"pricing-box" + }, + "subwidgets":[ +{% for pricing_text in llm.pricing_display %} + { + "widgettype":"Text", + "options":{ + "text":{{json.dumps(pricing_text, ensure_ascii=False)}}, + "wrap":true, + "halign":"left", + "css":"pricing-text" + } + }{% if not loop.last %},{% endif %} +{% endfor %} + ] } ], "binds":[