mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-24 06:37:14 -04:00
chore: clippy
This commit is contained in:
parent
4e75dbe16a
commit
de1577128e
32 changed files with 181 additions and 184 deletions
|
@ -56,7 +56,7 @@ pub fn batch_select_collab_metadata(
|
|||
.filter(af_collab_metadata::object_id.eq_any(&object_ids))
|
||||
.load::<AFCollabMetadata>(&mut conn)?
|
||||
.into_iter()
|
||||
.flat_map(|m| Uuid::from_str(&m.object_id).and_then(|v| Ok((v, m))))
|
||||
.flat_map(|m| Uuid::from_str(&m.object_id).map(|v| (v, m)))
|
||||
.collect();
|
||||
Ok(metadata)
|
||||
}
|
||||
|
|
|
@ -135,10 +135,10 @@ impl AIManager {
|
|||
}
|
||||
|
||||
pub async fn open_chat(&self, chat_id: &Uuid) -> Result<(), FlowyError> {
|
||||
self.chats.entry(chat_id.clone()).or_insert_with(|| {
|
||||
self.chats.entry(*chat_id).or_insert_with(|| {
|
||||
Arc::new(Chat::new(
|
||||
self.user_service.user_id().unwrap(),
|
||||
chat_id.clone(),
|
||||
*chat_id,
|
||||
self.user_service.clone(),
|
||||
self.cloud_service_wm.clone(),
|
||||
))
|
||||
|
@ -152,7 +152,7 @@ impl AIManager {
|
|||
let cloud_service_wm = self.cloud_service_wm.clone();
|
||||
let store_preferences = self.store_preferences.clone();
|
||||
let external_service = self.external_service.clone();
|
||||
let chat_id = chat_id.clone();
|
||||
let chat_id = *chat_id;
|
||||
tokio::spawn(async move {
|
||||
match refresh_chat_setting(
|
||||
&user_service,
|
||||
|
@ -238,11 +238,11 @@ impl AIManager {
|
|||
|
||||
let chat = Arc::new(Chat::new(
|
||||
self.user_service.user_id()?,
|
||||
chat_id.clone(),
|
||||
*chat_id,
|
||||
self.user_service.clone(),
|
||||
self.cloud_service_wm.clone(),
|
||||
));
|
||||
self.chats.insert(chat_id.clone(), chat.clone());
|
||||
self.chats.insert(*chat_id, chat.clone());
|
||||
Ok(chat)
|
||||
}
|
||||
|
||||
|
@ -533,11 +533,11 @@ impl AIManager {
|
|||
None => {
|
||||
let chat = Arc::new(Chat::new(
|
||||
self.user_service.user_id()?,
|
||||
chat_id.clone(),
|
||||
*chat_id,
|
||||
self.user_service.clone(),
|
||||
self.cloud_service_wm.clone(),
|
||||
));
|
||||
self.chats.insert(chat_id.clone(), chat.clone());
|
||||
self.chats.insert(*chat_id, chat.clone());
|
||||
Ok(chat)
|
||||
},
|
||||
Some(chat) => Ok(chat),
|
||||
|
@ -739,18 +739,15 @@ async fn refresh_chat_setting(
|
|||
error!("failed to set chat settings: {}", err);
|
||||
}
|
||||
|
||||
chat_notification_builder(
|
||||
&chat_id.to_string(),
|
||||
ChatNotification::DidUpdateChatSettings,
|
||||
)
|
||||
.payload(ChatSettingsPB {
|
||||
rag_ids: settings.rag_ids.clone(),
|
||||
})
|
||||
.send();
|
||||
chat_notification_builder(chat_id.to_string(), ChatNotification::DidUpdateChatSettings)
|
||||
.payload(ChatSettingsPB {
|
||||
rag_ids: settings.rag_ids.clone(),
|
||||
})
|
||||
.send();
|
||||
|
||||
Ok(settings)
|
||||
}
|
||||
|
||||
fn setting_store_key(chat_id: &Uuid) -> String {
|
||||
format!("chat_settings_{}", chat_id.to_string())
|
||||
format!("chat_settings_{}", chat_id)
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ impl Chat {
|
|||
ai_model: Option<AIModel>,
|
||||
) {
|
||||
let stop_stream = self.stop_stream.clone();
|
||||
let chat_id = self.chat_id.clone();
|
||||
let chat_id = self.chat_id;
|
||||
let cloud_service = self.chat_service.clone();
|
||||
let user_service = self.user_service.clone();
|
||||
tokio::spawn(async move {
|
||||
|
@ -258,7 +258,7 @@ impl Chat {
|
|||
chat_id: chat_id.to_string(),
|
||||
error_message: err.to_string(),
|
||||
};
|
||||
chat_notification_builder(&chat_id, ChatNotification::StreamChatMessageError)
|
||||
chat_notification_builder(chat_id, ChatNotification::StreamChatMessageError)
|
||||
.payload(pb)
|
||||
.send();
|
||||
return Err(err);
|
||||
|
@ -297,14 +297,14 @@ impl Chat {
|
|||
chat_id: chat_id.to_string(),
|
||||
error_message: err.to_string(),
|
||||
};
|
||||
chat_notification_builder(&chat_id, ChatNotification::StreamChatMessageError)
|
||||
chat_notification_builder(chat_id, ChatNotification::StreamChatMessageError)
|
||||
.payload(pb)
|
||||
.send();
|
||||
return Err(err);
|
||||
},
|
||||
}
|
||||
|
||||
chat_notification_builder(&chat_id, ChatNotification::FinishStreaming).send();
|
||||
chat_notification_builder(chat_id, ChatNotification::FinishStreaming).send();
|
||||
trace!("[Chat] finish streaming");
|
||||
|
||||
if answer_stream_buffer.lock().await.is_empty() {
|
||||
|
@ -360,7 +360,7 @@ impl Chat {
|
|||
has_more: true,
|
||||
total: 0,
|
||||
};
|
||||
chat_notification_builder(&self.chat_id, ChatNotification::DidLoadPrevChatMessage)
|
||||
chat_notification_builder(self.chat_id, ChatNotification::DidLoadPrevChatMessage)
|
||||
.payload(pb.clone())
|
||||
.send();
|
||||
return Ok(pb);
|
||||
|
@ -433,7 +433,7 @@ impl Chat {
|
|||
after_message_id
|
||||
);
|
||||
let workspace_id = self.user_service.workspace_id()?;
|
||||
let chat_id = self.chat_id.clone();
|
||||
let chat_id = self.chat_id;
|
||||
let cloud_service = self.chat_service.clone();
|
||||
let user_service = self.user_service.clone();
|
||||
let uid = self.uid;
|
||||
|
@ -481,11 +481,11 @@ impl Chat {
|
|||
} else {
|
||||
*prev_message_state.write().await = PrevMessageState::NoMore;
|
||||
}
|
||||
chat_notification_builder(&chat_id, ChatNotification::DidLoadPrevChatMessage)
|
||||
chat_notification_builder(chat_id, ChatNotification::DidLoadPrevChatMessage)
|
||||
.payload(pb)
|
||||
.send();
|
||||
} else {
|
||||
chat_notification_builder(&chat_id, ChatNotification::DidLoadLatestChatMessage)
|
||||
chat_notification_builder(chat_id, ChatNotification::DidLoadLatestChatMessage)
|
||||
.payload(pb)
|
||||
.send();
|
||||
}
|
||||
|
@ -511,7 +511,7 @@ impl Chat {
|
|||
}
|
||||
|
||||
let workspace_id = self.user_service.workspace_id()?;
|
||||
let chat_id = self.chat_id.clone();
|
||||
let chat_id = self.chat_id;
|
||||
let cloud_service = self.chat_service.clone();
|
||||
|
||||
let question = cloud_service
|
||||
|
|
|
@ -130,7 +130,7 @@ impl CompletionTask {
|
|||
completion_type: Some(complete_type),
|
||||
metadata: Some(CompletionMetadata {
|
||||
object_id,
|
||||
workspace_id: Some(self.workspace_id.clone()),
|
||||
workspace_id: Some(self.workspace_id),
|
||||
rag_ids: Some(self.context.rag_ids),
|
||||
completion_history,
|
||||
custom_prompt: self
|
||||
|
|
|
@ -253,7 +253,7 @@ impl LocalAIController {
|
|||
self.close_chat(current_chat_id);
|
||||
}
|
||||
|
||||
self.current_chat_id.store(Some(Arc::new(chat_id.clone())));
|
||||
self.current_chat_id.store(Some(Arc::new(*chat_id)));
|
||||
let chat_id = chat_id.to_string();
|
||||
let weak_ctrl = Arc::downgrade(&self.ai_plugin);
|
||||
tokio::spawn(async move {
|
||||
|
@ -620,5 +620,5 @@ impl LLMResourceService for LLMResourceServiceImpl {
|
|||
|
||||
const APPFLOWY_LOCAL_AI_ENABLED: &str = "appflowy_local_ai_enabled";
|
||||
fn local_ai_enabled_key(workspace_id: &Uuid) -> String {
|
||||
format!("{}:{}", APPFLOWY_LOCAL_AI_ENABLED, workspace_id.to_string())
|
||||
format!("{}:{}", APPFLOWY_LOCAL_AI_ENABLED, workspace_id)
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ impl AIExternalService for ChatQueryServiceImpl {
|
|||
|
||||
// Perform full sync if changes are detected or no state vector is found
|
||||
let params = FullSyncCollabParams {
|
||||
object_id: rag_id.clone(),
|
||||
object_id: rag_id,
|
||||
collab_type: CollabType::Document,
|
||||
encoded_collab: query_collab.encoded_collab.clone(),
|
||||
};
|
||||
|
|
|
@ -444,7 +444,7 @@ impl DatabaseCloudService for ServerProvider {
|
|||
let server = self.get_server()?;
|
||||
server
|
||||
.database_service()
|
||||
.get_database_encode_collab(object_id, collab_type, &workspace_id)
|
||||
.get_database_encode_collab(object_id, collab_type, workspace_id)
|
||||
.await
|
||||
}
|
||||
|
||||
|
@ -485,7 +485,7 @@ impl DatabaseCloudService for ServerProvider {
|
|||
|
||||
server
|
||||
.database_service()
|
||||
.get_database_collab_object_snapshots(&object_id, limit)
|
||||
.get_database_collab_object_snapshots(object_id, limit)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ impl ChatCloudService for ServerProvider {
|
|||
self
|
||||
.get_server()?
|
||||
.chat_service()
|
||||
.create_question(&workspace_id, &chat_id, &message, message_type, metadata)
|
||||
.create_question(workspace_id, chat_id, &message, message_type, metadata)
|
||||
.await
|
||||
}
|
||||
|
||||
|
@ -716,7 +716,7 @@ impl ChatCloudService for ServerProvider {
|
|||
let server = self.get_server()?;
|
||||
server
|
||||
.chat_service()
|
||||
.stream_answer(&workspace_id, &chat_id, message_id, format, ai_model)
|
||||
.stream_answer(workspace_id, chat_id, message_id, format, ai_model)
|
||||
.await
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ impl FolderOperationHandler for ChatFolderOperation {
|
|||
self.0.delete_chat(view_id).await
|
||||
}
|
||||
|
||||
async fn duplicate_view(&self, view_id: &Uuid) -> Result<Bytes, FlowyError> {
|
||||
async fn duplicate_view(&self, _view_id: &Uuid) -> Result<Bytes, FlowyError> {
|
||||
Err(FlowyError::not_support())
|
||||
}
|
||||
|
||||
|
@ -47,8 +47,8 @@ impl FolderOperationHandler for ChatFolderOperation {
|
|||
user_id: i64,
|
||||
parent_view_id: &Uuid,
|
||||
view_id: &Uuid,
|
||||
name: &str,
|
||||
layout: ViewLayout,
|
||||
_name: &str,
|
||||
_layout: ViewLayout,
|
||||
) -> Result<(), FlowyError> {
|
||||
self
|
||||
.0
|
||||
|
@ -59,11 +59,11 @@ impl FolderOperationHandler for ChatFolderOperation {
|
|||
|
||||
async fn import_from_bytes(
|
||||
&self,
|
||||
uid: i64,
|
||||
view_id: &Uuid,
|
||||
name: &str,
|
||||
import_type: ImportType,
|
||||
bytes: Vec<u8>,
|
||||
_uid: i64,
|
||||
_view_id: &Uuid,
|
||||
_name: &str,
|
||||
_import_type: ImportType,
|
||||
_bytes: Vec<u8>,
|
||||
) -> Result<Vec<ImportedData>, FlowyError> {
|
||||
Err(FlowyError::not_support())
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#![allow(unused_variables)]
|
||||
use bytes::Bytes;
|
||||
use collab::entity::EncodedCollab;
|
||||
use collab_entity::CollabType;
|
||||
|
@ -68,7 +69,7 @@ impl FolderOperationHandler for DatabaseFolderOperation {
|
|||
.await?;
|
||||
let row_metas = self
|
||||
.0
|
||||
.get_database_row_metas_with_view_id(&view_id, row_oids.clone())
|
||||
.get_database_row_metas_with_view_id(view_id, row_oids.clone())
|
||||
.await?;
|
||||
let row_document_ids = row_metas
|
||||
.iter()
|
||||
|
|
|
@ -117,9 +117,9 @@ impl FolderOperationHandler for DocumentFolderOperation {
|
|||
async fn create_default_view(
|
||||
&self,
|
||||
user_id: i64,
|
||||
parent_view_id: &Uuid,
|
||||
_parent_view_id: &Uuid,
|
||||
view_id: &Uuid,
|
||||
name: &str,
|
||||
_name: &str,
|
||||
layout: ViewLayout,
|
||||
) -> Result<(), FlowyError> {
|
||||
debug_assert_eq!(layout, ViewLayout::Document);
|
||||
|
@ -139,8 +139,8 @@ impl FolderOperationHandler for DocumentFolderOperation {
|
|||
&self,
|
||||
uid: i64,
|
||||
view_id: &Uuid,
|
||||
name: &str,
|
||||
import_type: ImportType,
|
||||
_name: &str,
|
||||
_import_type: ImportType,
|
||||
bytes: Vec<u8>,
|
||||
) -> Result<Vec<ImportedData>, FlowyError> {
|
||||
let data = DocumentDataPB::try_from(Bytes::from(bytes))?;
|
||||
|
|
|
@ -196,7 +196,7 @@ impl FolderQueryService for FolderServiceImpl {
|
|||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
children.push(parent_view_id.clone());
|
||||
children.push(*parent_view_id);
|
||||
children
|
||||
},
|
||||
_ => vec![],
|
||||
|
|
|
@ -566,8 +566,8 @@ impl DatabaseManager {
|
|||
) -> FlowyResult<()> {
|
||||
let database = self.get_database_editor_with_view_id(view_id).await?;
|
||||
let mut summary_row_content = SummaryRowContent::new();
|
||||
if let Some(row) = database.get_row(&view_id, &row_id).await {
|
||||
let fields = database.get_fields(&view_id, None).await;
|
||||
if let Some(row) = database.get_row(view_id, &row_id).await {
|
||||
let fields = database.get_fields(view_id, None).await;
|
||||
for field in fields {
|
||||
// When summarizing a row, skip the content in the "AI summary" cell; it does not need to
|
||||
// be summarized.
|
||||
|
@ -600,7 +600,7 @@ impl DatabaseManager {
|
|||
|
||||
// Update the cell with the response from the cloud service.
|
||||
database
|
||||
.update_cell_with_changeset(&view_id, &row_id, &field_id, BoxAny::new(response))
|
||||
.update_cell_with_changeset(view_id, &row_id, &field_id, BoxAny::new(response))
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ impl DatabaseEditor {
|
|||
database.clone(),
|
||||
)?;
|
||||
let this = Arc::new(Self {
|
||||
database_id: database_id.clone(),
|
||||
database_id,
|
||||
user,
|
||||
database,
|
||||
cell_cache,
|
||||
|
|
|
@ -158,7 +158,7 @@ impl DocumentManager {
|
|||
let cloud_service = self.cloud_service.clone();
|
||||
let cloned_encoded_collab = encoded_collab.clone();
|
||||
let workspace_id = self.user_service.workspace_id()?;
|
||||
let doc_id = doc_id.clone();
|
||||
let doc_id = *doc_id;
|
||||
tokio::spawn(async move {
|
||||
let _ = cloud_service
|
||||
.create_document_collab(&workspace_id, &doc_id, cloned_encoded_collab)
|
||||
|
@ -260,7 +260,7 @@ impl DocumentManager {
|
|||
subscribe_document_snapshot_state(&lock);
|
||||
subscribe_document_sync_state(&lock);
|
||||
}
|
||||
self.documents.insert(doc_id.clone(), document.clone());
|
||||
self.documents.insert(*doc_id, document.clone());
|
||||
}
|
||||
Ok(document)
|
||||
},
|
||||
|
@ -322,7 +322,7 @@ impl DocumentManager {
|
|||
lock.clean_awareness_local_state();
|
||||
}
|
||||
|
||||
let clone_doc_id = doc_id.clone();
|
||||
let clone_doc_id = doc_id;
|
||||
trace!("move document to removing_documents: {}", doc_id);
|
||||
self.removing_documents.insert(doc_id, document);
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use std::ops::Deref;
|
||||
use std::sync::{Arc, OnceLock};
|
||||
|
||||
use anyhow::Error;
|
||||
use collab::entity::EncodedCollab;
|
||||
use collab::preclude::CollabPlugin;
|
||||
use collab_document::blocks::DocumentData;
|
||||
|
@ -39,7 +38,7 @@ impl DocumentTest {
|
|||
let builder = Arc::new(AppFlowyCollabBuilder::new(
|
||||
DefaultCollabStorageProvider(),
|
||||
WorkspaceCollabIntegrateImpl {
|
||||
workspace_id: user.workspace_id.clone(),
|
||||
workspace_id: user.workspace_id,
|
||||
},
|
||||
));
|
||||
|
||||
|
@ -89,7 +88,7 @@ impl DocumentUserService for FakeUser {
|
|||
}
|
||||
|
||||
fn workspace_id(&self) -> Result<Uuid, FlowyError> {
|
||||
Ok(self.workspace_id.clone())
|
||||
Ok(self.workspace_id)
|
||||
}
|
||||
|
||||
fn collab_db(&self, _uid: i64) -> Result<std::sync::Weak<CollabKVDB>, FlowyError> {
|
||||
|
@ -145,7 +144,7 @@ impl DocumentCloudService for LocalTestDocumentCloudServiceImpl {
|
|||
async fn get_document_doc_state(
|
||||
&self,
|
||||
document_id: &Uuid,
|
||||
workspace_id: &Uuid,
|
||||
_workspace_id: &Uuid,
|
||||
) -> Result<Vec<u8>, FlowyError> {
|
||||
let document_id = document_id.to_string();
|
||||
Err(FlowyError::new(
|
||||
|
@ -156,26 +155,26 @@ impl DocumentCloudService for LocalTestDocumentCloudServiceImpl {
|
|||
|
||||
async fn get_document_snapshots(
|
||||
&self,
|
||||
document_id: &Uuid,
|
||||
limit: usize,
|
||||
workspace_id: &str,
|
||||
_document_id: &Uuid,
|
||||
_limit: usize,
|
||||
_workspace_id: &str,
|
||||
) -> Result<Vec<DocumentSnapshot>, FlowyError> {
|
||||
Ok(vec![])
|
||||
}
|
||||
|
||||
async fn get_document_data(
|
||||
&self,
|
||||
document_id: &Uuid,
|
||||
workspace_id: &Uuid,
|
||||
_document_id: &Uuid,
|
||||
_workspace_id: &Uuid,
|
||||
) -> Result<Option<DocumentData>, FlowyError> {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
async fn create_document_collab(
|
||||
&self,
|
||||
workspace_id: &Uuid,
|
||||
document_id: &Uuid,
|
||||
encoded_collab: EncodedCollab,
|
||||
_workspace_id: &Uuid,
|
||||
_document_id: &Uuid,
|
||||
_encoded_collab: EncodedCollab,
|
||||
) -> Result<(), FlowyError> {
|
||||
Ok(())
|
||||
}
|
||||
|
@ -260,7 +259,7 @@ struct WorkspaceCollabIntegrateImpl {
|
|||
}
|
||||
impl WorkspaceCollabIntegrate for WorkspaceCollabIntegrateImpl {
|
||||
fn workspace_id(&self) -> Result<Uuid, FlowyError> {
|
||||
Ok(self.workspace_id.clone())
|
||||
Ok(self.workspace_id)
|
||||
}
|
||||
|
||||
fn device_id(&self) -> Result<String, FlowyError> {
|
||||
|
|
|
@ -348,12 +348,12 @@ impl TryInto<CreateViewParams> for CreateViewPayloadPB {
|
|||
fn try_into(self) -> Result<CreateViewParams, Self::Error> {
|
||||
let name = ViewName::parse(self.name)?.0;
|
||||
let parent_view_id = ViewIdentify::parse(self.parent_view_id)
|
||||
.and_then(|id| Uuid::from_str(&id.0).map_err(|err| ErrorCode::InvalidParams))?;
|
||||
.and_then(|id| Uuid::from_str(&id.0).map_err(|_| ErrorCode::InvalidParams))?;
|
||||
// if view_id is not provided, generate a new view_id
|
||||
let view_id = self
|
||||
.view_id
|
||||
.and_then(|v| Uuid::parse_str(&v).ok())
|
||||
.unwrap_or_else(|| gen_view_id());
|
||||
.unwrap_or_else(gen_view_id);
|
||||
|
||||
Ok(CreateViewParams {
|
||||
parent_view_id,
|
||||
|
@ -379,7 +379,7 @@ impl TryInto<CreateViewParams> for CreateOrphanViewPayloadPB {
|
|||
let view_id = Uuid::parse_str(&self.view_id).map_err(|_| ErrorCode::InvalidParams)?;
|
||||
|
||||
Ok(CreateViewParams {
|
||||
parent_view_id: view_id.clone(),
|
||||
parent_view_id: view_id,
|
||||
name,
|
||||
layout: self.layout,
|
||||
view_id,
|
||||
|
|
|
@ -189,7 +189,7 @@ impl FolderManager {
|
|||
let config = CollabBuilderConfig::default().sync_enable(true);
|
||||
|
||||
let data_source = data_source.unwrap_or_else(|| {
|
||||
CollabPersistenceImpl::new(collab_db.clone(), uid, workspace_id.clone()).into_data_source()
|
||||
CollabPersistenceImpl::new(collab_db.clone(), uid, *workspace_id).into_data_source()
|
||||
});
|
||||
|
||||
let object_id = workspace_id;
|
||||
|
@ -245,7 +245,7 @@ impl FolderManager {
|
|||
.collab_object(workspace_id, uid, object_id, CollabType::Folder)?;
|
||||
|
||||
let doc_state =
|
||||
CollabPersistenceImpl::new(collab_db.clone(), uid, workspace_id.clone()).into_data_source();
|
||||
CollabPersistenceImpl::new(collab_db.clone(), uid, *workspace_id).into_data_source();
|
||||
let folder = self
|
||||
.collab_builder
|
||||
.create_folder(
|
||||
|
@ -1221,7 +1221,7 @@ impl FolderManager {
|
|||
}
|
||||
|
||||
let workspace_id = self.user.workspace_id()?;
|
||||
let parent_view_id = Uuid::from_str(&parent_view_id)?;
|
||||
let parent_view_id = Uuid::from_str(parent_view_id)?;
|
||||
|
||||
// Sync the view to the cloud
|
||||
if sync_after_create {
|
||||
|
@ -1815,7 +1815,7 @@ impl FolderManager {
|
|||
for data in import_data.items {
|
||||
// Import a single file and get the view and encoded collab data
|
||||
let (view, encoded_collabs) = self
|
||||
.import_single_file(import_data.parent_view_id.clone(), data)
|
||||
.import_single_file(import_data.parent_view_id, data)
|
||||
.await?;
|
||||
views.push(view_pb_without_child_views(view));
|
||||
|
||||
|
@ -2054,7 +2054,7 @@ impl FolderManager {
|
|||
pub fn remove_indices_for_workspace(&self, workspace_id: &Uuid) -> FlowyResult<()> {
|
||||
self
|
||||
.folder_indexer
|
||||
.remove_indices_for_workspace(workspace_id.clone())?;
|
||||
.remove_indices_for_workspace(*workspace_id)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -74,13 +74,13 @@ impl FolderManager {
|
|||
// This will happen user can't fetch the folder data when the user sign in.
|
||||
let doc_state = self
|
||||
.cloud_service
|
||||
.get_folder_doc_state(&workspace_id, uid, CollabType::Folder, &workspace_id)
|
||||
.get_folder_doc_state(workspace_id, uid, CollabType::Folder, workspace_id)
|
||||
.await?;
|
||||
|
||||
self
|
||||
.make_folder(
|
||||
uid,
|
||||
&workspace_id,
|
||||
workspace_id,
|
||||
collab_db.clone(),
|
||||
Some(DataSource::DocStateV1(doc_state)),
|
||||
folder_notifier.clone(),
|
||||
|
@ -92,14 +92,14 @@ impl FolderManager {
|
|||
if doc_state.is_empty() {
|
||||
event!(Level::ERROR, "remote folder data is empty, open from local");
|
||||
self
|
||||
.make_folder(uid, &workspace_id, collab_db, None, folder_notifier)
|
||||
.make_folder(uid, workspace_id, collab_db, None, folder_notifier)
|
||||
.await?
|
||||
} else {
|
||||
event!(Level::INFO, "Restore folder from remote data");
|
||||
self
|
||||
.make_folder(
|
||||
uid,
|
||||
&workspace_id,
|
||||
workspace_id,
|
||||
collab_db.clone(),
|
||||
Some(DataSource::DocStateV1(doc_state)),
|
||||
folder_notifier.clone(),
|
||||
|
@ -115,27 +115,23 @@ impl FolderManager {
|
|||
let index_content_rx = folder.subscribe_index_content();
|
||||
self
|
||||
.folder_indexer
|
||||
.set_index_content_receiver(index_content_rx, workspace_id.clone());
|
||||
self.handle_index_folder(workspace_id.clone(), &folder);
|
||||
.set_index_content_receiver(index_content_rx, *workspace_id);
|
||||
self.handle_index_folder(*workspace_id, &folder);
|
||||
folder_state_rx
|
||||
};
|
||||
|
||||
self.mutex_folder.store(Some(folder.clone()));
|
||||
|
||||
let weak_mutex_folder = Arc::downgrade(&folder);
|
||||
subscribe_folder_sync_state_changed(
|
||||
workspace_id.clone(),
|
||||
folder_state_rx,
|
||||
Arc::downgrade(&self.user),
|
||||
);
|
||||
subscribe_folder_sync_state_changed(*workspace_id, folder_state_rx, Arc::downgrade(&self.user));
|
||||
subscribe_folder_trash_changed(
|
||||
workspace_id.clone(),
|
||||
*workspace_id,
|
||||
section_change_rx,
|
||||
weak_mutex_folder.clone(),
|
||||
Arc::downgrade(&self.user),
|
||||
);
|
||||
subscribe_folder_view_changed(
|
||||
workspace_id.clone(),
|
||||
*workspace_id,
|
||||
view_rx,
|
||||
weak_mutex_folder.clone(),
|
||||
Arc::downgrade(&self.user),
|
||||
|
@ -198,7 +194,7 @@ impl FolderManager {
|
|||
// We spawn a blocking task to index all views in the folder
|
||||
spawn_blocking(move || {
|
||||
// We remove old indexes just in case
|
||||
let _ = folder_indexer.remove_indices_for_workspace(workspace_id.clone());
|
||||
let _ = folder_indexer.remove_indices_for_workspace(workspace_id);
|
||||
|
||||
// We index all views from the workspace
|
||||
folder_indexer.index_all_views(views, workspace_id);
|
||||
|
|
|
@ -99,7 +99,7 @@ pub(crate) fn subscribe_folder_sync_state_changed(
|
|||
}
|
||||
|
||||
folder_notification_builder(
|
||||
&workspace_id.to_string(),
|
||||
workspace_id.to_string(),
|
||||
FolderNotification::DidUpdateFolderSyncUpdate,
|
||||
)
|
||||
.payload(FolderSyncStatePB::from(state))
|
||||
|
|
|
@ -295,7 +295,7 @@ impl IndexManager for FolderIndexManagerImpl {
|
|||
|
||||
fn set_index_content_receiver(&self, mut rx: IndexContentReceiver, workspace_id: Uuid) {
|
||||
let indexer = self.clone();
|
||||
let wid = workspace_id.clone();
|
||||
let wid = workspace_id;
|
||||
tokio::spawn(async move {
|
||||
while let Ok(msg) = rx.recv().await {
|
||||
match msg {
|
||||
|
@ -306,7 +306,7 @@ impl IndexManager for FolderIndexManagerImpl {
|
|||
data: view.name,
|
||||
icon: view.icon,
|
||||
layout: view.layout,
|
||||
workspace_id: wid.clone(),
|
||||
workspace_id: wid,
|
||||
});
|
||||
},
|
||||
Err(err) => tracing::error!("FolderIndexManager error deserialize: {:?}", err),
|
||||
|
@ -318,7 +318,7 @@ impl IndexManager for FolderIndexManagerImpl {
|
|||
data: view.name,
|
||||
icon: view.icon,
|
||||
layout: view.layout,
|
||||
workspace_id: wid.clone(),
|
||||
workspace_id: wid,
|
||||
});
|
||||
},
|
||||
Err(err) => tracing::error!("FolderIndexManager error deserialize: {:?}", err),
|
||||
|
@ -424,7 +424,7 @@ impl FolderIndexManager for FolderIndexManagerImpl {
|
|||
fn index_all_views(&self, views: Vec<Arc<View>>, workspace_id: Uuid) {
|
||||
let indexable_data = views
|
||||
.into_iter()
|
||||
.map(|view| IndexableData::from_view(view, workspace_id.clone()))
|
||||
.map(|view| IndexableData::from_view(view, workspace_id))
|
||||
.collect();
|
||||
|
||||
let _ = self.index_all(indexable_data);
|
||||
|
@ -442,14 +442,14 @@ impl FolderIndexManager for FolderIndexManagerImpl {
|
|||
FolderViewChange::Inserted { view_id } => {
|
||||
let view = views_iter.find(|view| view.id == view_id);
|
||||
if let Some(view) = view {
|
||||
let indexable_data = IndexableData::from_view(view, workspace_id.clone());
|
||||
let indexable_data = IndexableData::from_view(view, workspace_id);
|
||||
let _ = self.add_index(indexable_data);
|
||||
}
|
||||
},
|
||||
FolderViewChange::Updated { view_id } => {
|
||||
let view = views_iter.find(|view| view.id == view_id);
|
||||
if let Some(view) = view {
|
||||
let indexable_data = IndexableData::from_view(view, workspace_id.clone());
|
||||
let indexable_data = IndexableData::from_view(view, workspace_id);
|
||||
let _ = self.update_index(indexable_data);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#![allow(unused_variables)]
|
||||
use crate::af_cloud::AFServer;
|
||||
use client_api::entity::ai_dto::{
|
||||
ChatQuestionQuery, CompleteTextParams, RepeatedRelatedQuestion, ResponseFormat,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#![allow(unused_variables)]
|
||||
use crate::af_cloud::define::ServerUser;
|
||||
use crate::af_cloud::impls::util::check_request_workspace_id_is_match;
|
||||
use crate::af_cloud::AFServer;
|
||||
|
@ -41,8 +42,8 @@ where
|
|||
let try_get_client = self.inner.try_get_client();
|
||||
let cloned_user = self.user.clone();
|
||||
let params = QueryCollabParams {
|
||||
workspace_id: workspace_id.clone(),
|
||||
inner: QueryCollab::new(object_id.clone(), collab_type),
|
||||
workspace_id: *workspace_id,
|
||||
inner: QueryCollab::new(*object_id, collab_type),
|
||||
};
|
||||
let result = try_get_client?.get_collab(params).await;
|
||||
match result {
|
||||
|
@ -77,8 +78,8 @@ where
|
|||
.encode_to_bytes()
|
||||
.map_err(|err| FlowyError::internal().with_context(err))?;
|
||||
let params = CreateCollabParams {
|
||||
workspace_id: workspace_id.clone(),
|
||||
object_id: object_id.clone(),
|
||||
workspace_id: *workspace_id,
|
||||
object_id: *object_id,
|
||||
encoded_collab_v1,
|
||||
collab_type,
|
||||
};
|
||||
|
@ -151,7 +152,7 @@ where
|
|||
.map(|(key, value)| (key, Value::String(value)))
|
||||
.collect();
|
||||
let params = SummarizeRowParams {
|
||||
workspace_id: workspace_id.clone(),
|
||||
workspace_id: *workspace_id,
|
||||
data: SummarizeRowData::Content(map),
|
||||
};
|
||||
let data = try_get_client?.summarize_row(params).await?;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#![allow(unused_variables)]
|
||||
use client_api::entity::{CreateCollabParams, QueryCollab, QueryCollabParams};
|
||||
use collab::core::collab::DataSource;
|
||||
use collab::core::origin::CollabOrigin;
|
||||
|
@ -33,8 +34,8 @@ where
|
|||
workspace_id: &Uuid,
|
||||
) -> Result<Vec<u8>, FlowyError> {
|
||||
let params = QueryCollabParams {
|
||||
workspace_id: workspace_id.clone(),
|
||||
inner: QueryCollab::new(document_id.clone(), CollabType::Document),
|
||||
workspace_id: *workspace_id,
|
||||
inner: QueryCollab::new(*document_id, CollabType::Document),
|
||||
};
|
||||
let doc_state = self
|
||||
.inner
|
||||
|
@ -71,8 +72,8 @@ where
|
|||
workspace_id: &Uuid,
|
||||
) -> Result<Option<DocumentData>, FlowyError> {
|
||||
let params = QueryCollabParams {
|
||||
workspace_id: workspace_id.clone(),
|
||||
inner: QueryCollab::new(document_id.clone(), CollabType::Document),
|
||||
workspace_id: *workspace_id,
|
||||
inner: QueryCollab::new(*document_id, CollabType::Document),
|
||||
};
|
||||
let doc_state = self
|
||||
.inner
|
||||
|
@ -105,8 +106,8 @@ where
|
|||
encoded_collab: EncodedCollab,
|
||||
) -> Result<(), FlowyError> {
|
||||
let params = CreateCollabParams {
|
||||
workspace_id: workspace_id.clone(),
|
||||
object_id: document_id.clone(),
|
||||
workspace_id: *workspace_id,
|
||||
object_id: *document_id,
|
||||
encoded_collab_v1: encoded_collab
|
||||
.encode_to_bytes()
|
||||
.map_err(|err| FlowyError::internal().with_context(err))?,
|
||||
|
|
|
@ -14,7 +14,7 @@ use std::sync::Arc;
|
|||
use tracing::{instrument, trace};
|
||||
use uuid::Uuid;
|
||||
|
||||
use flowy_error::{ErrorCode, FlowyError};
|
||||
use flowy_error::FlowyError;
|
||||
use flowy_folder_pub::cloud::{
|
||||
Folder, FolderCloudService, FolderCollabParams, FolderData, FolderSnapshot, FullSyncCollabParams,
|
||||
Workspace, WorkspaceRecord,
|
||||
|
@ -93,8 +93,8 @@ where
|
|||
let try_get_client = self.inner.try_get_client();
|
||||
let cloned_user = self.user.clone();
|
||||
let params = QueryCollabParams {
|
||||
workspace_id: workspace_id.clone(),
|
||||
inner: QueryCollab::new(workspace_id.clone(), CollabType::Folder),
|
||||
workspace_id: *workspace_id,
|
||||
inner: QueryCollab::new(*workspace_id, CollabType::Folder),
|
||||
};
|
||||
let doc_state = try_get_client?
|
||||
.get_collab(params)
|
||||
|
@ -103,7 +103,7 @@ where
|
|||
.encode_collab
|
||||
.doc_state
|
||||
.to_vec();
|
||||
check_request_workspace_id_is_match(&workspace_id, &cloned_user, "get folder data")?;
|
||||
check_request_workspace_id_is_match(workspace_id, &cloned_user, "get folder data")?;
|
||||
let folder = Folder::from_collab_doc_state(
|
||||
uid,
|
||||
CollabOrigin::Empty,
|
||||
|
@ -126,15 +126,15 @@ where
|
|||
async fn get_folder_doc_state(
|
||||
&self,
|
||||
workspace_id: &Uuid,
|
||||
uid: i64,
|
||||
_uid: i64,
|
||||
collab_type: CollabType,
|
||||
object_id: &Uuid,
|
||||
) -> Result<Vec<u8>, FlowyError> {
|
||||
let try_get_client = self.inner.try_get_client();
|
||||
let cloned_user = self.user.clone();
|
||||
let params = QueryCollabParams {
|
||||
workspace_id: workspace_id.clone(),
|
||||
inner: QueryCollab::new(object_id.clone(), collab_type),
|
||||
workspace_id: *workspace_id,
|
||||
inner: QueryCollab::new(*object_id, collab_type),
|
||||
};
|
||||
let doc_state = try_get_client?
|
||||
.get_collab(params)
|
||||
|
@ -143,7 +143,7 @@ where
|
|||
.encode_collab
|
||||
.doc_state
|
||||
.to_vec();
|
||||
check_request_workspace_id_is_match(&workspace_id, &cloned_user, "get folder doc state")?;
|
||||
check_request_workspace_id_is_match(workspace_id, &cloned_user, "get folder doc state")?;
|
||||
Ok(doc_state)
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ where
|
|||
let try_get_client = self.inner.try_get_client();
|
||||
try_get_client?
|
||||
.collab_full_sync(
|
||||
&workspace_id,
|
||||
workspace_id,
|
||||
¶ms.object_id,
|
||||
params.collab_type,
|
||||
params.encoded_collab.doc_state.to_vec(),
|
||||
|
@ -220,7 +220,7 @@ where
|
|||
})
|
||||
.collect::<Vec<_>>();
|
||||
try_get_client?
|
||||
.publish_collabs(&workspace_id, params)
|
||||
.publish_collabs(workspace_id, params)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ where
|
|||
) -> Result<(), FlowyError> {
|
||||
let try_get_client = self.inner.try_get_client();
|
||||
try_get_client?
|
||||
.unpublish_collabs(&workspace_id, &view_ids)
|
||||
.unpublish_collabs(workspace_id, &view_ids)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ where
|
|||
async fn open_workspace(&self, workspace_id: &Uuid) -> Result<UserWorkspace, FlowyError> {
|
||||
let try_get_client = self.server.try_get_client();
|
||||
let client = try_get_client?;
|
||||
let af_workspace = client.open_workspace(&workspace_id).await?;
|
||||
let af_workspace = client.open_workspace(workspace_id).await?;
|
||||
Ok(to_user_workspace(af_workspace))
|
||||
}
|
||||
|
||||
|
@ -348,18 +348,18 @@ where
|
|||
#[instrument(level = "debug", skip_all)]
|
||||
async fn get_user_awareness_doc_state(
|
||||
&self,
|
||||
uid: i64,
|
||||
_uid: i64,
|
||||
workspace_id: &Uuid,
|
||||
object_id: &Uuid,
|
||||
) -> Result<Vec<u8>, FlowyError> {
|
||||
let try_get_client = self.server.try_get_client();
|
||||
let cloned_user = self.user.clone();
|
||||
let params = QueryCollabParams {
|
||||
workspace_id: workspace_id.clone(),
|
||||
inner: QueryCollab::new(object_id.clone(), CollabType::UserAwareness),
|
||||
workspace_id: *workspace_id,
|
||||
inner: QueryCollab::new(*object_id, CollabType::UserAwareness),
|
||||
};
|
||||
let resp = try_get_client?.get_collab(params).await?;
|
||||
check_request_workspace_id_is_match(&workspace_id, &cloned_user, "get user awareness object")?;
|
||||
check_request_workspace_id_is_match(workspace_id, &cloned_user, "get user awareness object")?;
|
||||
Ok(resp.encode_collab.doc_state.to_vec())
|
||||
}
|
||||
|
||||
|
@ -403,12 +403,12 @@ where
|
|||
.into_iter()
|
||||
.flat_map(|object| {
|
||||
Uuid::from_str(&object.object_id)
|
||||
.and_then(|object_id| {
|
||||
Ok(CollabParams::new(
|
||||
.map(|object_id| {
|
||||
CollabParams::new(
|
||||
object_id,
|
||||
u8::from(object.collab_type).into(),
|
||||
object.encoded_collab,
|
||||
))
|
||||
)
|
||||
})
|
||||
.ok()
|
||||
})
|
||||
|
@ -456,7 +456,7 @@ where
|
|||
let try_get_client = self.server.try_get_client();
|
||||
let client = try_get_client?;
|
||||
let params = QueryWorkspaceMember {
|
||||
workspace_id: workspace_id.clone(),
|
||||
workspace_id: *workspace_id,
|
||||
uid,
|
||||
};
|
||||
let member = client.get_workspace_member(params).await?;
|
||||
|
|
|
@ -17,104 +17,104 @@ pub(crate) struct DefaultChatCloudServiceImpl;
|
|||
impl ChatCloudService for DefaultChatCloudServiceImpl {
|
||||
async fn create_chat(
|
||||
&self,
|
||||
uid: &i64,
|
||||
workspace_id: &Uuid,
|
||||
chat_id: &Uuid,
|
||||
rag_ids: Vec<Uuid>,
|
||||
_uid: &i64,
|
||||
_workspace_id: &Uuid,
|
||||
_chat_id: &Uuid,
|
||||
_rag_ids: Vec<Uuid>,
|
||||
) -> Result<(), FlowyError> {
|
||||
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
||||
}
|
||||
|
||||
async fn create_question(
|
||||
&self,
|
||||
workspace_id: &Uuid,
|
||||
chat_id: &Uuid,
|
||||
message: &str,
|
||||
message_type: ChatMessageType,
|
||||
metadata: &[ChatMessageMetadata],
|
||||
_workspace_id: &Uuid,
|
||||
_chat_id: &Uuid,
|
||||
_message: &str,
|
||||
_message_type: ChatMessageType,
|
||||
_metadata: &[ChatMessageMetadata],
|
||||
) -> Result<ChatMessage, FlowyError> {
|
||||
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
||||
}
|
||||
|
||||
async fn create_answer(
|
||||
&self,
|
||||
workspace_id: &Uuid,
|
||||
chat_id: &Uuid,
|
||||
message: &str,
|
||||
question_id: i64,
|
||||
metadata: Option<serde_json::Value>,
|
||||
_workspace_id: &Uuid,
|
||||
_chat_id: &Uuid,
|
||||
_message: &str,
|
||||
_question_id: i64,
|
||||
_metadata: Option<serde_json::Value>,
|
||||
) -> Result<ChatMessage, FlowyError> {
|
||||
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
||||
}
|
||||
|
||||
async fn stream_answer(
|
||||
&self,
|
||||
workspace_id: &Uuid,
|
||||
chat_id: &Uuid,
|
||||
message_id: i64,
|
||||
format: ResponseFormat,
|
||||
ai_model: Option<AIModel>,
|
||||
_workspace_id: &Uuid,
|
||||
_chat_id: &Uuid,
|
||||
_message_id: i64,
|
||||
_format: ResponseFormat,
|
||||
_ai_model: Option<AIModel>,
|
||||
) -> Result<StreamAnswer, FlowyError> {
|
||||
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
||||
}
|
||||
|
||||
async fn get_chat_messages(
|
||||
&self,
|
||||
workspace_id: &Uuid,
|
||||
chat_id: &Uuid,
|
||||
offset: MessageCursor,
|
||||
limit: u64,
|
||||
_workspace_id: &Uuid,
|
||||
_chat_id: &Uuid,
|
||||
_offset: MessageCursor,
|
||||
_limit: u64,
|
||||
) -> Result<RepeatedChatMessage, FlowyError> {
|
||||
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
||||
}
|
||||
|
||||
async fn get_question_from_answer_id(
|
||||
&self,
|
||||
workspace_id: &Uuid,
|
||||
chat_id: &Uuid,
|
||||
answer_message_id: i64,
|
||||
_workspace_id: &Uuid,
|
||||
_chat_id: &Uuid,
|
||||
_answer_message_id: i64,
|
||||
) -> Result<ChatMessage, FlowyError> {
|
||||
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
||||
}
|
||||
|
||||
async fn get_related_message(
|
||||
&self,
|
||||
workspace_id: &Uuid,
|
||||
chat_id: &Uuid,
|
||||
message_id: i64,
|
||||
_workspace_id: &Uuid,
|
||||
_chat_id: &Uuid,
|
||||
_message_id: i64,
|
||||
) -> Result<RepeatedRelatedQuestion, FlowyError> {
|
||||
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
||||
}
|
||||
|
||||
async fn get_answer(
|
||||
&self,
|
||||
workspace_id: &Uuid,
|
||||
chat_id: &Uuid,
|
||||
question_message_id: i64,
|
||||
_workspace_id: &Uuid,
|
||||
_chat_id: &Uuid,
|
||||
_question_message_id: i64,
|
||||
) -> Result<ChatMessage, FlowyError> {
|
||||
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
||||
}
|
||||
|
||||
async fn stream_complete(
|
||||
&self,
|
||||
workspace_id: &Uuid,
|
||||
params: CompleteTextParams,
|
||||
ai_model: Option<AIModel>,
|
||||
_workspace_id: &Uuid,
|
||||
_params: CompleteTextParams,
|
||||
_ai_model: Option<AIModel>,
|
||||
) -> Result<StreamComplete, FlowyError> {
|
||||
Err(FlowyError::not_support().with_context("complete text is not supported in local server."))
|
||||
}
|
||||
|
||||
async fn embed_file(
|
||||
&self,
|
||||
workspace_id: &Uuid,
|
||||
file_path: &Path,
|
||||
chat_id: &Uuid,
|
||||
metadata: Option<HashMap<String, Value>>,
|
||||
_workspace_id: &Uuid,
|
||||
_file_path: &Path,
|
||||
_chat_id: &Uuid,
|
||||
_metadata: Option<HashMap<String, Value>>,
|
||||
) -> Result<(), FlowyError> {
|
||||
Err(FlowyError::not_support().with_context("indexing file is not supported in local server."))
|
||||
}
|
||||
|
||||
async fn get_local_ai_config(&self, workspace_id: &Uuid) -> Result<LocalAIConfig, FlowyError> {
|
||||
async fn get_local_ai_config(&self, _workspace_id: &Uuid) -> Result<LocalAIConfig, FlowyError> {
|
||||
Err(
|
||||
FlowyError::not_support()
|
||||
.with_context("Get local ai config is not supported in local server."),
|
||||
|
@ -123,7 +123,7 @@ impl ChatCloudService for DefaultChatCloudServiceImpl {
|
|||
|
||||
async fn get_workspace_plan(
|
||||
&self,
|
||||
workspace_id: &Uuid,
|
||||
_workspace_id: &Uuid,
|
||||
) -> Result<Vec<SubscriptionPlan>, FlowyError> {
|
||||
Err(
|
||||
FlowyError::not_support()
|
||||
|
@ -133,26 +133,26 @@ impl ChatCloudService for DefaultChatCloudServiceImpl {
|
|||
|
||||
async fn get_chat_settings(
|
||||
&self,
|
||||
workspace_id: &Uuid,
|
||||
chat_id: &Uuid,
|
||||
_workspace_id: &Uuid,
|
||||
_chat_id: &Uuid,
|
||||
) -> Result<ChatSettings, FlowyError> {
|
||||
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
||||
}
|
||||
|
||||
async fn update_chat_settings(
|
||||
&self,
|
||||
workspace_id: &Uuid,
|
||||
chat_id: &Uuid,
|
||||
params: UpdateChatParams,
|
||||
_workspace_id: &Uuid,
|
||||
_id: &Uuid,
|
||||
_s: UpdateChatParams,
|
||||
) -> Result<(), FlowyError> {
|
||||
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
||||
}
|
||||
|
||||
async fn get_available_models(&self, workspace_id: &Uuid) -> Result<ModelList, FlowyError> {
|
||||
async fn get_available_models(&self, _workspace_id: &Uuid) -> Result<ModelList, FlowyError> {
|
||||
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
||||
}
|
||||
|
||||
async fn get_workspace_default_model(&self, workspace_id: &Uuid) -> Result<String, FlowyError> {
|
||||
async fn get_workspace_default_model(&self, _workspace_id: &Uuid) -> Result<String, FlowyError> {
|
||||
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#![allow(unused_variables)]
|
||||
use collab::entity::EncodedCollab;
|
||||
use collab_database::database::default_database_data;
|
||||
use collab_database::workspace_database::default_workspace_database_data;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#![allow(unused_variables)]
|
||||
use collab::entity::EncodedCollab;
|
||||
use flowy_document_pub::cloud::*;
|
||||
use flowy_error::{ErrorCode, FlowyError};
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#![allow(unused_variables)]
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::local_server::LocalServerDB;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#![allow(unused_variables)]
|
||||
use collab::core::origin::CollabOrigin;
|
||||
use collab::preclude::Collab;
|
||||
use collab_entity::CollabObject;
|
||||
|
|
|
@ -47,7 +47,7 @@ impl PeriodicallyCheckBillingState {
|
|||
while attempts < max_attempts {
|
||||
let plans = cloud_service
|
||||
.get_user_service()?
|
||||
.get_workspace_plan(self.workspace_id.clone())
|
||||
.get_workspace_plan(self.workspace_id)
|
||||
.await?;
|
||||
|
||||
// If the expected plan is not set, return the plans immediately. Otherwise,
|
||||
|
|
|
@ -231,7 +231,7 @@ impl UserManager {
|
|||
let workspace_id = session.user_workspace.workspace_id()?;
|
||||
let create_awareness = if authenticator.is_local() {
|
||||
let doc_state =
|
||||
CollabPersistenceImpl::new(collab_db.clone(), session.user_id, workspace_id.clone())
|
||||
CollabPersistenceImpl::new(collab_db.clone(), session.user_id, workspace_id)
|
||||
.into_data_source();
|
||||
Self::collab_for_user_awareness(
|
||||
&weak_builder,
|
||||
|
@ -266,12 +266,9 @@ impl UserManager {
|
|||
Err(err) => {
|
||||
if err.is_record_not_found() {
|
||||
info!("User awareness not found, creating new");
|
||||
let doc_state = CollabPersistenceImpl::new(
|
||||
collab_db.clone(),
|
||||
session.user_id,
|
||||
workspace_id.clone(),
|
||||
)
|
||||
.into_data_source();
|
||||
let doc_state =
|
||||
CollabPersistenceImpl::new(collab_db.clone(), session.user_id, workspace_id)
|
||||
.into_data_source();
|
||||
Self::collab_for_user_awareness(
|
||||
&weak_builder,
|
||||
&workspace_id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue