chore: clippy

This commit is contained in:
Nathan 2025-03-30 20:53:27 +08:00
parent b63c4dfe21
commit e3a0806eee
4 changed files with 6 additions and 18 deletions

View File

@ -139,7 +139,6 @@ impl AIManager {
chat_id.to_string(), chat_id.to_string(),
self.user_service.clone(), self.user_service.clone(),
self.cloud_service_wm.clone(), self.cloud_service_wm.clone(),
self.store_preferences.clone(),
)) ))
}); });
if self.local_ai.is_running() { if self.local_ai.is_running() {
@ -235,7 +234,6 @@ impl AIManager {
chat_id.to_string(), chat_id.to_string(),
self.user_service.clone(), self.user_service.clone(),
self.cloud_service_wm.clone(), self.cloud_service_wm.clone(),
self.store_preferences.clone(),
)); ));
self.chats.insert(chat_id.to_string(), chat.clone()); self.chats.insert(chat_id.to_string(), chat.clone());
Ok(chat) Ok(chat)
@ -495,7 +493,6 @@ impl AIManager {
chat_id.to_string(), chat_id.to_string(),
self.user_service.clone(), self.user_service.clone(),
self.cloud_service_wm.clone(), self.cloud_service_wm.clone(),
self.store_preferences.clone(),
)); ));
self.chats.insert(chat_id.to_string(), chat.clone()); self.chats.insert(chat_id.to_string(), chat.clone());
Ok(chat) Ok(chat)

View File

@ -15,7 +15,6 @@ use flowy_ai_pub::cloud::{
AIModel, ChatCloudService, ChatMessage, MessageCursor, QuestionStreamValue, ResponseFormat, AIModel, ChatCloudService, ChatMessage, MessageCursor, QuestionStreamValue, ResponseFormat,
}; };
use flowy_error::{ErrorCode, FlowyError, FlowyResult}; use flowy_error::{ErrorCode, FlowyError, FlowyResult};
use flowy_sqlite::kv::KVStorePreferences;
use flowy_sqlite::DBConnection; use flowy_sqlite::DBConnection;
use futures::{SinkExt, StreamExt}; use futures::{SinkExt, StreamExt};
use lib_infra::isolate_stream::IsolateSink; use lib_infra::isolate_stream::IsolateSink;
@ -40,7 +39,6 @@ pub struct Chat {
latest_message_id: Arc<AtomicI64>, latest_message_id: Arc<AtomicI64>,
stop_stream: Arc<AtomicBool>, stop_stream: Arc<AtomicBool>,
stream_buffer: Arc<Mutex<StringBuffer>>, stream_buffer: Arc<Mutex<StringBuffer>>,
store_preferences: Arc<KVStorePreferences>,
} }
impl Chat { impl Chat {
@ -49,7 +47,6 @@ impl Chat {
chat_id: String, chat_id: String,
user_service: Arc<dyn AIUserService>, user_service: Arc<dyn AIUserService>,
chat_service: Arc<AICloudServiceMiddleware>, chat_service: Arc<AICloudServiceMiddleware>,
store_preferences: Arc<KVStorePreferences>,
) -> Chat { ) -> Chat {
Chat { Chat {
uid, uid,
@ -60,7 +57,6 @@ impl Chat {
latest_message_id: Default::default(), latest_message_id: Default::default(),
stop_stream: Arc::new(AtomicBool::new(false)), stop_stream: Arc::new(AtomicBool::new(false)),
stream_buffer: Arc::new(Mutex::new(StringBuffer::default())), stream_buffer: Arc::new(Mutex::new(StringBuffer::default())),
store_preferences,
} }
} }

View File

@ -13,7 +13,6 @@ use futures::{SinkExt, StreamExt};
use lib_infra::isolate_stream::IsolateSink; use lib_infra::isolate_stream::IsolateSink;
use crate::stream_message::StreamMessage; use crate::stream_message::StreamMessage;
use flowy_sqlite::kv::KVStorePreferences;
use std::sync::{Arc, Weak}; use std::sync::{Arc, Weak};
use tokio::select; use tokio::select;
use tracing::info; use tracing::info;

View File

@ -180,12 +180,10 @@ impl ChatCloudService for AICloudServiceMiddleware {
Ok(stream::once(async { Err(FlowyError::local_ai_unavailable()) }).boxed()) Ok(stream::once(async { Err(FlowyError::local_ai_unavailable()) }).boxed())
}, },
} }
} else if self.local_ai.is_enabled() {
Err(FlowyError::local_ai_not_ready())
} else { } else {
if self.local_ai.is_enabled() { Err(FlowyError::local_ai_disabled())
Err(FlowyError::local_ai_not_ready())
} else {
Err(FlowyError::local_ai_disabled())
}
} }
} else { } else {
self self
@ -316,12 +314,10 @@ impl ChatCloudService for AICloudServiceMiddleware {
Ok(stream::once(async { Err(FlowyError::local_ai_unavailable()) }).boxed()) Ok(stream::once(async { Err(FlowyError::local_ai_unavailable()) }).boxed())
}, },
} }
} else if self.local_ai.is_enabled() {
Err(FlowyError::local_ai_not_ready())
} else { } else {
if self.local_ai.is_enabled() { Err(FlowyError::local_ai_disabled())
Err(FlowyError::local_ai_not_ready())
} else {
Err(FlowyError::local_ai_disabled())
}
} }
} else { } else {
self self