agy تنها ارائه‌دهندهٔ مدل؛ حذف بخش ارائه‌دهنده‌ها و افزودن زنجیرهٔ انتخاب مدل

- حذف کامل providerهای mock و openai_compatible: دامنه، آداپوترها، رجیستری، کانفیگ، seed و رابطٔ مدیریت
- بخش «ارائه‌دهنده‌ها» از کنسول حذف شد؛ ورود اکانت‌ها فقط از صفحهٔ اکانت‌های agy
- صفحهٔ مدل‌ها بازطراحی شد: ارائه‌دهنده → اکانت → مدل (کاتالوگ لحظه‌ای و زندهٔ همان اکانت از Google) → افورت استدلال؛ بدون هیچ ورود دستی نام مدل
- مدل‌ها ستون reasoning_effort گرفتند؛ آداپتور آن را به thinkingConfig (بودجهٔ ۱۰۲۴ تا ۳۲۷۶۸) ترجمه می‌کند و فقط به مدل‌های استدلالی می‌فرستد
- مهاجرت c2d3e4f5b6a7: افزودن reasoning_effort و حذف ردیف‌های providerهای قدیمی
- تست‌ها: ۲۴۶ تست بک‌اند و ۵۱ تست فرانت سبز؛ ruff و mypy و tsc و eslint تمیز
This commit is contained in:
mjalmoudy94
2026-10-13 10:01:11 +03:30
parent a2284db4f4
commit da5a2a5d1a
29 changed files with 906 additions and 995 deletions
@@ -0,0 +1,62 @@
"""agy becomes the only model provider; models gain a reasoning effort
Two changes locked in together:
1. ``ai_models`` gains ``reasoning_effort`` (the agy thinking-budget selector
the admin console sets per model). NOT NULL with an empty-string default so
existing rows backfill to "provider default" without a rewrite.
2. Every provider row that is not ``agy`` — and the models and credentials that
hang off it — is deleted. agy is the only provider the platform talks to;
a leftover ``mock``/``openai_compatible`` provider would keep dead rows
selectable by ``pick_for_mode`` and confuse the console.
The seed reconciles this on every run, so a database that was already re-seeded
finds nothing left to do here.
Revision ID: c2d3e4f5b6a7
Revises: b1c2d3e4f5a6
Create Date: 2026-10-13 09:05:00.000000
"""
from __future__ import annotations
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
revision: str = "c2d3e4f5b6a7"
down_revision: str | None = "b1c2d3e4f5a6"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
def upgrade() -> None:
op.add_column(
"ai_models",
sa.Column(
"reasoning_effort",
sa.String(length=16),
nullable=False,
server_default="",
),
)
# Children first: the FKs carry ON DELETE CASCADE, but spelling the deletes
# out keeps the intent readable and works on every backend/driver combo
# Alembic supports (including SQLite without PRAGMA introspection).
op.execute(
"DELETE FROM ai_models WHERE provider_id IN "
"(SELECT id FROM ai_providers WHERE type <> 'agy')"
)
op.execute(
"DELETE FROM ai_model_credentials WHERE provider_id IN "
"(SELECT id FROM ai_providers WHERE type <> 'agy')"
)
op.execute("DELETE FROM ai_providers WHERE type <> 'agy'")
def downgrade() -> None:
# The deleted rows are unrecoverable by design: their content was mock
# fixtures and API keys the operator would have had to paste again.
op.drop_column("ai_models", "reasoning_effort")