Skip to content

Commit

Permalink
Include most recent message in response
Browse files Browse the repository at this point in the history
  • Loading branch information
willcrichton committed Sep 4, 2024
1 parent 7cc0479 commit b880f6e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions crates/chatbot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ pub async fn gen_random_number() -> usize {
/// Generates a list of possible responses given the current chat.
///
/// Warning: may take a few seconds!
pub async fn query_chat(_messages: &[String]) -> Vec<String> {
pub async fn query_chat(messages: &[String]) -> Vec<String> {
tokio::time::sleep(Duration::from_secs(2)).await;
let most_recent = messages.last().unwrap();
vec![
"And how does that make you feel?".to_string(),
"Interesting! Go on...".to_string(),
format!("\"{most_recent}\"? And how does that make you feel?"),
format!("\"{most_recent}\"! Interesting! Go on..."),
]
}

0 comments on commit b880f6e

Please sign in to comment.