All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 3m36s
Pricing: full editorial redesign — serif card headers with accent pills
replace the colored font-black blocks, tone sweep across toggle/metrics/
features/CTAs, PLAN_COLORS removed; one design system app-wide.
Translate: decorative titles one step down (CTA hierarchy restored);
glossary and image-translation blocks hidden entirely for free users
(progressive disclosure — three controls for free).
Reviews: XLIFF hint line explains the exchange format; backend errors
routed through a friendly mapper (session/not-found/rate-limit/server).
Landing: fabricated hero UI cards (fake 'Context Engine' overlay)
removed — the photo no longer promises screens that don't exist.
Nav: single DashboardNavLinks component shared by sidebar and mobile
drawer (was duplicated markup).
API: GET /api/v1/translations (user job history, paginated; completed
jobs retained 24h) and POST /api/v1/translations/{id}/cancel —
cooperative cancellation with worker checkpoints before dispatch and
before finalisation, reserved quota released immediately. Translate
monitor now offers a real 'Cancel translation' next to 'Back to start';
recent-jobs list reads server history first, localStorage fallback.
DeepL purge (backend): provider module, registry registration, config
attrs/defaults, dispatch branch, admin settings schema + test branch,
legacy availability block, validation rules, plan provider lists,
error-code mappings, MCP enums, translator prompt mention, related
tests updated/removed. Fallback resolver skips unknown providers, so
stale chains containing 'deepl' degrade gracefully.
Verified: backend 110 tests passed; frontend build exit 0, vitest 9/9,
0 missing i18n keys, eslint 63 errors (vs 64 at HEAD).
82 lines
2.3 KiB
Python
82 lines
2.3 KiB
Python
"""
|
|
Translation Providers Package.
|
|
|
|
This package provides a pluggable architecture for translation providers
|
|
with a registry for easy access and fallback support.
|
|
|
|
Usage:
|
|
from services.providers import TranslationProvider, registry
|
|
from services.providers.schemas import TranslationRequest, TranslationResponse
|
|
|
|
# Get a provider (Google is auto-registered)
|
|
google_provider = registry.get("google")
|
|
|
|
# Translate text
|
|
request = TranslationRequest(text="Hello", target_language="fr")
|
|
response = google_provider.translate_text(request)
|
|
|
|
# Use fallback chain
|
|
provider = registry.get_first_available(["google", "openai"])
|
|
"""
|
|
|
|
from .base import TranslationProvider
|
|
from .schemas import (
|
|
TranslationRequest,
|
|
TranslationResponse,
|
|
BatchTranslationRequest,
|
|
BatchTranslationResponse,
|
|
ProviderHealthStatus,
|
|
)
|
|
from .registry import ProviderRegistry, registry, get_registry
|
|
|
|
__all__ = [
|
|
"TranslationProvider",
|
|
"TranslationRequest",
|
|
"TranslationResponse",
|
|
"BatchTranslationRequest",
|
|
"BatchTranslationResponse",
|
|
"ProviderHealthStatus",
|
|
"ProviderRegistry",
|
|
"registry",
|
|
"get_registry",
|
|
"translate_with_fallback",
|
|
"translate_with_fallback_by_mode",
|
|
"AllProvidersFailedError",
|
|
"ALL_PROVIDERS_FAILED",
|
|
]
|
|
|
|
|
|
def _auto_register_providers() -> None:
|
|
"""Auto-register available providers on module import."""
|
|
from .google_provider import register_google_provider
|
|
from .config import ProvidersConfig
|
|
|
|
if ProvidersConfig.GOOGLE_ENABLED:
|
|
register_google_provider()
|
|
|
|
if ProvidersConfig.OPENAI_ENABLED and ProvidersConfig.OPENAI_API_KEY:
|
|
from .openai_provider import register_openai_provider
|
|
|
|
register_openai_provider()
|
|
|
|
if ProvidersConfig.DEEPSEEK_ENABLED and ProvidersConfig.DEEPSEEK_API_KEY:
|
|
from .deepseek_provider import register_deepseek_provider
|
|
|
|
register_deepseek_provider()
|
|
|
|
if ProvidersConfig.MINIMAX_ENABLED and ProvidersConfig.MINIMAX_API_KEY:
|
|
from .minimax_provider import register_minimax_provider
|
|
|
|
register_minimax_provider()
|
|
|
|
|
|
_auto_register_providers()
|
|
|
|
# Import fallback functions for easy access
|
|
from .fallback import (
|
|
translate_with_fallback,
|
|
translate_with_fallback_by_mode,
|
|
AllProvidersFailedError,
|
|
ALL_PROVIDERS_FAILED,
|
|
)
|