mirror of
https://github.com/aljazceru/goose.git
synced 2026-02-23 15:34:27 +01:00
fix(provider): update url path handling for azure provider (#1443)
Co-authored-by: Zengyu <sizengyu@spgroup.com.sg>
This commit is contained in:
@@ -64,10 +64,21 @@ impl AzureProvider {
|
||||
let mut base_url = url::Url::parse(&self.endpoint)
|
||||
.map_err(|e| ProviderError::RequestFailed(format!("Invalid base URL: {e}")))?;
|
||||
|
||||
base_url.set_path(&format!(
|
||||
"openai/deployments/{}/chat/completions",
|
||||
self.deployment_name
|
||||
));
|
||||
// Get the existing path without trailing slashes
|
||||
let existing_path = base_url.path().trim_end_matches('/');
|
||||
let new_path = if existing_path.is_empty() {
|
||||
format!(
|
||||
"/openai/deployments/{}/chat/completions",
|
||||
self.deployment_name
|
||||
)
|
||||
} else {
|
||||
format!(
|
||||
"{}/openai/deployments/{}/chat/completions",
|
||||
existing_path, self.deployment_name
|
||||
)
|
||||
};
|
||||
|
||||
base_url.set_path(&new_path);
|
||||
base_url.set_query(Some(&format!("api-version={}", self.api_version)));
|
||||
|
||||
let response: reqwest::Response = self
|
||||
|
||||
Reference in New Issue
Block a user