From 9cbae5cf60d7a1fef4a1e1a8fcdaf2c56cc38885 Mon Sep 17 00:00:00 2001 From: CI Bot Date: Tue, 6 Oct 2026 08:50:02 +0000 Subject: [PATCH] style: auto-format with black + isort + ruff + prettier [skip ci-format-check] --- .../100_fix_capability_model_bindings.py | 33 +++++-------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/alembic/versions/100_fix_capability_model_bindings.py b/alembic/versions/100_fix_capability_model_bindings.py index b82fc8fc4..29be5f7ad 100644 --- a/alembic/versions/100_fix_capability_model_bindings.py +++ b/alembic/versions/100_fix_capability_model_bindings.py @@ -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