fix: update module declarations and imports

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:03:59 -03:00
parent a1bcba5cb1
commit 53c63360cb
4 changed files with 11 additions and 11 deletions

View File

@@ -1,8 +1,7 @@
use anyhow::{Result, anyhow};
use serde_json::Value;
use std::collections::HashMap;
use std::str::FromStr;
use log::{debug, warn};
use log::{debug};
use crate::modes::server::common::AppState;
use crate::core::async_item_service::AsyncItemService;
@@ -74,7 +73,7 @@ impl KeepTools {
let item_with_meta = service
.save_item_from_mcp(content.as_bytes().to_vec(), tags, metadata)
.await
.map_err(|e| ToolError::Other(anyhow!(e)))?;
.map_err(|e| ToolError::Other(anyhow::Error::from(e)))?;
let item_id = item_with_meta
.item
@@ -96,7 +95,7 @@ impl KeepTools {
let item_with_content = match service.get_item_content(item_id).await {
Ok(iwc) => iwc,
Err(CoreError::ItemNotFound(_)) => return Err(ToolError::InvalidArguments(format!("Item {} not found", item_id))),
Err(e) => return Err(ToolError::Other(anyhow!(e))),
Err(e) => return Err(ToolError::Other(anyhow::Error::from(e))),
};
let item = item_with_content.item_with_meta.item;
@@ -129,11 +128,11 @@ impl KeepTools {
let item_with_meta = match service.find_item(vec![], tags, HashMap::new()).await {
Ok(iwm) => iwm,
Err(CoreError::ItemNotFoundGeneric) => return Err(ToolError::InvalidArguments("No items found".to_string())),
Err(e) => return Err(ToolError::Other(anyhow!(e))),
Err(e) => return Err(ToolError::Other(anyhow::Error::from(e))),
};
let item_id = item_with_meta.item.id.ok_or_else(|| anyhow!("Item missing ID after find"))?;
let item_with_content = service.get_item_content(item_id).await.map_err(|e| ToolError::Other(anyhow!(e)))?;
let item_with_content = service.get_item_content(item_id).await.map_err(|e| ToolError::Other(anyhow::Error::from(e)))?;
let item = item_with_content.item_with_meta.item;
let content = String::from_utf8_lossy(&item_with_content.content).to_string();
@@ -172,7 +171,7 @@ impl KeepTools {
.unwrap_or(0) as usize;
let service = AsyncItemService::new(self.state.data_dir.clone(), self.state.db.clone());
let mut items_with_meta = service.list_items(tags, HashMap::new()).await.map_err(|e| ToolError::Other(anyhow!(e)))?;
let mut items_with_meta = service.list_items(tags, HashMap::new()).await.map_err(|e| ToolError::Other(anyhow::Error::from(e)))?;
// Sort by timestamp (newest first) and apply pagination
items_with_meta.sort_by(|a, b| b.item.ts.cmp(&a.item.ts));
@@ -225,7 +224,7 @@ impl KeepTools {
.unwrap_or_default();
let service = AsyncItemService::new(self.state.data_dir.clone(), self.state.db.clone());
let mut items_with_meta = service.list_items(tags.clone(), metadata.clone()).await.map_err(|e| ToolError::Other(anyhow!(e)))?;
let mut items_with_meta = service.list_items(tags.clone(), metadata.clone()).await.map_err(|e| ToolError::Other(anyhow::Error::from(e)))?;
// Sort by timestamp (newest first)
items_with_meta.sort_by(|a, b| b.item.ts.cmp(&a.item.ts));