e3f61f446d
feat(balance): extend atomic balance reserve to async+sync+product paths
...
- balance.py: module-level redis.asyncio singleton (works in all
processes without env.redis injection), centralized tpac/self-org
skip policy, userid param, extend_reserve, invalidate_balance_cache,
finalize updates max_cost on cold start (no reserve)
- llmclient.py: unified reserve injection in _inference_generator
(covers all 22 dspy entries); fix luid mismatch (reserve key ==
llmusage id == finalize key); stream exception refund
- syncinference.py / asyncinference.py: luid reuse + failure refunds
(submit failure, outer exception, query_task_status FAILED)
- product_interface.py: reserve + refund on product stream/non-stream
- accounting.py: finalize after llm_accounting (was missing for
direct llmage accounting path -> reserve leaked until TTL)
- init.py: lambda signatures synced
- v1/chat/completions/index.dspy: pass userid to reserve
2026-08-04 18:35:53 +08:00
b97a14d41d
bugfix
2026-08-03 14:58:52 +08:00
e5d27bc6bd
fix: retry write_llmusage with *1,*2 on duplicate; gen() catch+refund but yield error not raise
2026-07-31 16:48:40 +08:00
670325e8eb
fix: move refund to uapi_request except, remove gen() try/except that re-raised causing 500
...
gen() try/except re-raised internal errors from uapi_request → 500 response.
Moved refund_balance to uapi_request's except block where errors are properly
handled (yield error, normal generator exit).
2026-07-31 16:39:43 +08:00
9da343b2e1
fix: use uuid4 instead of getID() in DSPY to avoid nanoid collision under concurrency
...
Two getID() calls per request (DSPY + uapi_request) under 200 concurrent
caused nanoid random state corruption → 34% duplicate IDs → IntegrityError.
uuid4 uses OS entropy, independent of nanoid state.
2026-07-31 16:30:49 +08:00
8c77f552a8
fix: remove stray tab causing IndentationError in chat/completions/index.dspy
2026-07-31 15:51:24 +08:00
6351ee9b56
feat: Redis atomic balance reservation — prevent concurrent overspend
...
- balance.py: reserve_balance/finalize_balance/refund_balance with Lua
- utils.py: get_model_max_cost from llmusage history, update_model_max_cost
- init.py: register reserve_balance, finalize_balance, refund_balance on env
- chat/completions/index.dspy: reserve before inference, refund on exception
- DB migration: llm.max_cost DECIMAL(10,4) for historical max charge
2026-07-31 14:57:17 +08:00
ef1e228f19
perf: llmid缓存(启动预热+内存查),v1/chat/completions去3表JOIN
2026-07-23 18:26:52 +08:00
27f3ee9c78
feat: llm.name唯一索引; v1端点全部改用name查找llm
2026-07-01 13:48:05 +08:00
dd304972b5
fix: 所有v1端点补充params_kw.llmcatelogid,确保llmclient正确路由
2026-06-30 16:00:26 +08:00
5d52d02319
refactor: V1 API 支持新 catelogid 缩写(t2t/t2v/t2i等),向后兼容中文名
...
- v1/chat/completions: 默认值 '文生文' → 't2t',SQL 匹配 b.id OR b.name
- v1/video/generations: SQL 匹配 b.id OR b.name,注释示例更新
- v1/image/generations: SQL 匹配 b.id OR b.name,注释示例更新
- t2t/index.dspy: 默认值 '文生文' → 't2t',SQL 匹配 b.id OR b.name
- get_type_llms.dspy: 硬编码中文名改为 alias 映射(t2v/i2v/r2v)
- docs/API.md: 添加完整 catelogid ID 对照表,示例参数更新
2026-05-30 20:36:16 +08:00
08bebcd257
refactor: v1 API 统一使用 catelogid 参数替代 lctype/llmcatelogid
2026-05-30 16:22:21 +08:00
44d94dace5
refactor: optimize debug output - use debug_params for compact logging, truncate SQL; add CRUD definitions
2026-05-29 12:07:53 +08:00
d6e4221a7b
feat: add model publish/unpublish (上架/下架) functionality
...
- llm table: add status field (published/unpublished, default unpublished)
- User-facing queries: filter by status='published' in 11 query points:
- utils.py: get_llms_by_catelog_to_customer, get_llms_by_catelog,
get_llm, get_llmproviders, get_llms_sort_by_provider
- v1 endpoints: chat/completions, image/generations, video/generations
- user pages: t2t, get_type_llms, list_catelog_models,
list_paging_catelog_llms, llmcheck
- CRUD: status column visible/editable with select dropdown
- Admin CRUD list shows ALL models regardless of status
- Migration SQL: sql/add_status_field.sql (existing models set to published)
2026-05-28 23:42:29 +08:00
410ab1d2e4
buggix
2026-05-22 15:47:00 +08:00
5b3c7d4d02
refactor: 废弃llm_catalog_rel表, 分类关系改用llm_api_map
...
- 删除 llm_catalog_rel 表定义(models/json/xlsx)、CRUD文件、管理页面、迁移脚本
- utils.py: get_llms_by_catelog/get_llms_by_catelog_to_customer 的SQL从 llm_catalog_rel 改为 llm_api_map (加distinct去重)
- init.py: 缓存清除事件从 llm_catalog_rel 改为 llm_api_map
- menu.ui/index.ui: 移除类型关联菜单项
- dspy文件: v1/chat/completions, t2t, get_type_llms, list_catelog_models, list_paging_catelog_llms, llmcatelog_delete 全部改为 join llm_api_map
- 迁移脚本: 添加try/except兼容旧表不存在的情况
2026-05-21 16:22:59 +08:00
76622381be
bugfix
2026-05-21 13:19:48 +08:00
6cc3986a2d
feat: support multi-catalog for LLMs
...
- Create llm_catalog_rel model for one-to-many relationship
- Remove llmcatelogid from llm model
- Update SQL queries in utils.py and dspy files to use join
- Add maintenance UI (llm_catalog_rel_manage.ui) and API endpoints
- Filter options by user's orgid
2026-05-16 21:31:19 +08:00
a5c459599a
bugfix
2026-05-08 11:02:00 +08:00
6afbc71b13
bugfix
2026-05-08 10:54:33 +08:00
f324cbf9f7
bugfix
2026-04-23 17:43:37 +08:00
29f488b280
bugfix
2026-04-23 17:32:03 +08:00
df3257ef14
bugfix
2026-04-02 13:34:41 +08:00
adb3d9b30d
bugfix
2026-04-01 13:38:46 +08:00