mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: AI translation in Database (#5515)
* chore: add tranlate field type * chore: integrate ai translate * chore: integrate client api * chore: implement UI
This commit is contained in:
@ -9,4 +9,5 @@ edition = "2021"
|
||||
lib-infra = { workspace = true }
|
||||
collab-entity = { workspace = true }
|
||||
collab = { workspace = true }
|
||||
anyhow.workspace = true
|
||||
anyhow.workspace = true
|
||||
client-api = { workspace = true }
|
||||
|
@ -1,4 +1,5 @@
|
||||
use anyhow::Error;
|
||||
pub use client_api::entity::ai_dto::{TranslateItem, TranslateRowResponse};
|
||||
use collab::core::collab::DataSource;
|
||||
use collab_entity::CollabType;
|
||||
use lib_infra::future::FutureResult;
|
||||
@ -6,6 +7,7 @@ use std::collections::HashMap;
|
||||
|
||||
pub type CollabDocStateByOid = HashMap<String, DataSource>;
|
||||
pub type SummaryRowContent = HashMap<String, String>;
|
||||
pub type TranslateRowContent = Vec<TranslateItem>;
|
||||
/// A trait for database cloud service.
|
||||
/// Each kind of server should implement this trait. Check out the [AppFlowyServerProvider] of
|
||||
/// [flowy-server] crate for more information.
|
||||
@ -39,6 +41,13 @@ pub trait DatabaseCloudService: Send + Sync {
|
||||
object_id: &str,
|
||||
summary_row: SummaryRowContent,
|
||||
) -> FutureResult<String, Error>;
|
||||
|
||||
fn translate_database_row(
|
||||
&self,
|
||||
workspace_id: &str,
|
||||
translate_row: TranslateRowContent,
|
||||
language: &str,
|
||||
) -> FutureResult<TranslateRowResponse, Error>;
|
||||
}
|
||||
|
||||
pub struct DatabaseSnapshot {
|
||||
|
Reference in New Issue
Block a user