From 8f3bd268ad0a047995c59e302f95534e838d1db4 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 4 Sep 2026 19:32:42 +0800 Subject: [PATCH] =?UTF-8?q?feat(product):=20=E4=BA=A7=E7=BA=BF=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E4=BA=A7=E5=93=81=E5=8C=96=E6=8E=A5=E5=85=A5=E2=80=94?= =?UTF-8?q?=E2=80=94product=5Faccounting=5Fgeneric=E6=9A=B4=E9=9C=B2?= =?UTF-8?q?=E5=88=B0env(=E7=8B=AC=E7=AB=8B=E8=AE=B0=E8=B4=A6=E8=BF=9B?= =?UTF-8?q?=E7=A8=8B=E8=B0=83=E7=94=A8)+resource=5Fmodule=E7=A7=8D?= =?UTF-8?q?=E5=AD=90=E5=8A=A0pipeline=5Fllm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init/data.json | 3 ++- product_management/__init__.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/init/data.json b/init/data.json index 6f58fe6..5c08aef 100644 --- a/init/data.json +++ b/init/data.json @@ -125,7 +125,8 @@ {"id": "billing_mode_2", "parentid": "billing_mode", "k": "2", "v": "超额按量"}, {"id": "resource_module_llmage", "parentid": "resource_module", "k": "llmage", "v": "大模型管理"}, - {"id": "resource_module_supplychain", "parentid": "resource_module", "k": "supplychain", "v": "供应链管理"} + {"id": "resource_module_supplychain", "parentid": "resource_module", "k": "supplychain", "v": "供应链管理"}, + {"id": "resource_module_pipeline_llm", "parentid": "resource_module", "k": "pipeline_llm", "v": "产线模型治理"} ], "_note_product_category": "产品类别树由每个 reseller (org_id) 自行管理,不在 init/data.json 中预设全局数据。新机构注册时自动创建根类别。" } diff --git a/product_management/__init__.py b/product_management/__init__.py index f94d924..8404da7 100644 --- a/product_management/__init__.py +++ b/product_management/__init__.py @@ -139,6 +139,15 @@ async def product_accounting(llmusage): return await manager.product_accounting(llmusage) +async def product_accounting_generic(product_id, usage_data, userorgid, userid, + providerid=None, ownerid=None, tenantid=None): + """通用商品计费落账(模型/账号/存储通用,供独立记账进程调用)。""" + manager = get_manager() + return await manager.product_accounting_generic( + product_id, usage_data, userorgid, userid, + providerid=providerid, ownerid=ownerid, tenantid=tenantid) + + async def account_resource_accounting(usage_record): """账号用量计费落账(acctres_usage → 通用计费落账)。""" manager = get_manager() @@ -182,6 +191,7 @@ def load_product_management(): env.sync_llm_product = sync_llm_product # Product accounting env.product_accounting = product_accounting + env.product_accounting_generic = product_accounting_generic env.account_resource_accounting = account_resource_accounting env.storage_resource_accounting = storage_resource_accounting env.backend_accounting = backend_accounting