fix: update async item service initialization

feat: remove unused meta plugin imports
fix: update meta plugin type implementation

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-28 14:44:22 -03:00
parent cb8caed662
commit ec6f0de95b
2 changed files with 70 additions and 10 deletions

View File

@@ -43,7 +43,13 @@ pub async fn handle_list_items(
.map(|s| s.split(',').map(|t| t.trim().to_string()).collect())
.unwrap_or_default();
let item_service = AsyncItemService::new(state.data_dir.clone(), state.db.clone(), state.item_service.clone());
let item_service = AsyncItemService::new(
state.data_dir.clone(),
state.db.clone(),
state.item_service.clone(),
state.cmd.clone(),
state.settings.clone()
);
let mut items_with_meta = item_service
.list_items(tags, HashMap::new())
.await
@@ -166,7 +172,13 @@ pub async fn handle_get_item_latest_content(
.map(|s| s.split(',').map(|t| t.trim().to_string()).collect())
.unwrap_or_default();
let item_service = AsyncItemService::new(state.data_dir.clone(), state.db.clone(), state.item_service.clone());
let item_service = AsyncItemService::new(
state.data_dir.clone(),
state.db.clone(),
state.item_service.clone(),
state.cmd.clone(),
state.settings.clone()
);
// First find the item to get its ID and metadata
let item_with_meta = item_service
@@ -222,7 +234,13 @@ pub async fn handle_get_item_content(
return Err(StatusCode::BAD_REQUEST);
}
let item_service = AsyncItemService::new(state.data_dir.clone(), state.db.clone(), state.item_service.clone());
let item_service = AsyncItemService::new(
state.data_dir.clone(),
state.db.clone(),
state.item_service.clone(),
state.cmd.clone(),
state.settings.clone()
);
stream_item_content_response(&item_service, item_id, params.allow_binary, params.offset, params.length).await
}
@@ -325,7 +343,13 @@ pub async fn handle_get_item_latest_meta(
.map(|s| s.split(',').map(|t| t.trim().to_string()).collect())
.unwrap_or_default();
let item_service = AsyncItemService::new(state.data_dir.clone(), state.db.clone(), state.item_service.clone());
let item_service = AsyncItemService::new(
state.data_dir.clone(),
state.db.clone(),
state.item_service.clone(),
state.cmd.clone(),
state.settings.clone()
);
match item_service.find_item(vec![], tags, HashMap::new()).await {
Ok(item_with_meta) => {
@@ -372,7 +396,13 @@ pub async fn handle_get_item_meta(
State(state): State<AppState>,
Path(item_id): Path<i64>,
) -> Result<Json<ApiResponse<HashMap<String, String>>>, StatusCode> {
let item_service = AsyncItemService::new(state.data_dir.clone(), state.db.clone(), state.item_service.clone());
let item_service = AsyncItemService::new(
state.data_dir.clone(),
state.db.clone(),
state.item_service.clone(),
state.cmd.clone(),
state.settings.clone()
);
match item_service.get_item(item_id).await {
Ok(item_with_meta) => {