add implicit "Continue" option to all conversations
This commit is contained in:
parent
3234b1f4bb
commit
b01d53833b
16
src/chat.rs
16
src/chat.rs
|
@ -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,
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue