65 Commits

Author SHA1 Message Date
947b83ae65 feat(balance): pass llmid to finalize_balance for cold-start max_cost 2026-08-04 18:36:10 +08:00
a04b99c6c3 fix(init): register env.sync_llm_product so llmage publish hook can call it 2026-08-04 13:00:09 +08:00
9f37ec4717 fix(accounting): auto-sync published llm to product on publish; skip PAY leg for owner self-use 2026-08-04 12:55:35 +08:00
86057eaa3b feat: integrate Redis balance finalize_balance after consume_accounting 2026-07-31 14:57:25 +08:00
327f77dac1 fix: product_query_price.dspy改为any角色(无需登录) 2026-07-24 16:10:32 +08:00
91c579cff7 fix: product_query_price改用llm_query_price计价 2026-07-24 16:08:15 +08:00
2c5320bb4a feat: product_query_price.dspy替代platformbiz版本 2026-07-24 15:49:09 +08:00
93e12c2bad bugfix 2026-07-15 13:58:58 +08:00
b2bca68160 bugfix 2026-07-15 13:46:56 +08:00
66db401fcb fix: PAY* leg resellerid=ownerid not providerid, stop treating provider as distributor 2026-07-14 16:18:59 +08:00
8e2c701e23 fix: get_product.dspy清除ns.org_id防止覆盖product_org_auth子查询; JSON修复editable嵌套 2026-07-13 16:39:26 +08:00
9ea13564ef fix: 导入接受id参数(fallback),错误消息显示category_id 2026-07-13 16:21:24 +08:00
876e4581b7 fix: dspy f-string不能含反斜杠,改用%格式化 2026-07-13 16:15:23 +08:00
f8717ca9a8 debug: import_category_products加参数日志 2026-07-13 16:12:32 +08:00
cfa9b321c4 fix: 导入去除冗余org_id过滤 + 添加providerid回填dspy
- import_category_products: 移除org_id条件(树控件已做过滤)
- backfill_providerid: 从llm.providerid回填product.providerid
2026-07-13 15:36:31 +08:00
3096190f6d feat: product模型添加providerid字段 + 导入改为增量模式
- product.json: 添加providerid字段(供应商ID)
- core.py: import_categories_and_products改为增量模式
  已有产品跳过不再更新, 仅创建新资源对应的产品
  创建产品时自动设置providerid为资源模块返回的值
2026-07-13 14:53:53 +08:00
5f277949ae feat: product_org_auth model; product_list queries authorized products via product_org_auth 2026-07-10 15:38:29 +08:00
4f5a81e646 feat: multi-currency in product_accounting — real-time exchange + currency on accounting items 2026-07-07 16:25:23 +08:00
89847538f7 feat: product_accounting + backend_accounting — product-based accounting with distribution chain
- product_accounting: llm_id→product_id, calculate_product_cost, distribution chain discounts, consume_accounting
- backend_accounting: accounting loop migrated from llmage
- Both registered in load_product_management()
2026-07-07 12:27:40 +08:00
3132a837a6 feat: add llm_id_to_product_id — LLM model ID to product ID mapping
Converts llmage.llm.id → product.id via resource_ref_id + product_type filter.
2026-07-06 14:23:59 +08:00
ed32a8556c fix: CRUD endpoint return format - remove json.dumps, use widgettype format 2026-07-03 14:50:49 +08:00
7b69bb4eb2 chore: remove .swp file, add to gitignore 2026-06-29 16:05:26 +08:00
d33072ab21 debug: product_category_create.dspy 加追踪日志定位 WHERE None 错误
添加4处 debug:
- START: 记录完整 params_kw
- fields组装后: 记录 keys + id
- sor.C 前后: 定位崩溃在 INSERT 还是后续 SELECT
- EXCEPTION: 记录完整堆栈
2026-06-29 16:05:18 +08:00
5d77e6e20a fix: product_category create/update/delete去除json.dumps和import; create补充resource_module 2026-06-29 14:40:09 +08:00
7bdcb8cf5f bugfix 2026-06-26 14:36:25 +08:00
74d4b67906 bugfix 2026-06-26 14:06:05 +08:00
e998e2a4b2 bugfix 2026-06-26 14:00:55 +08:00
339fccf6d2 fix: 产品类别创建使用fields过滤确保列数匹配 2026-06-25 15:35:35 +08:00
84f1453856 fix: 修复产品类别创建时INSERT列数不匹配问题 2026-06-25 15:34:22 +08:00
Hermes Agent
47f7e8e5c1 fix: 树控件创建节点后返回user_data,修复新增子项不显示 2026-06-24 22:13:38 +08:00
Hermes Agent
1438de9d58 refactor: 删除 product_type_config(运营商产品类型配置)功能
- 删除 models/product_type_config.json
- 删除 json/product_type_config_list.json (CRUD定义)
- 删除 wwwroot/product_type_config_manage.ui 和 product_type_config_list/ 目录
- 删除 wwwroot/api/product_type_config_{create,update,delete}.dspy
- core.py: 移除 get_operator_config/set_operator_config 方法
- core.py: get_product_detail 不再查询 operator_config
- __init__.py: 移除 wrapper 函数和 env 注册
- product_detail.dspy: 移除 operator_config 查询逻辑
- scripts/load_path.py: 移除所有 product_type_config 权限路径
- menu.ui: 移除"运营商配置"菜单项
- index.ui: 移除"运营商配置"卡片,更新标题描述
- README.md: 移除相关文档
2026-06-24 10:34:48 +08:00
Hermes Agent
6dae1676ef feat: 新增商家产品商城页面(storefront)
- 左侧可收缩产品分类树
- 右侧产品列表(卡片式)和产品详情
- 未登录可浏览,登录后显示购买按钮
- 页面和API注册到load_path.py
2026-06-23 18:19:42 +08:00
Hermes Agent
265081c43f fix: 产品导入去重 — 批次内product_code去重 + DB层按product_code+org_id兜底查重
- 批次内seen_codes去重: 同一导入批次中相同product_code只处理第一条
- DB查重增加fallback: resource_ref_id查不到时再按product_code+org_id查
- update时同步写入resource_ref_id
2026-06-23 18:07:30 +08:00
Hermes Agent
984fc73bd6 fix: tree bind用params_mapping替代${id}$避免ArgsConvert误解析为Python内置id函数 2026-06-23 17:26:51 +08:00
Hermes Agent
b87501912c docs: 完整README - 架构设计、资源模块接口规范、导入流程、消费引擎 2026-06-23 16:11:23 +08:00
Hermes Agent
9115435441 refactor: import logic moved to product_management, resource modules return data only
- import_categories_and_products now:
  1. Calls resource module for standardized data
  2. Categories: skip if exists (name+parent+org), else create
  3. Products: update if exists (resource_ref_id+org), else create
- product.json: added resource_ref_id field for resource module internal ID mapping
2026-06-23 16:06:10 +08:00
Hermes Agent
038162b5d9 refactor: dispatch resource_ref_id to resource module interfaces
- product.json: add resource_ref_id field
- core.py: _get_ref_id() helper extracts resource_ref_id from product
- All dispatch methods pass resource_ref_id instead of product_code
- Resource modules no longer need product_code→internal_id mapping
2026-06-23 15:38:35 +08:00
Hermes Agent
811de2a863 feat: add resource module interface dispatcher to ProductManager
- _get_product_interface: resolve product -> resource_module -> interface dict
- get_product_display_info: delegate to resource module pricing display
- check_product_availability: delegate to resource module availability check
- check_product_consumable: delegate to resource module pre-consumption check
- execute_product / execute_product_stream: delegate to resource module service execution
- calculate_product_cost: delegate to resource module cost calculation
- Register all dispatchers on ServerEnv in load_product_management()
2026-06-23 15:09:09 +08:00
Hermes Agent
c78be834d0 refactor: import engine calls resource module's load_product_category_product
- core.py: import_categories_and_products() now takes resource_module as first arg,
  uses importlib to load {resource_module}.init, calls load_product_category_product(parent_category_id)
- Resource module owns the full import logic (read source + write product_management)
- __init__.py: updated wrapper signature
- import_category_products.dspy: updated call
2026-06-23 14:47:12 +08:00
Hermes Agent
0f321b8185 feat: add resource_module field and import sub-categories/products tool
- Add resource_module field to product_category model (stores module name like 'llmage')
- Add resource_module appcode with llmage/supplychain entries to init/data.json
- Add '添加子产品类和产品导入' toolbar tool to tree CRUD (json + generated index.ui)
- Create import_category_products.dspy API endpoint
- Add import_categories_and_products() generic import engine to core.py
- Register import function on ServerEnv
- Update load_path.py with new API endpoint
2026-06-23 13:47:05 +08:00
Hermes Agent
e8f836ba2d 移除临时文件,添加/更新.gitignore 2026-06-22 15:00:30 +08:00
Hermes Agent
f05eea19e5 fix: remove parent_id default '0' from product_category model - Root nodes should have parent_id=NULL, not '0' - Tree query already checks 'parent_id IS NULL' - Revert direct edits to generated dspy files 2026-06-22 14:03:41 +08:00
Hermes Agent
f13651e830 fix: product_category tree root node query + parent_id normalization - get_product_category: accept NULL/empty/'0' as root (parent_id IS NULL OR '' OR '0') - new_product_category: normalize empty/0 parent_id to NULL 2026-06-22 13:59:18 +08:00
Hermes Agent
24605f88e8 fix: datetime->timestamp for audit fields + fix sor.U/sor.I misuse in core.py and API dspy
- All 7 models: created_at/updated_at changed from datetime to timestamp type
  (DDL template auto-generates DEFAULT CURRENT_TIMESTAMP for timestamp type)
- core.py: fix all sor.U() calls passing 3 args (id must be in data dict)
- core.py: fix sor.I() misuse for INSERT (should be sor.C())
- API dspy updates: fix sor.U() 3-arg bug in category/product/type_config/resource/subscription/supplier
- product_resource_supplier_update.dspy: add missing updated_at field
2026-06-22 11:04:46 +08:00
Hermes Agent
26d374919c feat: 菜单增加新增功能入口
- 产品资源绑定管理
- 资源供应商关联管理
- 客户订购管理
- 产品消费记录查询
2026-06-21 11:44:59 +08:00
Hermes Agent
0e79ddc939 fix: CRUD JSON合规格式(tblname+params) + CRUD create/update/delete dspy + load_path更新
- 5个CRUD JSON从自定义格式重写为规范格式(tblname/alias/params)
- 13个新CRUD dspy文件(create/update/delete + noop)
- product_resource_delete含级联删除product_resource_supplier
- product_subscription CRUD含完整校验
- product_usage_log只读(noop dspy)
- load_path.py注册所有新增API和CRUD路径
2026-06-21 11:40:33 +08:00
Hermes Agent
e8860401bc feat: 产品模块完整功能实现 — 资源绑定/多供应商路由/包月订购/消耗引擎/成本计算
新增模型: product_resource, product_resource_supplier, product_subscription, product_usage_log
新增API: 15个.dspy端点(资源绑定/供应商管理/订购/超额/消耗/统计)
新增UI: 4个管理界面(资源绑定/供应商关联/订购管理/消费记录)
核心逻辑: ProductManager新增 bind/unbind/subscribe/product_use/check_quota 等完整业务方法
设计文档: DESIGN.md 完整架构规范
2026-06-20 12:10:32 +08:00
Hermes Agent
79e8a5fa69 feat: add i18n translations (zh/en/jp/ko) for all modules 2026-06-19 15:01:36 +08:00
Hermes Agent
bbaa51fcef fix: 补充CRUD自动生成端点的created_at/updated_at时间戳 2026-06-17 17:57:22 +08:00
Hermes Agent
6bf45a2dfc fix: remove imports and use pre-loaded timestampstr/getID in create dspy files
- product_category_create.dspy: removed import json/time/getID, replaced time.strftime with timestampstr(), removed field filter, pass data directly to sor.C()
- product_create.dspy: removed imports, replaced time.strftime with timestampstr()
- product_type_config_create.dspy: removed imports, replaced time.strftime with timestampstr()
2026-06-17 17:49:47 +08:00