style: auto-format with black + isort + ruff + prettier [skip ci-format-check]
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 1s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 57s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 1m12s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m56s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m56s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 5m8s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Failing after 5m32s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 5m51s
AI Code Review / AI Code Review (pull_request) Successful in 6m36s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 11m56s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 12m47s
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) Failing after 1s
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 10m8s

This commit is contained in:
CI Bot
2026-10-06 08:59:33 +00:00
parent c025b8b6ac
commit 782c4b150d
@@ -10,6 +10,7 @@
"""
import sqlalchemy as sa
from alembic import op
revision = "100_fix_capability_model_bindings"
@@ -22,15 +23,11 @@ def upgrade() -> None:
conn = op.get_bind()
# 检查表是否存在
table_check = conn.execute(
sa.text("SELECT to_regclass(\public.ai_models\)")
).scalar()
table_check = conn.execute(sa.text("SELECT to_regclass(\public.ai_models\)")).scalar()
if not table_check:
return
config_table_check = conn.execute(
sa.text("SELECT to_regclass(\public.ai_capability_configs\)")
).scalar()
config_table_check = conn.execute(sa.text("SELECT to_regclass(\public.ai_capability_configs\)")).scalar()
if not config_table_check:
return
@@ -46,9 +43,7 @@ def upgrade() -> None:
# 查询旧模型 ID
old_model_row = conn.execute(
sa.text(
"SELECT id FROM ai_models WHERE model_key = \doubao-seed-1-6-250615\ LIMIT 1"
)
sa.text("SELECT id FROM ai_models WHERE model_key = \doubao-seed-1-6-250615\ LIMIT 1")
).first()
old_model_id = old_model_row[0] if old_model_row else None
@@ -71,14 +66,10 @@ def upgrade() -> None:
# 更新 image_analysis
qwen38_row = conn.execute(
sa.text(
"SELECT id FROM ai_models WHERE model_key = \qwen3.8-flash\ AND deleted_at IS NULL LIMIT 1"
)
sa.text("SELECT id FROM ai_models WHERE model_key = \qwen3.8-flash\ AND deleted_at IS NULL LIMIT 1")
).first()
qwen37_row = conn.execute(
sa.text(
"SELECT id FROM ai_models WHERE model_key = \qwen3.7-plus\ AND deleted_at IS NULL LIMIT 1"
)
sa.text("SELECT id FROM ai_models WHERE model_key = \qwen3.7-plus\ AND deleted_at IS NULL LIMIT 1")
).first()
if qwen38_row and qwen37_row:
@@ -106,25 +97,19 @@ def upgrade() -> None:
set_clause += ", updated_at = NOW()"
updates["cap_key"] = "image_analysis"
conn.execute(
sa.text(
f"UPDATE ai_capability_configs SET {set_clause} WHERE capability_key = :cap_key"
),
sa.text(f"UPDATE ai_capability_configs SET {set_clause} WHERE capability_key = :cap_key"),
updates,
)
def downgrade() -> None:
conn = op.get_bind()
table_check = conn.execute(
sa.text("SELECT to_regclass(\public.ai_models\)")
).scalar()
table_check = conn.execute(sa.text("SELECT to_regclass(\public.ai_models\)")).scalar()
if not table_check:
return
old_model_row = conn.execute(
sa.text(
"SELECT id FROM ai_models WHERE model_key = \doubao-seed-1-6-250615\ LIMIT 1"
)
sa.text("SELECT id FROM ai_models WHERE model_key = \doubao-seed-1-6-250615\ LIMIT 1")
).first()
if not old_model_row:
return