mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-23 09:01:21 +00:00

* chore: move to latest appflowy collab version * chore: filter mapping * chore: remove mutex folder * chore: cleanup borrow checker issues * chore: fixed flowy user crate compilation errors * chore: removed parking lot crate * chore: adjusting non locking approach * chore: remove with folder method * chore: fix folder manager * chore: fixed workspace database compilation errors * chore: initialize database plugins * chore: fix locks in flowy core * chore: remove supabase * chore: async traits * chore: add mutexes in dart ffi * chore: post rebase fixes * chore: remove supabase dart code * chore: fix deadlock * chore: fix page_id is empty * chore: use data source to init collab * chore: fix user awareness test * chore: fix database deadlock * fix: initialize user awareness * chore: fix open workspace test * chore: fix import csv * chore: fix update row meta deadlock * chore: fix document size test * fix: timestamp set/get type convert * fix: calculation * chore: revert Arc to Rc * chore: attach plugin to database and database row * chore: async get row * chore: clippy * chore: fix tauri build * chore: clippy * fix: duplicate view deadlock * chore: fmt * chore: tauri build --------- Co-authored-by: nathan <nathan@appflowy.io>
70 lines
1.8 KiB
Rust
70 lines
1.8 KiB
Rust
use anyhow::Error;
|
|
pub use client_api::entity::ai_dto::{TranslateItem, TranslateRowResponse};
|
|
use collab::entity::EncodedCollab;
|
|
use collab_entity::CollabType;
|
|
use flowy_error::FlowyError;
|
|
use lib_infra::async_trait::async_trait;
|
|
use std::collections::HashMap;
|
|
|
|
pub type EncodeCollabByOid = HashMap<String, EncodedCollab>;
|
|
pub type SummaryRowContent = HashMap<String, String>;
|
|
pub type TranslateRowContent = Vec<TranslateItem>;
|
|
|
|
#[async_trait]
|
|
pub trait DatabaseAIService: Send + Sync {
|
|
async fn summary_database_row(
|
|
&self,
|
|
_workspace_id: &str,
|
|
_object_id: &str,
|
|
_summary_row: SummaryRowContent,
|
|
) -> Result<String, FlowyError> {
|
|
Ok("".to_string())
|
|
}
|
|
|
|
async fn translate_database_row(
|
|
&self,
|
|
_workspace_id: &str,
|
|
_translate_row: TranslateRowContent,
|
|
_language: &str,
|
|
) -> Result<TranslateRowResponse, FlowyError> {
|
|
Ok(TranslateRowResponse::default())
|
|
}
|
|
}
|
|
|
|
/// 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.
|
|
///
|
|
/// returns the doc state of the object with the given object_id.
|
|
/// None if the object is not found.
|
|
///
|
|
#[async_trait]
|
|
pub trait DatabaseCloudService: Send + Sync {
|
|
async fn get_database_encode_collab(
|
|
&self,
|
|
object_id: &str,
|
|
collab_type: CollabType,
|
|
workspace_id: &str,
|
|
) -> Result<Option<EncodedCollab>, Error>;
|
|
|
|
async fn batch_get_database_encode_collab(
|
|
&self,
|
|
object_ids: Vec<String>,
|
|
object_ty: CollabType,
|
|
workspace_id: &str,
|
|
) -> Result<EncodeCollabByOid, Error>;
|
|
|
|
async fn get_database_collab_object_snapshots(
|
|
&self,
|
|
object_id: &str,
|
|
limit: usize,
|
|
) -> Result<Vec<DatabaseSnapshot>, Error>;
|
|
}
|
|
|
|
pub struct DatabaseSnapshot {
|
|
pub snapshot_id: i64,
|
|
pub database_id: String,
|
|
pub data: Vec<u8>,
|
|
pub created_at: i64,
|
|
}
|