fix: resolve ownership and borrowing errors and add serde traits

Co-authored-by: aider (openai/andrew/openrouter/google/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-25 13:06:54 -03:00
parent 53c63360cb
commit ee0545b739
7 changed files with 19 additions and 15 deletions

View File

@@ -100,7 +100,7 @@ impl KeepTools {
let item = item_with_content.item_with_meta.item;
let content = String::from_utf8_lossy(&item_with_content.content).to_string();
let tags: Vec<String> = item_with_content.item_with_meta.tags.into_iter().map(|t| t.name).collect();
let tags: Vec<String> = item_with_content.item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
let metadata = item_with_content.item_with_meta.meta_as_map();
let response = serde_json::json!({
@@ -118,6 +118,7 @@ impl KeepTools {
pub async fn get_latest_item(&self, args: Option<Value>) -> Result<String, ToolError> {
let tags: Vec<String> = args
.as_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())
@@ -136,7 +137,7 @@ impl KeepTools {
let item = item_with_content.item_with_meta.item;
let content = String::from_utf8_lossy(&item_with_content.content).to_string();
let tags: Vec<String> = item_with_content.item_with_meta.tags.into_iter().map(|t| t.name).collect();
let tags: Vec<String> = item_with_content.item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
let metadata = item_with_content.item_with_meta.meta_as_map();
let response = serde_json::json!({
@@ -182,7 +183,7 @@ impl KeepTools {
.map(|item_with_meta| {
let item = item_with_meta.item;
let item_id = item.id.unwrap_or(0);
let item_tags: Vec<String> = item_with_meta.tags.into_iter().map(|t| t.name).collect();
let item_tags: Vec<String> = item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
let item_meta = item_with_meta.meta_as_map();
serde_json::json!({
@@ -234,7 +235,7 @@ impl KeepTools {
.map(|item_with_meta| {
let item = item_with_meta.item;
let item_id = item.id.unwrap_or(0);
let item_tags: Vec<String> = item_with_meta.tags.into_iter().map(|t| t.name).collect();
let item_tags: Vec<String> = item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
let item_meta = item_with_meta.meta_as_map();
serde_json::json!({