From b01d53833bca007616a36cc28b5aefe1cb7c758a Mon Sep 17 00:00:00 2001 From: yuni Date: Sat, 26 Oct 2024 00:40:46 +0200 Subject: [PATCH] add implicit "Continue" option to all conversations --- src/chat.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/chat.rs b/src/chat.rs index 22c3f8a..8c21c10 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -25,6 +25,8 @@ pub const CHATS: &[&str] = &[ include_str!("chats/thebe.yaml"), ]; +pub const TEXT_CONTINUE: &str = "Continue..."; + pub const TOKEN_CHAT: &str = "chat"; pub const TOKEN_MSG: &str = "msg"; pub const TOKEN_SYSTEM: &str = "system"; @@ -633,6 +635,20 @@ impl ChatDB { break; } } + + // Add a "Continue" choice to any conversation line that doesn't define any choices + let choices_available = key > 0; + let at_exit = chat.position.is_empty(); + if !choices_available && !at_exit { + let goto: Vec = chat.position.clone(); + event.send(ChatEvent::SpawnChoice( + String::from(TEXT_CONTINUE), + 0, + goto, + true, + None, + )); + } } } }