fix: resolve borrow and move errors and remove unused imports
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -7,7 +7,6 @@ use futures::stream::{self, Stream};
|
||||
use log::{debug, info};
|
||||
use std::convert::Infallible;
|
||||
use std::time::Duration;
|
||||
use tokio_stream::StreamExt as _;
|
||||
|
||||
use crate::modes::server::common::AppState;
|
||||
use crate::modes::server::mcp::KeepMcpServer;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use anyhow::Result;
|
||||
use log::{debug, warn};
|
||||
use log::debug;
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::modes::server::common::AppState;
|
||||
|
||||
@@ -98,10 +98,11 @@ impl KeepTools {
|
||||
];
|
||||
|
||||
for plugin_type in meta_plugins {
|
||||
let plugin_type_clone = plugin_type.clone();
|
||||
let mut plugin = get_meta_plugin(plugin_type);
|
||||
if plugin.is_supported() {
|
||||
if let Err(e) = plugin.initialize(&*conn, item_id) {
|
||||
warn!("Failed to initialize plugin {:?}: {}", plugin_type, e);
|
||||
warn!("Failed to initialize plugin {:?}: {}", plugin_type_clone, e);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -120,7 +121,7 @@ impl KeepTools {
|
||||
plugin.update(&buffer, &*conn);
|
||||
|
||||
if let Err(e) = plugin.finalize(&*conn) {
|
||||
warn!("Failed to finalize plugin {:?}: {}", plugin_type, e);
|
||||
warn!("Failed to finalize plugin {:?}: {}", plugin_type_clone, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -215,21 +216,19 @@ impl KeepTools {
|
||||
}
|
||||
|
||||
pub async fn list_items(&self, args: Option<Value>) -> Result<String, ToolError> {
|
||||
let tags: Vec<String> = args
|
||||
.as_ref()
|
||||
let args_ref = args.as_ref();
|
||||
let tags: Vec<String> = args_ref
|
||||
.and_then(|v| v.get("tags"))
|
||||
.and_then(|v| v.as_array())
|
||||
.map(|arr| arr.iter().filter_map(|v| v.as_str().map(|s| s.to_string())).collect())
|
||||
.unwrap_or_default();
|
||||
|
||||
let limit = args
|
||||
.as_ref()
|
||||
let limit = args_ref
|
||||
.and_then(|v| v.get("limit"))
|
||||
.and_then(|v| v.as_u64())
|
||||
.unwrap_or(10) as usize;
|
||||
|
||||
let offset = args
|
||||
.as_ref()
|
||||
let offset = args_ref
|
||||
.and_then(|v| v.get("offset"))
|
||||
.and_then(|v| v.as_u64())
|
||||
.unwrap_or(0) as usize;
|
||||
|
||||
Reference in New Issue
Block a user