summaryrefslogtreecommitdiffstats
path: root/src/client/openai.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-04-26 07:43:35 +0800
committerGitHub <noreply@github.com>2024-04-26 07:43:35 +0800
commit740ca2413a1992d151c0a9ea62c12e69321c0973 (patch)
treeccacd2fd5789064c091b212f26f3c46561f71f69 /src/client/openai.rs
parenta21e1213ccdd11d76f6338436c431e459ab8e574 (diff)
downloadaichat-740ca2413a1992d151c0a9ea62c12e69321c0973.tar.gz
refactor: simplify impl client trait (#445)
Diffstat (limited to 'src/client/openai.rs')
-rw-r--r--src/client/openai.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/client/openai.rs b/src/client/openai.rs
index bb9c07c..a0abc25 100644
--- a/src/client/openai.rs
+++ b/src/client/openai.rs
@@ -5,7 +5,6 @@ use super::{
use crate::utils::PromptKind;
use anyhow::{anyhow, bail, Result};
-use async_trait::async_trait;
use futures_util::StreamExt;
use reqwest::{Client as ReqwestClient, RequestBuilder};
use reqwest_eventsource::{Error as EventSourceError, Event, RequestBuilderExt};
@@ -25,8 +24,6 @@ pub struct OpenAIConfig {
pub extra: Option<ExtraConfig>,
}
-openai_compatible_client!(OpenAIClient);
-
impl OpenAIClient {
list_models_fn!(
OpenAIConfig,
@@ -159,3 +156,9 @@ pub fn openai_build_body(data: SendData, model: &Model) -> Value {
}
body
}
+
+impl_client_trait!(
+ OpenAIClient,
+ openai_send_message,
+ openai_send_message_streaming
+);