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 {
|
async fn build_request(&self, method: Method, path: &str) -> reqwest::RequestBuilder {
|
||||||
let url = format!(
|
let mut url = format!("{}/{}", self.api_endpoint, path);
|
||||||
"{}/{}?api-version={}",
|
|
||||||
self.api_endpoint,
|
if self.api_version.is_some() {
|
||||||
path,
|
let api_version = self.api_version.as_ref().unwrap();
|
||||||
self.api_version.as_deref().unwrap_or("v1")
|
url = format!("{}?api-version={}", url, api_version);
|
||||||
);
|
}
|
||||||
|
|
||||||
let client = Client::builder();
|
let client = Client::builder();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user