Skip to content

Commit f1a7664

Browse files
authored
chore: Skip sending profileArn when using custom endpoints (#2777)
* comment profile set * comment profile in apiclient * add a helper func * fix compile issue * remove dead code tag
1 parent 3aa06eb commit f1a7664

File tree

1 file changed

+18
-6
lines changed
  • crates/chat-cli/src/api_client

1 file changed

+18
-6
lines changed

crates/chat-cli/src/api_client/mod.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,19 @@ impl ApiClient {
193193
},
194194
}
195195

196-
let profile = match database.get_auth_profile() {
197-
Ok(profile) => profile,
198-
Err(err) => {
199-
error!("Failed to get auth profile: {err}");
200-
None
201-
},
196+
// Check if using custom endpoint
197+
let use_profile = !Self::is_custom_endpoint(database);
198+
let profile = if use_profile {
199+
match database.get_auth_profile() {
200+
Ok(profile) => profile,
201+
Err(err) => {
202+
error!("Failed to get auth profile: {err}");
203+
None
204+
},
205+
}
206+
} else {
207+
debug!("Custom endpoint detected, skipping profile ARN");
208+
None
202209
};
203210

204211
Ok(Self {
@@ -598,6 +605,11 @@ impl ApiClient {
598605

599606
self.mock_client = Some(Arc::new(Mutex::new(mock.into_iter())));
600607
}
608+
609+
// Add a helper method to check if using non-default endpoint
610+
fn is_custom_endpoint(database: &Database) -> bool {
611+
database.settings.get(Setting::ApiCodeWhispererService).is_some()
612+
}
601613
}
602614

603615
fn timeout_config(database: &Database) -> TimeoutConfig {

0 commit comments

Comments
 (0)