Skip to content

Commit e3a0806

Browse files
committed
chore: clippy
1 parent b63c4df commit e3a0806

File tree

4 files changed

+6
-18
lines changed

4 files changed

+6
-18
lines changed

frontend/rust-lib/flowy-ai/src/ai_manager.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ impl AIManager {
139139
chat_id.to_string(),
140140
self.user_service.clone(),
141141
self.cloud_service_wm.clone(),
142-
self.store_preferences.clone(),
143142
))
144143
});
145144
if self.local_ai.is_running() {
@@ -235,7 +234,6 @@ impl AIManager {
235234
chat_id.to_string(),
236235
self.user_service.clone(),
237236
self.cloud_service_wm.clone(),
238-
self.store_preferences.clone(),
239237
));
240238
self.chats.insert(chat_id.to_string(), chat.clone());
241239
Ok(chat)
@@ -495,7 +493,6 @@ impl AIManager {
495493
chat_id.to_string(),
496494
self.user_service.clone(),
497495
self.cloud_service_wm.clone(),
498-
self.store_preferences.clone(),
499496
));
500497
self.chats.insert(chat_id.to_string(), chat.clone());
501498
Ok(chat)

frontend/rust-lib/flowy-ai/src/chat.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use flowy_ai_pub::cloud::{
1515
AIModel, ChatCloudService, ChatMessage, MessageCursor, QuestionStreamValue, ResponseFormat,
1616
};
1717
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
18-
use flowy_sqlite::kv::KVStorePreferences;
1918
use flowy_sqlite::DBConnection;
2019
use futures::{SinkExt, StreamExt};
2120
use lib_infra::isolate_stream::IsolateSink;
@@ -40,7 +39,6 @@ pub struct Chat {
4039
latest_message_id: Arc<AtomicI64>,
4140
stop_stream: Arc<AtomicBool>,
4241
stream_buffer: Arc<Mutex<StringBuffer>>,
43-
store_preferences: Arc<KVStorePreferences>,
4442
}
4543

4644
impl Chat {
@@ -49,7 +47,6 @@ impl Chat {
4947
chat_id: String,
5048
user_service: Arc<dyn AIUserService>,
5149
chat_service: Arc<AICloudServiceMiddleware>,
52-
store_preferences: Arc<KVStorePreferences>,
5350
) -> Chat {
5451
Chat {
5552
uid,
@@ -60,7 +57,6 @@ impl Chat {
6057
latest_message_id: Default::default(),
6158
stop_stream: Arc::new(AtomicBool::new(false)),
6259
stream_buffer: Arc::new(Mutex::new(StringBuffer::default())),
63-
store_preferences,
6460
}
6561
}
6662

frontend/rust-lib/flowy-ai/src/completion.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use futures::{SinkExt, StreamExt};
1313
use lib_infra::isolate_stream::IsolateSink;
1414

1515
use crate::stream_message::StreamMessage;
16-
use flowy_sqlite::kv::KVStorePreferences;
1716
use std::sync::{Arc, Weak};
1817
use tokio::select;
1918
use tracing::info;

frontend/rust-lib/flowy-ai/src/middleware/chat_service_mw.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,10 @@ impl ChatCloudService for AICloudServiceMiddleware {
180180
Ok(stream::once(async { Err(FlowyError::local_ai_unavailable()) }).boxed())
181181
},
182182
}
183+
} else if self.local_ai.is_enabled() {
184+
Err(FlowyError::local_ai_not_ready())
183185
} else {
184-
if self.local_ai.is_enabled() {
185-
Err(FlowyError::local_ai_not_ready())
186-
} else {
187-
Err(FlowyError::local_ai_disabled())
188-
}
186+
Err(FlowyError::local_ai_disabled())
189187
}
190188
} else {
191189
self
@@ -316,12 +314,10 @@ impl ChatCloudService for AICloudServiceMiddleware {
316314
Ok(stream::once(async { Err(FlowyError::local_ai_unavailable()) }).boxed())
317315
},
318316
}
317+
} else if self.local_ai.is_enabled() {
318+
Err(FlowyError::local_ai_not_ready())
319319
} else {
320-
if self.local_ai.is_enabled() {
321-
Err(FlowyError::local_ai_not_ready())
322-
} else {
323-
Err(FlowyError::local_ai_disabled())
324-
}
320+
Err(FlowyError::local_ai_disabled())
325321
}
326322
} else {
327323
self

0 commit comments

Comments
 (0)