yumoqing 4d8e93dc87 完整修复币种逻辑:
- dm_model_call_fact 增加 amount_cny 字段(CNY折算金额)
- ETL sync_call_fact 同步时计算并写入 amount_cny
- dm_model_perf_daily/dm_provider_cost_daily 唯一键加入 currency(按币种分组)
- ETL 聚合函数按 currency 分组,保留原币种维度
- Dashboard 查询统一使用 amount_cny 进行跨币种比较
- 汇率查询从 accounting 模块获取(修正库名)
- 新增币种分布统计接口和UI展示
2026-07-20 15:44:36 +08:00

202 lines
13 KiB
XML

{% set roles = get_user_roles(get_user()) %}
{
"widgettype": "VBox",
"id": "datamart_root",
"options": {"width": "100%", "height": "100%", "bgcolor": "var(--sage-bg-primary, transparent)"},
"subwidgets": [
{
"widgettype": "VScrollPanel",
"options": {"css": "filler"},
"subwidgets": [
{
"widgettype": "HBox",
"options": {"width": "100%", "alignItems": "center", "marginBottom": "12px"},
"subwidgets": [
{"widgettype": "Title2", "options": {"fontWeight": "700", "otext": "数据概览", "i18n": true}},
{"widgettype": "Filler"}
]
},
{
"widgettype": "HBox",
"options": {"width": "100%", "gap": "16px", "marginBottom": "16px"},
"subwidgets": [
{"widgettype": "RefreshWidget", "id": "stat_today_usage", "options": {"period_seconds": 30, "url": "{{entire_url('stat_today_usage.ui')}}", "width": "16%"}},
{"widgettype": "RefreshWidget", "id": "stat_today_amount", "options": {"period_seconds": 30, "url": "{{entire_url('stat_today_amount.ui')}}", "width": "16%"}},
{"widgettype": "RefreshWidget", "id": "stat_success_rate", "options": {"period_seconds": 60, "url": "{{entire_url('stat_success_rate.ui')}}", "width": "16%"}},
{"widgettype": "RefreshWidget", "id": "stat_fail_calls", "options": {"period_seconds": 60, "url": "{{entire_url('stat_fail_calls.ui')}}", "width": "16%"}},
{"widgettype": "RefreshWidget", "id": "stat_avg_ttft", "options": {"period_seconds": 60, "url": "{{entire_url('stat_avg_ttft.ui')}}", "width": "16%"}},
{"widgettype": "RefreshWidget", "id": "stat_total_users", "options": {"period_seconds": 60, "url": "{{entire_url('stat_total_users.ui')}}", "width": "16%"}}
]
},
{
"widgettype": "HBox",
"options": {"width": "100%", "gap": "16px", "marginBottom": "16px"},
"subwidgets": [
{
"widgettype": "VBox",
"options": {"css": "card", "width": "60%", "padding": "16px"},
"subwidgets": [
{"widgettype": "Title4", "options": {"fontWeight": "600", "otext": "模型性能排行", "i18n": true, "marginBottom": "8px"}},
{
"widgettype": "Cols",
"options": {
"col_cwidth": 24,
"data_url": "{{entire_url('api/model_perf.dspy')}}",
"data_params": {},
"record_view": {
"widgettype": "HBox",
"options": {"cheight": 3, "width": "100%"},
"subwidgets": [
{"widgettype": "Text", "options": {"text": "${model}", "width": "35%"}},
{"widgettype": "Text", "options": {"text": "${avg_ttft_ms}ms", "width": "15%"}},
{"widgettype": "Text", "options": {"text": "${success_rate}%", "width": "15%"}},
{"widgettype": "Text", "options": {"text": "${total_calls}", "width": "15%"}},
{"widgettype": "Text", "options": {"text": "${total_amount_cny}", "width": "20%"}}
]
}
}
}
]
},
{
"widgettype": "VBox",
"options": {"css": "card", "width": "40%", "padding": "16px"},
"subwidgets": [
{"widgettype": "Title4", "options": {"fontWeight": "600", "otext": "币种分布", "i18n": true, "marginBottom": "8px"}},
{
"widgettype": "Cols",
"options": {
"col_cwidth": 24,
"data_url": "{{entire_url('api/currency_stats.dspy')}}",
"data_params": {},
"record_view": {
"widgettype": "HBox",
"options": {"cheight": 3, "width": "100%"},
"subwidgets": [
{"widgettype": "Text", "options": {"text": "${currency}", "width": "20%"}},
{"widgettype": "Text", "options": {"text": "${call_count}次", "width": "25%"}},
{"widgettype": "Text", "options": {"text": "${amount}", "width": "25%"}},
{"widgettype": "Text", "options": {"text": "${amount_cny}", "width": "30%"}}
]
}
}
}
]
}
]
},
{
"widgettype": "HBox",
"options": {"width": "100%", "gap": "16px", "marginBottom": "16px"},
"subwidgets": [
{
"widgettype": "VBox",
"options": {"css": "card", "width": "50%", "padding": "16px"},
"subwidgets": [
{"widgettype": "Title4", "options": {"fontWeight": "600", "otext": "供应商性价比", "i18n": true, "marginBottom": "8px"}},
{
"widgettype": "Cols",
"options": {
"col_cwidth": 24,
"data_url": "{{entire_url('api/provider_roi.dspy')}}",
"data_params": {},
"record_view": {
"widgettype": "HBox",
"options": {"cheight": 3, "width": "100%"},
"subwidgets": [
{"widgettype": "Text", "options": {"text": "${model}", "width": "35%"}},
{"widgettype": "Text", "options": {"text": "${unit_price}/t", "width": "20%"}},
{"widgettype": "Text", "options": {"text": "${avg_ttft_ms}ms", "width": "15%"}},
{"widgettype": "Text", "options": {"text": "${total_calls}次", "width": "15%"}},
{"widgettype": "Text", "options": {"text": "${total_amount_cny}", "width": "15%"}}
]
}
}
}
]
}
]
},
{
"widgettype": "HBox",
"options": {"width": "100%", "gap": "16px"},
"subwidgets": [
{
"widgettype": "VBox",
"options": {"css": "card", "width": "33%", "padding": "16px"},
"subwidgets": [
{"widgettype": "Title4", "options": {"fontWeight": "600", "otext": "热门模型", "i18n": true, "marginBottom": "8px"}},
{
"widgettype": "Cols",
"options": {
"col_cwidth": 20,
"data_url": "{{entire_url('api/top_models.dspy')}}",
"data_params": {},
"record_view": {
"widgettype": "HBox",
"options": {"cheight": 3, "width": "100%"},
"subwidgets": [
{"widgettype": "Text", "options": {"text": "${model_name}", "width": "50%"}},
{"widgettype": "Text", "options": {"text": "${cnt}次", "width": "25%"}},
{"widgettype": "Text", "options": {"text": "${total_amount}", "width": "25%"}}
]
}
}
}
]
},
{
"widgettype": "VBox",
"options": {"css": "card", "width": "33%", "padding": "16px"},
"subwidgets": [
{"widgettype": "Title4", "options": {"fontWeight": "600", "otext": "用户排行", "i18n": true, "marginBottom": "8px"}},
{
"widgettype": "Cols",
"options": {
"col_cwidth": 20,
"data_url": "{{entire_url('api/top_users.dspy')}}",
"data_params": {},
"record_view": {
"widgettype": "HBox",
"options": {"cheight": 3, "width": "100%"},
"subwidgets": [
{"widgettype": "Text", "options": {"text": "${user_name}", "width": "50%"}},
{"widgettype": "Text", "options": {"text": "${cnt}次", "width": "25%"}},
{"widgettype": "Text", "options": {"text": "${total_amount}", "width": "25%"}}
]
}
}
}
]
},
{
"widgettype": "VBox",
"options": {"css": "card", "width": "33%", "padding": "16px"},
"subwidgets": [
{"widgettype": "Title4", "options": {"fontWeight": "600", "otext": "供应商排行", "i18n": true, "marginBottom": "8px"}},
{
"widgettype": "Cols",
"options": {
"col_cwidth": 20,
"data_url": "{{entire_url('api/top_providers.dspy')}}",
"data_params": {},
"record_view": {
"widgettype": "HBox",
"options": {"cheight": 3, "width": "100%"},
"subwidgets": [
{"widgettype": "Text", "options": {"text": "${provider_name}", "width": "50%"}},
{"widgettype": "Text", "options": {"text": "${cnt}次", "width": "25%"}},
{"widgettype": "Text", "options": {"text": "${total_amount}", "width": "25%"}}
]
}
}
}
]
}
]
}
]
}
]
}