Commit Graph
411 Commits
Author SHA1 Message Date
Chenyme 5fb7db3e78 Merge remote-tracking branch 'origin/main' into pr/319 2026-03-23 11:20:58 +08:00
Chenyme 635e6e3524 chore: update version to 1.6.2 and adjust related file references 2026-03-18 13:47:31 +08:00
Chenyme 26f6d41df7 Merge pull request #346 from MaxCrazy1101/main
fix: Add configuration import in get_tokens endpoint
2026-03-18 11:42:09 +08:00
MaxCrazy1101 936efd7803 fix: Add configuration import in get_tokens endpoint
Import configuration for consumption mode in get_tokens.
2026-03-17 19:12:34 +08:00
Chenyme f414cd20b5 Merge remote-tracking branch 'origin/main' into pr/319
# Conflicts:
#	_public/static/admin/js/config.js
#	app/services/reverse/app_chat.py
#	config.defaults.toml
#	main.py
2026-03-17 18:41:50 +08:00
Chenyme 7796e08084 Merge pull request #344 from chenyme/fix_cffi
refactor: reorganize import statements in retry utility for clarity
2026-03-17 17:21:20 +08:00
Chenyme 2c22f1a623 refactor: reorganize import statements in retry utility for clarity 2026-03-17 17:15:54 +08:00
Chenyme 5ca3c278e4 Merge pull request #315 from fno2010/feature/token-quota-optimization
feat(token): Add consumed mode for quota management (opt-in)
2026-03-17 16:36:12 +08:00
Chenyme 7de96aee75 refactor: implement consumed mode handling in token management and UI 2026-03-17 16:28:53 +08:00
Chenyme 5088d0a29f Merge remote-tracking branch 'origin/main' into pr/315
# Conflicts:
#	app/api/v1/admin/token.py
2026-03-17 16:28:30 +08:00
Chenyme 9c48d58ffc Merge pull request #314 from FaiChou/fix/vercel-serverless-db-init
fix: ensure SQL storage initializes in Vercel serverless runtime
2026-03-17 15:35:35 +08:00
Chenyme 6645f7dd1e Merge pull request #312 from hzexe/fix-token-sync-308
fix: accurate token expiration detection, retry optimization, and state consistency (#308)
2026-03-17 15:26:13 +08:00
Chenyme 21cf18a643 fix: improve token refresh logic and error handling for expired tokens 2026-03-17 15:21:32 +08:00
Chenyme 401c87ae80 Merge branch 'main' into pr/312 2026-03-17 15:20:40 +08:00
Chenyme 0f71626d39 Merge pull request #311 from keung67/main
feat: Add proxy pool support for IP rotation
2026-03-17 15:02:28 +08:00
Chenyme 7dda23f6f1 Merge branch 'main' of https://github.com/keung67/grok2api-org into pr/311 2026-03-17 14:54:43 +08:00
Chenyme f0e7782896 refactor: enhance proxy handling and retry logic across services 2026-03-17 14:48:05 +08:00
keung67 12bbb2553c Merge branch 'chenyme:main' into main 2026-03-16 20:35:11 +08:00
Chenyme 830ce212f9 Merge branch 'main' into pr/311 2026-03-16 18:28:07 +08:00
Chenyme 4818e73e96 Merge pull request #295 from fernnguyen/feature/public_asset_after_created
feat: Add option to generate public asset links for videos
2026-03-16 16:37:27 +08:00
Chenyme 75ad436476 feat: disable public asset generation by default and refactor public link creation logic 2026-03-16 16:32:57 +08:00
Jensen Zhang c577a2a01d fix(token): correct load balancing logic in consumed mode
在 consumed 模式下,移除错误的『新旧 token 分离逻辑』,改为直接在所有
available token 中选择 consumed 最少的。

问题根因:
- 原逻辑将 consumed > 0 的 token 标记为『新逻辑』并优先选择
- 导致一旦某个 token 被使用过,其他 consumed=0 的 token 就永久被排除
- 造成单个 token 过载,其他 token 闲置的问题

修复方案:
- 删除 new_logic_tokens 和 old_logic_tokens 的分离逻辑
- 直接在所有 available token 中按 consumed 排序,选择最少的
- 确保所有 token 都能参与负载均衡,实现真正的消耗均衡

测试验证:
- 5 个 token,10 次请求,每个 token 恰好被选择 2 次
- 负载均衡差异为 0,符合预期
2026-03-13 16:06:00 +08:00
piexian d31ea0b450 fix: 限制日志暴涨并修复启动日志兼容问题 2026-03-13 03:53:02 +08:00
Jensen Zhang 2ea3d9f2fd fix(token): reset consumed when token enters cooling state
- Reset consumed to 0 when quota reaches 0 in default mode (consume())
- Reset consumed to 0 when 429 rate limit is triggered (mark_rate_limited())
- Remove consumed reset on API sync, only restore active status
- This ensures consumed represents 'usage count per cooling cycle'
2026-03-12 08:24:54 +00:00
周辉 91a99b76be fix: initialize SQL storage on first request in serverless runtime
Vercel serverless deployments could start serving requests without reliably executing FastAPI lifespan startup, so config.load() was not always called during cold start. Because SQL schema creation is triggered through storage-backed config/tokens access, PostgreSQL/MySQL tables (for example app_config and tokens) were never initialized even when SERVER_STORAGE_TYPE and SERVER_STORAGE_URL were configured.

Add a minimal lazy-init guard in Config with ensure_loaded(), protected by an asyncio lock and a success flag to keep initialization idempotent under concurrent first requests. Wire this guard into an HTTP middleware so initialization is guaranteed before handling requests, and reuse ensure_loaded() in lifespan to preserve existing startup behavior. This keeps the fix small, safe, and backward-compatible while restoring deterministic DB bootstrapping on Vercel.
2026-03-12 16:16:40 +08:00
Jensen Zhang 3e607e9f7c feat(token): add consumed mode for quota management
- Add 'consumed_mode_enabled' config option (opt-in, default false)
- Track local consumption separately from API quota
- consumed increases in both modes; quota deduction differs by mode
- Prefer tokens with lower consumed amount in pool selection
- UI dynamically switches between 'remaining quota' and 'consumed' display
- Disable quota editing in edit modal when consumed mode is enabled
- Maintain backward compatibility with existing configs
2026-03-12 08:10:42 +00:00
Hzexe a0c83362d9 fix: accurately identify token expiration, resolve log format KeyError, and eliminate stale data on refresh (#308) 2026-03-12 10:42:45 +08:00
Hzexe e1b538c84b fix: accurately identify token expiration vs network issues and skip retries/fallback for expired tokens (#308) 2026-03-12 09:53:31 +08:00
keung67 22b4d14a0a feat: add a proxy pool module. 2026-03-12 01:30:19 +08:00
Fern.N aa922dba98 Merge remote-tracking branch 'upstream/main' into feature/public_asset_after_created 2026-03-08 22:00:25 +07:00
Chenyme 19bfce3167 Merge pull request #299 from chenyme/fix_420
refactor: add grok-4.20-beta new parameter & remove deprecated grok-4-mini model
2026-03-08 12:43:42 +08:00
Chenyme d322c46f04 refactor: remove deprecated GROK-4-MINI model from ModelService and enhance payload logging in AppChatReverse 2026-03-08 12:35:35 +08:00
Fern.N dbf746ca48 feat: Add option to generate public asset links for videos 2026-03-07 16:05:45 +07:00
Chenyme c45b2c6595 Merge pull request #291 from chenyme/fix_extend
feat: fix video generation API and pagination controls
2026-03-07 13:20:04 +08:00
Chenyme 56bbd4ba96 feat: fix video generation API and pagination controls, update configuration for upscale timing, and enhance UI for token management 2026-03-07 13:12:29 +08:00
Chenyme 7ab06be04a Merge pull request #284 from chenyme/sanitization
feat: implement text sanitization for proxy and token configurations, enhancing security and data integrity across API endpoints
2026-03-06 22:40:11 +08:00
Chenyme ee3ddf420c feat: implement text sanitization for proxy and token configurations, enhancing security and data integrity across API endpoints 2026-03-06 22:29:56 +08:00
Chenyme 7b766c0322 chore: update Dockerfile to include server configuration variables and copy the _public directory for improved asset management 2026-03-06 19:28:03 +08:00
Chenyme 7683311758 Merge pull request #280 from chenyme/vercel
fix: Some pages are missing during Vercel deployment.
2026-03-06 18:19:02 +08:00
Chenyme becb23b771 chore: update version to 1.6.0, refactor API routes by renaming modules, and remove deprecated admin and function APIs for improved structure and maintainability 2026-03-06 18:14:21 +08:00
Chenyme 04b7ee481d refactor: replace public API functionality with function API, update configuration and static files accordingly 2026-03-06 17:37:15 +08:00
Chenyme db065659af refactor: rename public directory to _public and remove unused static files to streamline asset management 2026-03-06 16:11:34 +08:00
Chenyme e09d5a4be1 chore: update Python version to 3.13 and configure Vercel functions to include public files for deployment 2026-03-06 15:47:08 +08:00
Chenyme 1b3bcb3b3e refactor: streamline static file management by removing unused CSS and JS files, and enhance admin/public page responses with centralized file handling 2026-03-06 15:25:29 +08:00
Chenyme da979f5a59 fix: refactor static file handling to use a public directory and simplify admin/public page responses with redirects 2026-03-06 15:00:19 +08:00
Chenyme 4217dbed26 feat: implement centralized file response handling for admin and public pages, enhancing error management and code reusability 2026-03-06 14:18:17 +08:00
Chenyme e44f267332 feat: add video generation API with validation for video length and integrate into main application 2026-03-06 11:40:48 +08:00
Chenyme 9fc9ebb4a1 chore: add SERVER_STORAGE_URL environment variable to docker-compose and improve error handling in saveConfig function 2026-03-05 18:06:52 +08:00
Chenyme 8925ca174c chore: update version numbers for CSS and JS files across admin pages and enhance i18n support with aria-labels and new translations 2026-03-05 17:40:23 +08:00
Chenyme 2afefa531b chore: add description to bug report template for clearer issue reporting 2026-03-05 16:54:47 +08:00