fix: remove filter_service and fix function arguments

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 21:08:41 -03:00
parent 8fcccf68e3
commit fe19ba0c5c
3 changed files with 51 additions and 109 deletions

View File

@@ -127,7 +127,18 @@ async fn handle_as_meta_response_with_metadata(
text_val == "false"
} else {
// If text metadata isn't set, we need to check the content using streaming approach
match item_service.get_item_content_info_streaming(item_id).await {
match item_service.get_item_content_info_streaming(
item_id,
None,
None,
None,
None,
None,
None,
None,
None,
None
).await {
Ok((_, _, is_binary)) => is_binary,
Err(e) => {
warn!("Failed to get content info for binary check for item {}: {}", item_id, e);
@@ -153,7 +164,18 @@ async fn handle_as_meta_response_with_metadata(
Ok(response)
} else {
// Get the content as text
match item_service.get_item_content_info(item_id).await {
match item_service.get_item_content_info(
item_id,
None,
None,
None,
None,
None,
None,
None,
None,
None
).await {
Ok((content, _, _)) => {
// Apply offset and length
let content_len = content.len() as u64;
@@ -307,11 +329,11 @@ pub async fn handle_get_item_latest_content(
let item_id = item.item.id.unwrap();
let metadata = item.meta_as_map();
// Handle as_meta parameter
if params.as_meta.unwrap_or(false) {
if params.as_meta {
// Force stream=false and allow_binary=false for as_meta=true
handle_as_meta_response_with_metadata(&item_service, item_id, &metadata, params.offset.unwrap_or(0), params.length.unwrap_or(0)).await
handle_as_meta_response_with_metadata(&item_service, item_id, &metadata, params.offset, params.length).await
} else {
stream_item_content_response_with_metadata(&item_service, item_id, &metadata, params.allow_binary.unwrap_or(false), params.offset.unwrap_or(0), params.length.unwrap_or(0), params.stream.unwrap_or(false)).await
stream_item_content_response_with_metadata(&item_service, item_id, &metadata, params.allow_binary, params.offset, params.length, params.stream).await
}
}
Err(CoreError::ItemNotFoundGeneric) => Err(StatusCode::NOT_FOUND),
@@ -371,15 +393,15 @@ pub async fn handle_get_item_content(
state.settings.clone()
);
// Handle as_meta parameter
if params.as_meta.unwrap_or(false) {
if params.as_meta {
// Force stream=false and allow_binary=false for as_meta=true
let result = handle_as_meta_response(&item_service, item_id, params.offset.unwrap_or(0), params.length.unwrap_or(0)).await;
let result = handle_as_meta_response(&item_service, item_id, params.offset, params.length).await;
if let Ok(response) = &result {
debug!("ITEM_API: Response content-length: {:?}", response.headers().get("content-length"));
}
result
} else {
let result = stream_item_content_response(&item_service, item_id, params.allow_binary.unwrap_or(false), params.offset.unwrap_or(0), params.length.unwrap_or(0), params.stream.unwrap_or(false)).await;
let result = stream_item_content_response(&item_service, item_id, params.allow_binary, params.offset, params.length, params.stream).await;
if let Ok(response) = &result {
debug!("ITEM_API: Response content-length: {:?}", response.headers().get("content-length"));
}
@@ -459,7 +481,18 @@ async fn stream_item_content_response_with_metadata(
}
} else {
debug!("NON-STREAMING: Building full response in memory");
match item_service.get_item_content_info(item_id).await {
match item_service.get_item_content_info(
item_id,
None,
None,
None,
None,
None,
None,
None,
None,
None
).await {
Ok((content, _, _)) => {
// Apply offset and length
let content_len = content.len() as u64;