mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-08-22 23:25:39 +00:00
added check for api key version, and only modify url if we have api key set
This commit is contained in:
@ -141,12 +141,12 @@ impl OpenAIClient {
|
||||
}
|
||||
|
||||
async fn build_request(&self, method: Method, path: &str) -> reqwest::RequestBuilder {
|
||||
let url = format!(
|
||||
"{}/{}?api-version={}",
|
||||
self.api_endpoint,
|
||||
path,
|
||||
self.api_version.as_deref().unwrap_or("v1")
|
||||
);
|
||||
let mut url = format!("{}/{}", self.api_endpoint, path);
|
||||
|
||||
if self.api_version.is_some() {
|
||||
let api_version = self.api_version.as_ref().unwrap();
|
||||
url = format!("{}?api-version={}", url, api_version);
|
||||
}
|
||||
|
||||
let client = Client::builder();
|
||||
|
||||
|
Reference in New Issue
Block a user