From cab4840a61e34db41757b0618a767e2b580cfd5e Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sat, 18 Feb 2023 03:04:07 -0500 Subject: [PATCH] Sigil value in API for UNREAL's sake. Ugh. --- .../get_next_news_story_audio_file_handler.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/programs/aichatbot-sidecar/src/web_server/handlers/news_stories/get_next_news_story_audio_file_handler.rs b/crates/programs/aichatbot-sidecar/src/web_server/handlers/news_stories/get_next_news_story_audio_file_handler.rs index f6a9a2878e..9d62292c32 100644 --- a/crates/programs/aichatbot-sidecar/src/web_server/handlers/news_stories/get_next_news_story_audio_file_handler.rs +++ b/crates/programs/aichatbot-sidecar/src/web_server/handlers/news_stories/get_next_news_story_audio_file_handler.rs @@ -45,8 +45,14 @@ pub struct GetNextNewsStoryAudioFileResponse { pub has_next_in_sequence: bool, /// If there's a next cursor in the current sequence, this is it. + /// If no such cursor, the field will be set to JSON NULL. pub maybe_next_cursor: Option, + /// If there's a next cursor in the current sequence, this is it. + /// If no such cursor, the field will be set to the sigil "-1". + /// This is for Unreal Engine's sake, which is sloppy with handling JSON. + pub maybe_next_cursor_else_sigil_value: i64, + //pub audio_total_duration_seconds: u64, } @@ -152,7 +158,10 @@ pub async fn get_next_news_story_audio_file_handler( current_audio_index: audio_cursor as u64, audio_file_path: audio_filename, has_next_in_sequence, - maybe_next_cursor, + maybe_next_cursor: maybe_next_cursor.clone(), + maybe_next_cursor_else_sigil_value: maybe_next_cursor + .map(|val| val as i64) + .unwrap_or(-1), }; warn!("Response: {:?}", &response);