1
0

fix openai prompt

This commit is contained in:
syui 2024-02-23 15:30:30 +09:00
parent a6fa5c2ef5
commit 4853fad730
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56

View File

@ -59,15 +59,18 @@ pub fn c_bot(c: &Context) {
let mut com = "".to_string(); let mut com = "".to_string();
let mut prompt = "".to_string(); let mut prompt = "".to_string();
let mut prompt_sub = "".to_string(); let mut prompt_sub = "".to_string();
let mut prompt_chat = "".to_string();
if reason == "mention" { if reason == "mention" {
com = vec[1].trim().to_string(); com = vec[1].trim().to_string();
prompt = vec[2..].join(" "); prompt = vec[2..].join(" ");
prompt_chat = vec[1..].join(" ");
if vec.len() > 2 { if vec.len() > 2 {
prompt_sub = vec[3..].join(" "); prompt_sub = vec[3..].join(" ");
} }
} else if reason == "reply" { } else if reason == "reply" {
com = vec[0].trim().to_string(); com = vec[0].trim().to_string();
prompt = vec[1..].join(" "); prompt = vec[1..].join(" ");
prompt_chat = vec[0..].join(" ");
if vec.len() > 1 { if vec.len() > 1 {
prompt_sub = vec[2..].join(" "); prompt_sub = vec[2..].join(" ");
} }
@ -335,7 +338,7 @@ pub fn c_bot(c: &Context) {
} }
} else { } else {
// openai // 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 text_limit = c_char(str_openai);
let str_rep = reply::post_request( let str_rep = reply::post_request(
text_limit.to_string(), text_limit.to_string(),