-
-
Notifications
You must be signed in to change notification settings - Fork 181
fix bugs #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fix bugs #207
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
685f2ba
fix: 修复使用记录时间筛选的时区问题
ding113 be65359
fix: 修复 TagInput 组件输入值在失焦时未保存的问题
ding113 ef23498
Update error-rules.ts
ding113 2ab9f62
chore: format code (dev-ef23498)
github-actions[bot] c171c15
ci: trigger CI after format fix
github-actions[bot] dbb7ac5
feat: 添加计费模型来源配置功能
ding113 7458e53
chore: format code (dev-dbb7ac5)
github-actions[bot] e7fadfb
fix: 恢复被误删的迁移文件,修复迁移链一致性
ding113 02dcbe2
fix: 修正 0025_hard_violations 迁移的时间戳顺序
ding113 eb92b9e
fix: 修复数据库迁移冲突,合并 0020-0025 为单一幂等迁移
ding113 97108df
fix: 修正 0025_hard_violations 迁移的时间戳顺序
ding113 edad194
fix: 修复模型重定向显示问题并简化 UI
ding113 7a006d9
fix: 修复供应商统计归属问题(重试切换后统计错误)
ding113 8f3c2a6
fix: count_tokens 端点错误不计入熔断、不触发供应商切换
ding113 4176a24
fix: 修复模型重定向 i18n 翻译键路径错误
ding113 a0336c0
fix: 优化模型重定向指示器,改为只显示图标
ding113 83d7cf6
chore: 修复 ESLint 警告
ding113 72b077d
fix: 修复模型重定向在供应商切换时未重置的问题
ding113 2c58dc3
fix: 优化 cache_control 错误规则正则以匹配 Anthropic API 格式
ding113 2b49a71
fix: 补充迁移文件中缺失的 limit_daily_usd 和 daily_reset_time 字段
ding113 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| -- 幂等迁移: 合并 0020-0025 的所有变更 | ||
| -- 此迁移可以在任何状态下安全执行(新安装、从 0019 升级、从冲突版本升级) | ||
|
|
||
| -- Step 0: 清理冲突的旧迁移记录(一次性,仅影响从冲突版本升级的用户) | ||
| DELETE FROM drizzle.__drizzle_migrations WHERE hash IN ( | ||
| '0020_next_juggernaut', | ||
| '0021_daily_cost_limits', | ||
| '0022_simple_stardust', | ||
| '0023_cheerful_shocker', | ||
| '0023_safe_christian_walker', | ||
| '0024_update_provider_timeout_defaults', | ||
| '0025_hard_violations' | ||
| ); | ||
| --> statement-breakpoint | ||
|
|
||
| -- Step 1: 创建枚举类型(幂等) | ||
| DO $$ BEGIN | ||
| CREATE TYPE "public"."daily_reset_mode" AS ENUM('fixed', 'rolling'); | ||
| EXCEPTION | ||
| WHEN duplicate_object THEN null; | ||
| END $$; | ||
| --> statement-breakpoint | ||
|
|
||
| -- Step 2: 更新 providers 表默认值(幂等,无条件安全) | ||
| ALTER TABLE "providers" ALTER COLUMN "first_byte_timeout_streaming_ms" SET DEFAULT 0;--> statement-breakpoint | ||
| ALTER TABLE "providers" ALTER COLUMN "streaming_idle_timeout_ms" SET DEFAULT 0;--> statement-breakpoint | ||
| ALTER TABLE "providers" ALTER COLUMN "request_timeout_non_streaming_ms" SET DEFAULT 0;--> statement-breakpoint | ||
|
|
||
| -- Step 3: 添加 keys 表字段(幂等) | ||
| ALTER TABLE "keys" ADD COLUMN IF NOT EXISTS "daily_reset_mode" "daily_reset_mode" DEFAULT 'fixed' NOT NULL;--> statement-breakpoint | ||
| ALTER TABLE "keys" ADD COLUMN IF NOT EXISTS "limit_daily_usd" numeric(10, 2);--> statement-breakpoint | ||
| ALTER TABLE "keys" ADD COLUMN IF NOT EXISTS "daily_reset_time" varchar(5) DEFAULT '00:00' NOT NULL;--> statement-breakpoint | ||
|
|
||
| -- Step 4: 添加 providers 表字段(幂等) | ||
| ALTER TABLE "providers" ADD COLUMN IF NOT EXISTS "mcp_passthrough_type" varchar(20) DEFAULT 'none' NOT NULL;--> statement-breakpoint | ||
| ALTER TABLE "providers" ADD COLUMN IF NOT EXISTS "mcp_passthrough_url" varchar(512);--> statement-breakpoint | ||
| ALTER TABLE "providers" ADD COLUMN IF NOT EXISTS "daily_reset_mode" "daily_reset_mode" DEFAULT 'fixed' NOT NULL;--> statement-breakpoint | ||
| ALTER TABLE "providers" ADD COLUMN IF NOT EXISTS "limit_daily_usd" numeric(10, 2);--> statement-breakpoint | ||
| ALTER TABLE "providers" ADD COLUMN IF NOT EXISTS "daily_reset_time" varchar(5) DEFAULT '00:00' NOT NULL;--> statement-breakpoint | ||
|
|
||
| -- Step 5: 添加 system_settings 表字段(幂等) | ||
| ALTER TABLE "system_settings" ADD COLUMN IF NOT EXISTS "billing_model_source" varchar(20) DEFAULT 'original' NOT NULL;--> statement-breakpoint | ||
|
|
||
| -- Step 6: 添加 users 表字段(幂等) | ||
| ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "limit_5h_usd" numeric(10, 2);--> statement-breakpoint | ||
| ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "limit_weekly_usd" numeric(10, 2);--> statement-breakpoint | ||
| ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "limit_monthly_usd" numeric(10, 2);--> statement-breakpoint | ||
| ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "limit_concurrent_sessions" integer; | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Critical: Missing
billing_model_sourcecolumn in migrationWhy this is a problem: The schema at
src/drizzle/schema.tsaddsbillingModelSourcecolumn tosystem_settingstable, and the repository code (src/repository/system-config.ts) queries this field. However, this migration file does not add this column. This will cause database errors for users running this migration:SELECT ... billing_model_source ...will fail with "column does not exist"INSERTstatements including this field will failSuggested fix: Add this line after Step 5 in the migration: