diff --git a/frontend/rust-lib/flowy-ai/src/ai_manager.rs b/frontend/rust-lib/flowy-ai/src/ai_manager.rs index d8ef5977d8..1aac5b0109 100644 --- a/frontend/rust-lib/flowy-ai/src/ai_manager.rs +++ b/frontend/rust-lib/flowy-ai/src/ai_manager.rs @@ -139,7 +139,6 @@ impl AIManager { chat_id.to_string(), self.user_service.clone(), self.cloud_service_wm.clone(), - self.store_preferences.clone(), )) }); if self.local_ai.is_running() { @@ -235,7 +234,6 @@ impl AIManager { chat_id.to_string(), self.user_service.clone(), self.cloud_service_wm.clone(), - self.store_preferences.clone(), )); self.chats.insert(chat_id.to_string(), chat.clone()); Ok(chat) @@ -495,7 +493,6 @@ impl AIManager { chat_id.to_string(), self.user_service.clone(), self.cloud_service_wm.clone(), - self.store_preferences.clone(), )); self.chats.insert(chat_id.to_string(), chat.clone()); Ok(chat) diff --git a/frontend/rust-lib/flowy-ai/src/chat.rs b/frontend/rust-lib/flowy-ai/src/chat.rs index 50cec2c625..e00f21a863 100644 --- a/frontend/rust-lib/flowy-ai/src/chat.rs +++ b/frontend/rust-lib/flowy-ai/src/chat.rs @@ -15,7 +15,6 @@ use flowy_ai_pub::cloud::{ AIModel, ChatCloudService, ChatMessage, MessageCursor, QuestionStreamValue, ResponseFormat, }; use flowy_error::{ErrorCode, FlowyError, FlowyResult}; -use flowy_sqlite::kv::KVStorePreferences; use flowy_sqlite::DBConnection; use futures::{SinkExt, StreamExt}; use lib_infra::isolate_stream::IsolateSink; @@ -40,7 +39,6 @@ pub struct Chat { latest_message_id: Arc, stop_stream: Arc, stream_buffer: Arc>, - store_preferences: Arc, } impl Chat { @@ -49,7 +47,6 @@ impl Chat { chat_id: String, user_service: Arc, chat_service: Arc, - store_preferences: Arc, ) -> Chat { Chat { uid, @@ -60,7 +57,6 @@ impl Chat { latest_message_id: Default::default(), stop_stream: Arc::new(AtomicBool::new(false)), stream_buffer: Arc::new(Mutex::new(StringBuffer::default())), - store_preferences, } } diff --git a/frontend/rust-lib/flowy-ai/src/completion.rs b/frontend/rust-lib/flowy-ai/src/completion.rs index 393685d642..27babfb28e 100644 --- a/frontend/rust-lib/flowy-ai/src/completion.rs +++ b/frontend/rust-lib/flowy-ai/src/completion.rs @@ -13,7 +13,6 @@ use futures::{SinkExt, StreamExt}; use lib_infra::isolate_stream::IsolateSink; use crate::stream_message::StreamMessage; -use flowy_sqlite::kv::KVStorePreferences; use std::sync::{Arc, Weak}; use tokio::select; use tracing::info; diff --git a/frontend/rust-lib/flowy-ai/src/middleware/chat_service_mw.rs b/frontend/rust-lib/flowy-ai/src/middleware/chat_service_mw.rs index 55f85ec5f9..dd294e6f0e 100644 --- a/frontend/rust-lib/flowy-ai/src/middleware/chat_service_mw.rs +++ b/frontend/rust-lib/flowy-ai/src/middleware/chat_service_mw.rs @@ -180,12 +180,10 @@ impl ChatCloudService for AICloudServiceMiddleware { Ok(stream::once(async { Err(FlowyError::local_ai_unavailable()) }).boxed()) }, } + } else if self.local_ai.is_enabled() { + Err(FlowyError::local_ai_not_ready()) } else { - if self.local_ai.is_enabled() { - Err(FlowyError::local_ai_not_ready()) - } else { - Err(FlowyError::local_ai_disabled()) - } + Err(FlowyError::local_ai_disabled()) } } else { self @@ -316,12 +314,10 @@ impl ChatCloudService for AICloudServiceMiddleware { Ok(stream::once(async { Err(FlowyError::local_ai_unavailable()) }).boxed()) }, } + } else if self.local_ai.is_enabled() { + Err(FlowyError::local_ai_not_ready()) } else { - if self.local_ai.is_enabled() { - Err(FlowyError::local_ai_not_ready()) - } else { - Err(FlowyError::local_ai_disabled()) - } + Err(FlowyError::local_ai_disabled()) } } else { self