diff options
| author | sigoden <sigoden@gmail.com> | 2023-10-26 19:19:22 +0800 |
|---|---|---|
| committer | sigoden <sigoden@gmail.com> | 2023-10-26 19:19:22 +0800 |
| commit | 66fd547c0fac30d98565a92d93824237a4813669 (patch) | |
| tree | 332ca0d0927739de69ff4e7b8ac589f4f001f9f1 /src/client/openai.rs | |
| parent | 7d8564cafb45afc4bccb666a310615b164800a9a (diff) | |
| download | aichat-66fd547c0fac30d98565a92d93824237a4813669.tar.gz | |
refactor: improve code quanity
remove tokio::runtime::Runtime from client
Diffstat (limited to 'src/client/openai.rs')
| -rw-r--r-- | src/client/openai.rs | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/src/client/openai.rs b/src/client/openai.rs index 932dc79..8ad3bab 100644 --- a/src/client/openai.rs +++ b/src/client/openai.rs @@ -13,7 +13,6 @@ use serde::Deserialize; use serde_json::{json, Value}; use std::env; use std::time::Duration; -use tokio::runtime::Runtime; const API_URL: &str = "https://api.openai.com/v1/chat/completions"; @@ -23,7 +22,6 @@ pub struct OpenAIClient { global_config: SharedConfig, local_config: OpenAIConfig, model_info: ModelInfo, - runtime: Runtime, } #[allow(clippy::struct_excessive_bools)] @@ -42,10 +40,6 @@ impl Client for OpenAIClient { &self.global_config } - fn get_runtime(&self) -> &Runtime { - &self.runtime - } - async fn send_message_inner(&self, content: &str) -> Result<String> { let builder = self.request_builder(content, false)?; openai_send_message(builder).await @@ -66,13 +60,11 @@ impl OpenAIClient { global_config: SharedConfig, local_config: OpenAIConfig, model_info: ModelInfo, - runtime: Runtime, ) -> Self { Self { global_config, local_config, model_info, - runtime, } } |
