agy تنها ارائهدهندهٔ مدل؛ حذف بخش ارائهدهندهها و افزودن زنجیرهٔ انتخاب مدل
- حذف کامل providerهای mock و openai_compatible: دامنه، آداپوترها، رجیستری، کانفیگ، seed و رابطٔ مدیریت - بخش «ارائهدهندهها» از کنسول حذف شد؛ ورود اکانتها فقط از صفحهٔ اکانتهای agy - صفحهٔ مدلها بازطراحی شد: ارائهدهنده → اکانت → مدل (کاتالوگ لحظهای و زندهٔ همان اکانت از Google) → افورت استدلال؛ بدون هیچ ورود دستی نام مدل - مدلها ستون reasoning_effort گرفتند؛ آداپتور آن را به thinkingConfig (بودجهٔ ۱۰۲۴ تا ۳۲۷۶۸) ترجمه میکند و فقط به مدلهای استدلالی میفرستد - مهاجرت c2d3e4f5b6a7: افزودن reasoning_effort و حذف ردیفهای providerهای قدیمی - تستها: ۲۴۶ تست بکاند و ۵۱ تست فرانت سبز؛ ruff و mypy و tsc و eslint تمیز
This commit is contained in:
@@ -110,7 +110,7 @@ class AgyTestOut(BaseModel):
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
async def _ensure_agy_provider(repo: ProviderRepository):
|
||||
async def ensure_agy_provider(repo: ProviderRepository):
|
||||
provider = await repo.get_by_name(AGY_PROVIDER_NAME)
|
||||
if provider is not None:
|
||||
return provider
|
||||
@@ -176,7 +176,7 @@ async def complete_agy_login(
|
||||
|
||||
providers = ProviderRepository(session)
|
||||
credentials = ModelCredentialRepository(session)
|
||||
provider = await _ensure_agy_provider(providers)
|
||||
provider = await ensure_agy_provider(providers)
|
||||
|
||||
envelope = json.dumps(
|
||||
{
|
||||
@@ -331,13 +331,29 @@ async def test_agy_account(
|
||||
)
|
||||
|
||||
|
||||
@router.get("/models", response_model=list[str])
|
||||
async def list_agy_models() -> list[str]:
|
||||
"""Model ids the logged-in agy subscription exposes (registry helper)."""
|
||||
from app.infrastructure.adapters.registry import get_model_provider
|
||||
@router.get("/accounts/{credential_id}/models", response_model=list[str])
|
||||
async def list_account_models(
|
||||
credential_id: str,
|
||||
session: AsyncSession = Depends(get_session),
|
||||
) -> list[str]:
|
||||
"""Live model catalog of one account — fetched from Google on every call.
|
||||
|
||||
provider = get_model_provider()
|
||||
lister = getattr(provider, "available_models", None)
|
||||
if lister is None:
|
||||
return []
|
||||
return await lister()
|
||||
The admin console calls this when an account is selected, so the model
|
||||
list always reflects that subscription's current entitlement instead of a
|
||||
cached snapshot.
|
||||
"""
|
||||
from app.core.errors import ValidationError
|
||||
from app.infrastructure.adapters.agy import AgyModelAdapter
|
||||
|
||||
repo = ModelCredentialRepository(session)
|
||||
credential = await repo.get(credential_id)
|
||||
if credential is None:
|
||||
raise NotFoundError("اکانت agy یافت نشد.")
|
||||
|
||||
adapter = AgyModelAdapter() # stateless: one forced account
|
||||
try:
|
||||
return await adapter.available_models_for(credential)
|
||||
except ValidationError:
|
||||
raise
|
||||
except Exception as exc: # noqa: BLE001 - the console wants the reason
|
||||
raise ValidationError(str(exc)) from exc
|
||||
|
||||
Reference in New Issue
Block a user