31 Commits

Author SHA1 Message Date
b3d2ff010c i18n: stat_success_rate/stat_fail_calls改用otext 2026-07-24 14:33:53 +08:00
a44060f185 i18n: 实时卡片+index.ui标签改用otext/i18n,补全4语言翻译 2026-07-24 14:04:03 +08:00
1af03bf195 fix: 删除多余i18n_getmsgs.dspy+注册 2026-07-24 13:50:54 +08:00
88eb783940 fix: i18n目录移到sage_datamart/i18n(模块级),更正i18n_getmsgs路径 2026-07-24 13:50:46 +08:00
03645f1128 feat: i18n多语言支持(zh/en/jp/ko)+i18n_getmsgs端点 2026-07-24 13:49:55 +08:00
25cfa19a48 feat: 分销商财务仪表盘(收入/成本/毛利×币种,今天/本月/本年/累计) 2026-07-24 13:08:31 +08:00
59072ef035 feat: 客户视图(隐藏用户区+org过滤图表+API Key排行端点) 2026-07-23 16:53:51 +08:00
85afc1f023 feat: 客户视图隐藏用户区域,管理员才显示完整面板 2026-07-23 16:08:45 +08:00
21ad2403a0 fix: api_provider_roi JOIN organization.orgname + ChartScatter nameField改为provider_name 2026-07-23 11:54:58 +08:00
698dc940b4 fix: ChartPie加pie_options/ChartScatter改xField/yField/sizeField 2026-07-23 11:21:32 +08:00
135b394b2a fix: rt_card_amount简化为amt|float,去掉if/else避免jinja2运算歧义 2026-07-23 11:07:43 +08:00
94147b24cc fix: sect_*.ui去entire_url改用绝对路径(子页面entire_url不可用) 2026-07-23 10:45:47 +08:00
41db2df9c9 fix: 使用bricks原生ChartBar/ChartPie/ChartScatter替代WebWidget+Jinja2 2026-07-22 18:54:12 +08:00
a31d0d3bbb fix: 图表改用原生CSS进度条(VBox+bgcolor),去掉不存在的WebWidget 2026-07-22 18:50:46 +08:00
bdffa5c81b fix: 模型延迟统一用COALESCE(ttft,ttot)覆盖异步模型 2026-07-22 18:01:06 +08:00
3b9391b582 fix: WebWidget script用{%set%}+json.dumps包裹,修复JSON转义错误 2026-07-22 17:54:49 +08:00
47278c16ec ui: 实时卡片缩小字体+分组(今天调用/用户)两行展示 2026-07-22 17:24:16 +08:00
dbe45ed489 feat: 6个监控组件图表化(环形图+柱状图+气泡图+美化列表) 2026-07-22 17:18:07 +08:00
7db361425b feat: 6个监控组件改用RefreshWidget+Jinja2服务端渲染,初始即加载+60s刷新 2026-07-22 14:56:20 +08:00
305395ca99 fix: 4个DSPY统一用env.api_xxx()调用,消除namespace注入不稳定 2026-07-22 13:33:42 +08:00
6fb1b8cf44 fix: DSPY格式统一为Python脚本+json.dumps,消除JSON格式导致的NoneType异常 2026-07-21 18:16:23 +08:00
05584d8871 feat: 实时数据Dashboard+客户/分销商角色视图
- dashboards.py: 新增实时指标(直查llmusage,无ETL延迟) + 分销商专用API + scope过滤版
- init.py: 角色检测(_resolve_view),实时卡片J2函数,分销商API端点
- index.ui: 7个实时卡片(15s刷新)替换旧stat_*卡片
- 新增rt_card_*.ui(7个)+api端点(2个)
- load_path.py: 注册新UI路径
2026-07-21 12:03:28 +08:00
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
2f9a890128 refactor: move init_data to standalone script (not cron endpoint)
- scripts/init_data.py: standalone CLI tool, connects directly to sage DB
- Remove HTTP endpoint (cron/init_data.dspy) - init is one-time operation
- Remove init_datamart from init.py - no longer exposed as web service
- Remove RBAC permission for init_data.dspy

Usage: cd /path/to/sage && python /path/to/sage_datamart/scripts/init_data.py
2026-07-20 13:44:09 +08:00
7f5c1ed372 feat: add init_data script to import historical data from llmusage + llmusage_history into data mart
- init_data.py: batch import with dedup, aggregate all historical dates
- wwwroot/cron/init_data.dspy: trigger endpoint
- init.py: register init_datamart function with IP whitelist
- load_path.py: add RBAC permission for init_data.dspy
2026-07-20 13:08:04 +08:00
4f23e07bcd fix: cron dspy移除import + load_path.py添加cron权限(any) + stat_total_users
- cron/*.dspy: 移除import,改为调用init.py注册的cron_etl_*函数
- init.py: 新增cron_etl_sync/aggregate/provider_cost函数(含IP白名单校验)
- load_path.py: 添加3个cron dspy路径为any角色,补充stat_total_users.ui
- dspy内权限: request['client_ip']不在127.0.0.1则拒绝
2026-07-20 10:55:05 +08:00
8a97ea4a86 refactor: rename sage_datamark → sage_datamart + add ETL cron + stat UIs
- Rename package directory and all references from sage_datamark to sage_datamart
- Add 3 ETL cron dspy files (sync/aggregate/provider_cost) for scheduled data pipelines
- Add 5 stat UI files (total_users/fail_calls/success_rate/avg_ttft/total_calls)
- Register j2_ template functions in init.py for UI rendering
- Move j2_avg_ttft SQL to dashboards.py for DRY
- Clean unused imports (getConfig/DBPools/exception)
- Update git remote to sage_datamart.git
2026-07-20 10:49:15 +08:00
0f3c7f23f4 fix: add import json to model_perf.dspy and provider_roi.dspy 2026-07-17 18:12:56 +08:00
054b0dd8e2 feat: unified dashboard — all dashboard_for_sage metrics from data mart, 6 stat cards, perf+ops 2026-07-17 18:11:19 +08:00
8aafb31ef4 rename: data_mart → sage_datamark 2026-07-17 17:20:13 +08:00
4d24094048 feat: data_mart module — model perf monitoring + provider ROI dashboard 2026-07-17 16:56:52 +08:00