summaryrefslogtreecommitdiffstats
path: root/src/client.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2023-03-16 17:02:09 +0800
committerGitHub <noreply@github.com>2023-03-16 17:02:09 +0800
commit1ef97b2f32caecdb2eef9fe3755390f36d96eae5 (patch)
tree269d9504e5959d2ca161862e0935103adc84b393 /src/client.rs
parent4a74f5cd72160585721dbce1e92c110125d046dd (diff)
downloadaichat-1ef97b2f32caecdb2eef9fe3755390f36d96eae5.tar.gz
feat: support multiple models (#71)
Diffstat (limited to 'src/client.rs')
-rw-r--r--src/client.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/client.rs b/src/client.rs
index 916a1ef..b438440 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -12,7 +12,6 @@ use tokio::time::sleep;
const CONNECT_TIMEOUT: Duration = Duration::from_secs(10);
const API_URL: &str = "https://api.openai.com/v1/chat/completions";
-const MODEL: &str = "gpt-3.5-turbo";
#[derive(Debug)]
pub struct ChatGptClient {
@@ -137,9 +136,10 @@ impl ChatGptClient {
}
fn request_builder(&self, content: &str, stream: bool) -> Result<RequestBuilder> {
+ let (model, _) = self.config.read().get_model();
let messages = self.config.read().build_messages(content)?;
let mut body = json!({
- "model": MODEL,
+ "model": model,
"messages": messages,
});