diff options
| author | sigoden <sigoden@gmail.com> | 2024-04-26 07:43:35 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-26 07:43:35 +0800 |
| commit | 740ca2413a1992d151c0a9ea62c12e69321c0973 (patch) | |
| tree | ccacd2fd5789064c091b212f26f3c46561f71f69 /src/client/openai.rs | |
| parent | a21e1213ccdd11d76f6338436c431e459ab8e574 (diff) | |
| download | aichat-740ca2413a1992d151c0a9ea62c12e69321c0973.tar.gz | |
refactor: simplify impl client trait (#445)
Diffstat (limited to 'src/client/openai.rs')
| -rw-r--r-- | src/client/openai.rs | 9 |
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 +); |
