Add UI for configuring the API Url directly (#32248)
Closes #22901 Release Notes: - Copilot Chat endpoint URLs can now be configured via `settings.json` or Configuration View.
This commit is contained in:
@@ -272,7 +272,11 @@ pub struct ZedDotDevSettingsContent {
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq, JsonSchema)]
|
||||
pub struct CopilotChatSettingsContent {}
|
||||
pub struct CopilotChatSettingsContent {
|
||||
pub api_url: Option<String>,
|
||||
pub auth_url: Option<String>,
|
||||
pub models_url: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq, JsonSchema)]
|
||||
pub struct OpenRouterSettingsContent {
|
||||
@@ -431,6 +435,24 @@ impl settings::Settings for AllLanguageModelSettings {
|
||||
.as_ref()
|
||||
.and_then(|s| s.available_models.clone()),
|
||||
);
|
||||
|
||||
// Copilot Chat
|
||||
let copilot_chat = value.copilot_chat.clone().unwrap_or_default();
|
||||
|
||||
settings.copilot_chat.api_url = copilot_chat.api_url.map_or_else(
|
||||
|| Arc::from("https://api.githubcopilot.com/chat/completions"),
|
||||
Arc::from,
|
||||
);
|
||||
|
||||
settings.copilot_chat.auth_url = copilot_chat.auth_url.map_or_else(
|
||||
|| Arc::from("https://api.github.com/copilot_internal/v2/token"),
|
||||
Arc::from,
|
||||
);
|
||||
|
||||
settings.copilot_chat.models_url = copilot_chat.models_url.map_or_else(
|
||||
|| Arc::from("https://api.githubcopilot.com/models"),
|
||||
Arc::from,
|
||||
);
|
||||
}
|
||||
|
||||
Ok(settings)
|
||||
|
||||
Reference in New Issue
Block a user