diff --git a/dashboard_for_sage/load_dashboard.py b/dashboard_for_sage/load_dashboard.py
index c4690d0..8db936c 100644
--- a/dashboard_for_sage/load_dashboard.py
+++ b/dashboard_for_sage/load_dashboard.py
@@ -95,9 +95,8 @@ async def get_accounting_errors(request):
async def get_top_users_by_amount(request):
- """获取当天用户金额前5"""
+ """获取用户金额前5(全量)"""
env = request._run_ns
- today = env.curDateString()
async with get_sor_context(env, 'sage') as sor:
sql = """
SELECT
@@ -106,12 +105,11 @@ async def get_top_users_by_amount(request):
COUNT(*) as cnt
FROM llmusage a
LEFT JOIN users b ON a.userid = b.id
- WHERE a.use_date = ${today}$
GROUP BY a.userid, b.nick_name, b.username
ORDER BY total_amount DESC
LIMIT 5
"""
- recs = await sor.sqlExe(sql, {'today': today})
+ recs = await sor.sqlExe(sql, {})
result = []
for r in recs:
result.append({
@@ -123,9 +121,8 @@ async def get_top_users_by_amount(request):
async def get_top_users_by_count(request):
- """获取当天用户笔数前5"""
+ """获取用户笔数前5(全量)"""
env = request._run_ns
- today = env.curDateString()
async with get_sor_context(env, 'sage') as sor:
sql = """
SELECT
@@ -134,12 +131,11 @@ async def get_top_users_by_count(request):
COALESCE(SUM(a.amount), 0) as total_amount
FROM llmusage a
LEFT JOIN users b ON a.userid = b.id
- WHERE a.use_date = ${today}$
GROUP BY a.userid, b.nick_name, b.username
ORDER BY cnt DESC
LIMIT 5
"""
- recs = await sor.sqlExe(sql, {'today': today})
+ recs = await sor.sqlExe(sql, {})
result = []
for r in recs:
result.append({
@@ -151,9 +147,8 @@ async def get_top_users_by_count(request):
async def get_top_providers_by_amount(request):
- """获取模型供应商金额前5"""
+ """获取模型供应商金额前5(全量)"""
env = request._run_ns
- today = env.curDateString()
async with get_sor_context(env, 'sage') as sor:
sql = """
SELECT
@@ -163,12 +158,11 @@ async def get_top_providers_by_amount(request):
FROM llmusage a
LEFT JOIN llm b ON a.llmid = b.id
LEFT JOIN organization c ON b.providerid = c.id
- WHERE a.use_date = ${today}$
GROUP BY b.providerid, c.orgname
ORDER BY total_amount DESC
LIMIT 5
"""
- recs = await sor.sqlExe(sql, {'today': today})
+ recs = await sor.sqlExe(sql, {})
result = []
for r in recs:
result.append({
@@ -180,9 +174,8 @@ async def get_top_providers_by_amount(request):
async def get_top_providers_by_count(request):
- """获取模型供应商笔数前5"""
+ """获取模型供应商笔数前5(全量)"""
env = request._run_ns
- today = env.curDateString()
async with get_sor_context(env, 'sage') as sor:
sql = """
SELECT
@@ -192,12 +185,11 @@ async def get_top_providers_by_count(request):
FROM llmusage a
LEFT JOIN llm b ON a.llmid = b.id
LEFT JOIN organization c ON b.providerid = c.id
- WHERE a.use_date = ${today}$
GROUP BY b.providerid, c.orgname
ORDER BY cnt DESC
LIMIT 5
"""
- recs = await sor.sqlExe(sql, {'today': today})
+ recs = await sor.sqlExe(sql, {})
result = []
for r in recs:
result.append({
diff --git a/wwwroot/global_menu.ui b/wwwroot/global_menu.ui
index f9a0b80..9b77a51 100644
--- a/wwwroot/global_menu.ui
+++ b/wwwroot/global_menu.ui
@@ -11,7 +11,7 @@
"name": "dashboard",
"label": "仪表盘",
"icon": "fa fa-dashboard",
- "url": "{{entire_url('index.ui')}}",
+ "url": "{{entire_url('/dashboard_for_sage/index.ui')}}",
"target": "app.sage_main_content"
},
{% if get_user() %}
diff --git a/wwwroot/index.ui b/wwwroot/index.ui
index 153739b..40e423f 100644
--- a/wwwroot/index.ui
+++ b/wwwroot/index.ui
@@ -2,7 +2,8 @@
"widgettype": "VBox",
"options": {
"width": "100%",
- "height": "100%"
+ "height": "100%",
+ "bgcolor": "#0B1120"
},
"subwidgets": [
{
@@ -216,12 +217,12 @@
},
"subwidgets": [
{
- "widgettype": "VBox",
+ "widgettype": "Button",
"options": {
"bgcolor": "#334155",
"padding": "16px",
"borderRadius": "8px",
- "cursor": "pointer",
+ "border": "none",
"textAlign": "center"
},
"binds": [
@@ -238,29 +239,37 @@
],
"subwidgets": [
{
- "widgettype": "Svg",
+ "widgettype": "VBox",
"options": {
- "svg": ""
- }
- },
- {
- "widgettype": "Text",
- "options": {
- "text": "模型管理",
- "color": "#E2E8F0",
- "fontSize": "13px",
- "marginTop": "8px"
- }
+ "alignItems": "center"
+ },
+ "subwidgets": [
+ {
+ "widgettype": "Svg",
+ "options": {
+ "svg": ""
+ }
+ },
+ {
+ "widgettype": "Text",
+ "options": {
+ "text": "模型管理",
+ "color": "#E2E8F0",
+ "fontSize": "13px",
+ "marginTop": "8px"
+ }
+ }
+ ]
}
]
},
{
- "widgettype": "VBox",
+ "widgettype": "Button",
"options": {
"bgcolor": "#334155",
"padding": "16px",
"borderRadius": "8px",
- "cursor": "pointer",
+ "border": "none",
"textAlign": "center"
},
"binds": [
@@ -277,29 +286,37 @@
],
"subwidgets": [
{
- "widgettype": "Svg",
+ "widgettype": "VBox",
"options": {
- "svg": ""
- }
- },
- {
- "widgettype": "Text",
- "options": {
- "text": "用户管理",
- "color": "#E2E8F0",
- "fontSize": "13px",
- "marginTop": "8px"
- }
+ "alignItems": "center"
+ },
+ "subwidgets": [
+ {
+ "widgettype": "Svg",
+ "options": {
+ "svg": ""
+ }
+ },
+ {
+ "widgettype": "Text",
+ "options": {
+ "text": "用户管理",
+ "color": "#E2E8F0",
+ "fontSize": "13px",
+ "marginTop": "8px"
+ }
+ }
+ ]
}
]
},
{
- "widgettype": "VBox",
+ "widgettype": "Button",
"options": {
"bgcolor": "#334155",
"padding": "16px",
"borderRadius": "8px",
- "cursor": "pointer",
+ "border": "none",
"textAlign": "center"
},
"binds": [
@@ -316,29 +333,37 @@
],
"subwidgets": [
{
- "widgettype": "Svg",
+ "widgettype": "VBox",
"options": {
- "svg": ""
- }
- },
- {
- "widgettype": "Text",
- "options": {
- "text": "知识库",
- "color": "#E2E8F0",
- "fontSize": "13px",
- "marginTop": "8px"
- }
+ "alignItems": "center"
+ },
+ "subwidgets": [
+ {
+ "widgettype": "Svg",
+ "options": {
+ "svg": ""
+ }
+ },
+ {
+ "widgettype": "Text",
+ "options": {
+ "text": "知识库",
+ "color": "#E2E8F0",
+ "fontSize": "13px",
+ "marginTop": "8px"
+ }
+ }
+ ]
}
]
},
{
- "widgettype": "VBox",
+ "widgettype": "Button",
"options": {
"bgcolor": "#334155",
"padding": "16px",
"borderRadius": "8px",
- "cursor": "pointer",
+ "border": "none",
"textAlign": "center"
},
"binds": [
@@ -355,19 +380,27 @@
],
"subwidgets": [
{
- "widgettype": "Svg",
+ "widgettype": "VBox",
"options": {
- "svg": ""
- }
- },
- {
- "widgettype": "Text",
- "options": {
- "text": "异常记录",
- "color": "#E2E8F0",
- "fontSize": "13px",
- "marginTop": "8px"
- }
+ "alignItems": "center"
+ },
+ "subwidgets": [
+ {
+ "widgettype": "Svg",
+ "options": {
+ "svg": ""
+ }
+ },
+ {
+ "widgettype": "Text",
+ "options": {
+ "text": "异常记录",
+ "color": "#E2E8F0",
+ "fontSize": "13px",
+ "marginTop": "8px"
+ }
+ }
+ ]
}
]
}