From 4853fad7305190beba6f56685db354b1235d8efb Mon Sep 17 00:00:00 2001 From: syui Date: Fri, 23 Feb 2024 15:30:30 +0900 Subject: [PATCH] fix openai prompt --- src/bot.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bot.rs b/src/bot.rs index 5eda142..7a85276 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -59,15 +59,18 @@ pub fn c_bot(c: &Context) { let mut com = "".to_string(); let mut prompt = "".to_string(); let mut prompt_sub = "".to_string(); + let mut prompt_chat = "".to_string(); if reason == "mention" { com = vec[1].trim().to_string(); prompt = vec[2..].join(" "); + prompt_chat = vec[1..].join(" "); if vec.len() > 2 { prompt_sub = vec[3..].join(" "); } } else if reason == "reply" { com = vec[0].trim().to_string(); prompt = vec[1..].join(" "); + prompt_chat = vec[0..].join(" "); if vec.len() > 1 { prompt_sub = vec[2..].join(" "); } @@ -335,7 +338,7 @@ pub fn c_bot(c: &Context) { } } else { // openai - let str_openai = openai::post_request(prompt.to_string()).await; + let str_openai = openai::post_request(prompt_chat.to_string()).await; let text_limit = c_char(str_openai); let str_rep = reply::post_request( text_limit.to_string(),