218 Commits

Author SHA1 Message Date
3eefe1a67f fix: pricing_display 不乘unit_val + 添加可读display_text字段
1. 新格式 unit_prices 已是展示价,不再乘以 unit_val
2. tiered 定价同步修复
3. 返回增加 display_text 字段,格式如官网价格表
2026-06-05 18:26:30 +08:00
2706815dee fix: use DictObject for config_data to support dot notation in derived fields 2026-06-05 16:07:35 +08:00
022bab8314 feat: add derived field support for nested usage data
- Support dot notation in derived expressions (e.g., prompt_tokens_details.cached_tokens)
- Auto-flatten nested dict keys to underscore format for eval
- Calculate uncached_prompt_tokens and cached_tokens from raw usage data
- Test case: qwen3.7-max pricing with derived fields

Test result:
- uncached_prompt_tokens = prompt_tokens - cached_tokens = 1075
- Total cost: 0.007116 元 ✓
2026-06-05 15:04:47 +08:00
df1fa2cfe0 fix: 百万单位定价展示乘以单位值 + 生产混合格式走formula路径
1. get_pricing_display: unit_price 乘以 unit_val 得到人类可读展示价
   (如 4e-06 * 1000000 = 4.0 元/百万tokens)
2. get_pricing_display: unit_values 默认值补全百万/秒/千等映射
3. is_new_format 判断增加类型检查: price_factors为list或unit_prices为dict
   时走旧格式formula路径,避免生产数据TypeError
4. filters区间定价展示价同步乘以unit_val
2026-06-05 14:33:36 +08:00
e2d46f4074 fix: add fallback unit_values in get_pricing_display 2026-06-05 14:32:27 +08:00
da07250049 feat: update unit_values and get_pricing_display for new format
- unit_values: only include units actually used in pricing_data
- get_pricing_display: support new format (price_factors + unit_prices + unit)
- Add fallback unit values for common units
2026-06-05 14:06:58 +08:00
7200454c46 feat: support new pricing format (price_factors + unit_prices)
- get_pricing_from_ymalstr: 支持新格式和旧公式格式
  * 新格式: price_factors + unit_prices + unit 自动计算
  * 旧格式: formula eval 计算(向后兼容)
  * filters: 支持区间定价,多个区间只要匹配一个即可
  * min_amount: 支持最低消费
  * flat: 支持固定费用

- convert_pricing_to_new_design.py: 转换脚本
  * 自动转换 35 条定价记录
  * 无需人工审核

测试通过:
- 多因子计费 (prompt_tokens + completion_tokens)
- 按时长计费 (duration)
- 固定费用 (flat)
- 最低消费 (min_amount)
- 区间定价 (filters)
- 旧公式兼容
2026-06-05 14:00:24 +08:00
392f281758 fix: replace wildcard patterns with explicit per-file entries in load_path.py 2026-06-04 13:03:24 +08:00
977be0d39c feat: add pricing display API for customer-facing pricing data
- generate_formula_from_factors(): auto-generate formula from price_factors array
- get_pricing_display(ppid): return structured human-readable pricing data
- wwwroot/api/get_pricing_display.dspy: API endpoint for frontend consumption
- Supports price_factors display layer (label, unit_price, unit_label)
- Backward compatible: old YAML without pricing_type/price_factors works
- Registered via load_pricing() with ServerEnv
2026-06-04 12:13:55 +08:00
5d4e008ec8 fix: guard hot_reload binding with None check
hasattr only checks attribute existence, but event_dispatcher
can exist as None when running standalone (backend_accounting.py).
Use getattr with None check instead.
2026-06-02 17:36:38 +08:00
ba69fb84d1 debug: add hot_reload handler logging 2026-06-01 22:53:09 +08:00
b7ca795127 cleanup: remove dead module-level get_pricing_program and duplicate assignment 2026-06-01 18:57:50 +08:00
52dd91c6ee chore: remove __pycache__, add to gitignore 2026-06-01 18:10:39 +08:00
7b9d3d2ba0 refactor: bind hot_reload event via EventDispatcher, add on_hot_reload to PricingProgram 2026-06-01 18:10:30 +08:00
71329af722 fix: 定价管理菜单直接进入pricing_program CRUD,跳过index.ui 2026-06-01 15:55:20 +08:00
12472b792f fix: reduce module card height (remove cheight, compact padding/icons) 2026-05-30 21:20:48 +08:00
fc1f8bb182 fix: wrap Tabular in VBox with cheight for proper scrolling 2026-05-29 22:09:53 +08:00
8159c79d55 feat: respect module_cache config for pricing cache 2026-05-29 17:59:06 +08:00
c041c76c9f refactor: use wildcard % in load_path.py for auto-coverage 2026-05-29 00:52:20 +08:00
b7e69b48cd fix: responsive UI with VScrollPanel, cfontsize, css:card 2026-05-29 00:12:52 +08:00
5813749a98 bugfix 2026-05-27 18:17:44 +08:00
c1bdc467a6 refactor(models): convert to json format per database-table-definition-spec 2026-05-27 13:23:30 +08:00
6379c1a0e3 feat: add load_path.py RBAC permission registration script 2026-05-27 13:16:09 +08:00
ce5062215e fix: remove hardcoded dark theme colors from index.ui
- Remove bgcolor/color/border hardcoded dark theme values
- Use css:'card' class for navigation card
- Let system theme handle styling for proper contrast
2026-05-27 11:31:15 +08:00
0e9a0ef126 fix: add filler css + overflowY:auto to content container 2026-05-26 13:55:19 +08:00
bf868f3f3a fix: add dark mode background (#0B1120) to pricing index.ui 2026-05-26 11:57:18 +08:00
7c41db3f9b feat: modernize pricing UI - add index.ui with card navigation
- Create index.ui with standardized card layout (#1E293B, 12px radius)
- Simplify menu.ui to point to index.ui entry point
- Add page header with Title2 + description text
- Use consistent SVG icon style (36px, 1.5 stroke width)
2026-05-25 18:30:48 +08:00
fc54699be7 feat: add json table definitions for all models (converted from xlsx) 2026-05-21 12:46:36 +08:00
9ccbb47920 bugfix 2026-05-19 12:09:52 +08:00
b981d07f40 fix: refresh pricing cache for timing id events 2026-05-19 01:12:55 +08:00
c85b9527c3 bugfix 2026-05-18 16:02:14 +08:00
1677d18704 bugfix 2026-05-16 16:55:58 +08:00
eebe7c2733 bugfix 2026-05-16 16:53:01 +08:00
168ce230c4 bugfix 2026-05-16 16:50:01 +08:00
7095d8dca2 bugfix 2026-05-16 16:40:09 +08:00
1f1faaa085 bugfix 2026-05-16 16:38:44 +08:00
7468bcd781 bugfix 2026-05-16 16:36:41 +08:00
4f40be10dc bugfix 2026-05-16 16:32:47 +08:00
a264e72a24 bugfix 2026-05-16 16:19:22 +08:00
19f03c82c3 bugfix 2026-05-16 16:13:18 +08:00
0efc1be770 bugfix 2026-05-14 17:01:56 +08:00
28b3cf4977 bugfix 2026-05-14 13:48:08 +08:00
f78c6f6494 bugfix 2026-05-14 13:41:41 +08:00
37ad188a26 bugfix 2026-05-14 13:34:29 +08:00
c8bc20d786 bugfix 2026-05-14 13:29:49 +08:00
4667c49372 bugfix 2026-05-14 13:16:37 +08:00
8643e22a50 bugfix 2026-05-14 13:14:35 +08:00
e7381291e8 bugfix 2026-05-14 13:12:05 +08:00
d98479ee6e bugfix 2026-05-14 13:10:45 +08:00
896c87c4f0 bugfix 2026-05-14 13:10:13 +08:00