From dc1b038ffae90a7a46613f6fd113fcef418ffeb3 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sat, 26 Jul 2025 18:59:08 -0400 Subject: [PATCH] only serve image references for prompts (future proofing) --- .../endpoints/prompts/get_prompt_handler.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/prompts/get_prompt_handler.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/prompts/get_prompt_handler.rs index 24c100fc8a..14b73f2a1a 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/prompts/get_prompt_handler.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/prompts/get_prompt_handler.rs @@ -289,13 +289,26 @@ pub async fn get_prompt_handler( Vec::new() }); - let items = items.iter().map(|item| { + let items = items.iter().filter_map(|item| { + match item.context_semantic_type { + PromptContextSemanticType::VidStartFrame => {}, + PromptContextSemanticType::VidEndFrame => {}, + PromptContextSemanticType::Imgref => {}, + PromptContextSemanticType::ImgrefCharacter => {}, + PromptContextSemanticType::ImgrefStyle => {}, + PromptContextSemanticType::ImgrefBg => {}, + _ => { + // NB: Only return images. In the future we may add context items for stages, persisted data, etc. + return None + }, + } + let bucket_path = MediaFileBucketPath::from_object_hash( &item.public_bucket_directory_hash, item.maybe_public_bucket_prefix.as_deref(), item.maybe_public_bucket_extension.as_deref()); - ImageContextItem { + Some(ImageContextItem { media_token: item.media_token.clone(), semantic: item.context_semantic_type, media_links: MediaLinksBuilder::from_media_path_and_env( @@ -303,7 +316,7 @@ pub async fn get_prompt_handler( server_state.server_environment, &bucket_path, ), - } + }) }).collect::>(); let maybe_context_images = if items.is_empty() {