feat: unify multimodels translation providers, remove self-hosting (Ollama/LibreTranslate), and fix local SQLite configuration
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m21s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m21s
This commit is contained in:
@@ -73,6 +73,24 @@ class TranslationProvider(ABC):
|
||||
"""
|
||||
return [self.translate_text(req) for req in requests]
|
||||
|
||||
def translate(
|
||||
self, text: str, target_language: str, source_language: str = "auto"
|
||||
) -> str:
|
||||
"""
|
||||
Compatibility method for the legacy interface.
|
||||
Translates a single text string synchronously.
|
||||
"""
|
||||
req = TranslationRequest(
|
||||
text=text,
|
||||
target_language=target_language,
|
||||
source_language=source_language,
|
||||
)
|
||||
resp = self.translate_text(req)
|
||||
if resp.error:
|
||||
raise Exception(f"[{resp.error_code or 'UNKNOWN'}] {resp.error}")
|
||||
return resp.translated_text
|
||||
|
||||
|
||||
def health_check(self) -> ProviderHealthStatus:
|
||||
"""
|
||||
Return health status details for the provider.
|
||||
|
||||
Reference in New Issue
Block a user