AiTranslationManager
struct · ferroui-protranslate-studio · v0.5.0
struct AiTranslationManager
Stable provider ordering matches the source manager. Errors never trigger paid retries.
Members
newconfigureapply_settingsprovidersconfigured_providersconfigurationtranslate_with_providertranslate_with_best_availabletranslate_singletest_connectiontranslate_batcheslist_modelscompatibility_model_list
new
fn new(transport: Rc<dyn AiTransport>) -> Self
configure
fn configure(self: &mut Self, configuration: AiProviderConfig) -> Result<(), StudioError>
apply_settings
fn apply_settings(self: &mut Self, configurations: &[AiProviderConfig]) -> Result<(), StudioError>
Validate the entire update before replacing any configuration.
providers
fn providers(self: &Self) -> &[AiProvider; 3]
configured_providers
fn configured_providers(self: &Self) -> Vec<AiProvider>
configuration
fn configuration(self: &Self, provider: AiProvider) -> &AiProviderConfig
translate_with_provider
async fn translate_with_provider(self: &Self, provider: AiProvider, request: &AiTranslationRequest, cancellation: &CancellationToken) -> Result<AiTranslationResult, StudioError>
translate_with_best_available
async fn translate_with_best_available(self: &Self, request: &AiTranslationRequest, cancellation: &CancellationToken) -> Result<AiTranslationResult, StudioError>
translate_single
async fn translate_single(self: &Self, provider: AiProvider, source_text: &str, source_language: &str, target_language: &str, context: &str, cancellation: &CancellationToken) -> Result<String, StudioError>
test_connection
async fn test_connection(self: &Self, provider: AiProvider, cancellation: &CancellationToken) -> Result<bool, StudioError>
translate_batches
async fn translate_batches(self: &Self, provider: AiProvider, request: &AiTranslationRequest, batch_size: usize, cancellation: &CancellationToken, progress: &mut dyn FnMut(AiBatchProgress, &AiTranslationResult) -> ()) -> Result<AiBatchResult, StudioError>
list_models
async fn list_models(self: &Self, provider: AiProvider, cancellation: &CancellationToken) -> Result<AiModelList, StudioError>
Discover current models without requiring a model selection. Failed or incomplete discovery is an error; an empty successful listing remains empty.
compatibility_model_list
fn compatibility_model_list(provider: AiProvider) -> AiModelList
Explicit access to the original application's historical model list. This performs no discovery, implies no availability, and changes no configuration.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEither
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.