157 lines
9.1 KiB
XML

{% set roles = get_user_roles(get_user()) %}
{% set userorgid = get_userorgid() if get_userorgid is defined else '' %}
{% set is_admin = userorgid == '0' %}
{% set is_distributor = j2_is_distributor(request) %}
{
"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": "8px"},
"subwidgets": [
{"widgettype": "Text", "options": {"fontWeight": "600", "fontSize": "13px", "text": "今天调用", "color": "var(--sage-text-primary)"}},
{"widgettype": "Filler"}
]
},
{
"widgettype": "HBox",
"options": {"width": "100%", "gap": "10px", "marginBottom": "14px"},
"subwidgets": [
{"widgettype": "RefreshWidget", "id": "rt_calls", "options": {"period_seconds": 15, "url": "{{entire_url('rt_card_calls.ui')}}", "width": "22%"}},
{"widgettype": "RefreshWidget", "id": "rt_amount", "options": {"period_seconds": 15, "url": "{{entire_url('rt_card_amount.ui')}}", "width": "22%"}},
{"widgettype": "RefreshWidget", "id": "rt_success","options": {"period_seconds": 30, "url": "{{entire_url('rt_card_success.ui')}}", "width": "28%"}},
{"widgettype": "RefreshWidget", "id": "rt_fail", "options": {"period_seconds": 30, "url": "{{entire_url('rt_card_fail.ui')}}", "width": "28%"}}
]
},
{% if is_admin %}
{
"widgettype": "HBox",
"options": {"width": "100%", "alignItems": "center", "marginBottom": "8px"},
"subwidgets": [
{"widgettype": "Text", "options": {"fontWeight": "600", "fontSize": "13px", "text": "用户", "color": "var(--sage-text-primary)"}},
{"widgettype": "Filler"}
]
},
{
"widgettype": "HBox",
"options": {"width": "100%", "gap": "10px", "marginBottom": "16px"},
"subwidgets": [
{"widgettype": "RefreshWidget", "id": "rt_users", "options": {"period_seconds": 30, "url": "{{entire_url('rt_card_users.ui')}}", "width": "33%"}},
{"widgettype": "RefreshWidget", "id": "rt_active", "options": {"period_seconds": 30, "url": "{{entire_url('rt_card_active.ui')}}", "width": "33%"}},
{"widgettype": "RefreshWidget", "id": "rt_online", "options": {"period_seconds": 30, "url": "{{entire_url('rt_card_online.ui')}}", "width": "34%"}}
]
},
{% else %}
{% if is_distributor %}
{
"widgettype": "VBox",
"options": {"css": "card", "width": "100%", "padding": "16px", "marginBottom": "16px"},
"subwidgets": [
{"widgettype": "Title4", "options": {"fontWeight": "600", "otext": "财务概览", "i18n": true, "marginBottom": "8px"}},
{"widgettype": "RefreshWidget", "options": {"period_seconds": 60, "url": "{{entire_url('sect_distributor_financial.ui')}}", "width": "100%"}}
]
},
{% else %}
{
"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": "我的模型(按金额Top5)", "i18n": true, "marginBottom": "8px"}},
{"widgettype": "RefreshWidget", "options": {"period_seconds": 60, "url": "{{entire_url('sect_user_apikeys.ui')}}", "width": "100%"}}
]
},
{
"widgettype": "VBox",
"options": {"css": "card", "width": "50%", "padding": "16px"},
"subwidgets": [
{"widgettype": "Title4", "options": {"fontWeight": "600", "otext": "API Key排行", "i18n": true, "marginBottom": "8px"}},
{"widgettype": "RefreshWidget", "options": {"period_seconds": 60, "url": "{{entire_url('sect_user_apikeys.ui')}}", "width": "100%"}}
]
}
]
},
{% endif %}
{% endif %}
{
"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": "RefreshWidget", "options": {"period_seconds": 60, "url": "{{entire_url('sect_model_perf.ui')}}", "width": "100%"}}
]
},
{
"widgettype": "VBox",
"options": {"css": "card", "width": "40%", "padding": "16px"},
"subwidgets": [
{"widgettype": "Title4", "options": {"fontWeight": "600", "otext": "币种分布", "i18n": true, "marginBottom": "8px"}},
{"widgettype": "RefreshWidget", "options": {"period_seconds": 60, "url": "{{entire_url('sect_currency.ui')}}", "width": "100%"}}
]
}
]
},
{
"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": "RefreshWidget", "options": {"period_seconds": 60, "url": "{{entire_url('sect_provider_roi.ui')}}", "width": "100%"}}
]
}
]
},
{% if is_admin %}
{
"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": "RefreshWidget", "options": {"period_seconds": 60, "url": "{{entire_url('sect_top_models.ui')}}", "width": "100%"}}
]
},
{
"widgettype": "VBox",
"options": {"css": "card", "width": "33%", "padding": "16px"},
"subwidgets": [
{"widgettype": "Title4", "options": {"fontWeight": "600", "otext": "用户排行", "i18n": true, "marginBottom": "8px"}},
{"widgettype": "RefreshWidget", "options": {"period_seconds": 60, "url": "{{entire_url('sect_top_users.ui')}}", "width": "100%"}}
]
},
{
"widgettype": "VBox",
"options": {"css": "card", "width": "33%", "padding": "16px"},
"subwidgets": [
{"widgettype": "Title4", "options": {"fontWeight": "600", "otext": "供应商排行", "i18n": true, "marginBottom": "8px"}},
{"widgettype": "RefreshWidget", "options": {"period_seconds": 60, "url": "{{entire_url('sect_top_providers.ui')}}", "width": "100%"}}
]
}
]
}
{% endif %}
]
}
]
}