add implicit "Continue" option to all conversations

This commit is contained in:
yuni 2024-10-26 00:40:46 +02:00
parent 3234b1f4bb
commit b01d53833b

View file

@ -25,6 +25,8 @@ pub const CHATS: &[&str] = &[
include_str!("chats/thebe.yaml"), include_str!("chats/thebe.yaml"),
]; ];
pub const TEXT_CONTINUE: &str = "Continue...";
pub const TOKEN_CHAT: &str = "chat"; pub const TOKEN_CHAT: &str = "chat";
pub const TOKEN_MSG: &str = "msg"; pub const TOKEN_MSG: &str = "msg";
pub const TOKEN_SYSTEM: &str = "system"; pub const TOKEN_SYSTEM: &str = "system";
@ -633,6 +635,20 @@ impl ChatDB {
break; 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<usize> = chat.position.clone();
event.send(ChatEvent::SpawnChoice(
String::from(TEXT_CONTINUE),
0,
goto,
true,
None,
));
}
} }
} }
} }