feat:移除了弹窗,服务器添加sls
This commit is contained in:
commit
6a295f9a7a
4082 files changed
+1322534
No files matched your search
@@ -0,0 +1,55 @@
|
||||
use crate::api::Result;
|
||||
use theseus::google_ip;
|
||||
use theseus::translation::{
|
||||
self, TranslationProvider, TranslationRequest, TranslationResponse,
|
||||
TranslationSettings,
|
||||
};
|
||||
|
||||
pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
|
||||
tauri::plugin::Builder::new("translation")
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
translation_get_settings,
|
||||
translation_update_settings,
|
||||
translation_test_provider,
|
||||
translation_translate,
|
||||
translation_clear_cache,
|
||||
translation_google_ip_pool_size,
|
||||
])
|
||||
.build()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn translation_get_settings() -> Result<TranslationSettings> {
|
||||
Ok(translation::get_settings().await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn translation_update_settings(
|
||||
settings: TranslationSettings,
|
||||
) -> Result<()> {
|
||||
Ok(translation::update_settings(settings).await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn translation_test_provider(
|
||||
provider: TranslationProvider,
|
||||
) -> Result<String> {
|
||||
Ok(translation::test_provider(provider).await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn translation_translate(
|
||||
request: TranslationRequest,
|
||||
) -> Result<TranslationResponse> {
|
||||
Ok(translation::translate(request).await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn translation_clear_cache() -> Result<()> {
|
||||
Ok(translation::clear_cache().await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn translation_google_ip_pool_size() -> usize {
|
||||
google_ip::ip_pool_size().await
|
||||
}
|
||||
Reference in new issue
Block a user