Simplify provider settings pages

This commit is contained in:
2026-08-11 02:00:31 -05:00
parent 10412c4c6f
commit 84945cd9be
10 changed files with 1382 additions and 786 deletions
+11 -10
View File
@@ -978,10 +978,13 @@ impl ModelCapabilityOverride {
)]
#[serde(rename_all = "snake_case")]
pub enum OpenAIProviderKind {
/// A regular OpenAI-compatible `/chat/completions` endpoint.
#[serde(alias = "openai")]
/// OpenAI's native Chat Completions API.
#[serde(rename = "openai", alias = "open_ai")]
OpenAI,
/// A LiteLLM endpoint using the OpenAI-compatible API plus LiteLLM metadata APIs.
#[serde(rename = "litellm", alias = "openai_compatible")]
#[default]
OpenAICompatible,
LiteLLM,
/// The ChatGPT subscription backend, authenticated with ChatGPT OAuth.
ChatGPTSubscription,
/// Anthropic's native Messages API.
@@ -993,14 +996,12 @@ pub enum OpenAIProviderKind {
VertexAI,
}
/// Configuration for a single OpenAI-compatible provider endpoint.
/// Configuration for a single direct model provider endpoint.
///
/// Multiple providers can be configured simultaneously (e.g. LiteLLM for cloud models,
/// Ollama for local models, etc.). Each provider has its own endpoint, credentials, and model list.
/// Multiple providers can be configured simultaneously. Each provider has its own endpoint,
/// credentials, and model list.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, schemars::JsonSchema)]
#[schemars(
description = "Configuration for an OpenAI-compatible provider endpoint (e.g. LiteLLM, Ollama, vLLM)."
)]
#[schemars(description = "Configuration for a direct model provider endpoint.")]
pub struct OpenAIProviderConfig {
#[serde(default)]
#[schemars(description = "Provider protocol and authentication kind.")]
@@ -1114,7 +1115,7 @@ pub(crate) fn default_chatgpt_provider() -> OpenAIProviderConfig {
fn default_openai_providers() -> Vec<OpenAIProviderConfig> {
vec![
OpenAIProviderConfig {
kind: OpenAIProviderKind::OpenAICompatible,
kind: OpenAIProviderKind::LiteLLM,
enabled: true,
name: "LiteLLM (ai.ryserve.net)".to_string(),
base_url: INITIAL_LITELLM_BASE_URL.to_string(),
+22 -9
View File
@@ -351,7 +351,7 @@ fn initial_litellm_provider_maps_codex_model_to_rig_without_a_committed_key() {
assert_eq!(providers.len(), 2);
let provider = &providers[0];
assert_eq!(provider.kind, OpenAIProviderKind::OpenAICompatible);
assert_eq!(provider.kind, OpenAIProviderKind::LiteLLM);
assert_eq!(provider.base_url, INITIAL_LITELLM_BASE_URL);
assert_eq!(provider.api_key, None);
assert_eq!(provider.models.len(), 1);
@@ -414,13 +414,6 @@ fn initial_litellm_provider_maps_codex_model_to_rig_without_a_committed_key() {
.map(str::to_string)
.collect::<Vec<_>>()
);
let instant = chatgpt
.models
.iter()
.find(|model| model.model_id == "gpt-5.3-instant")
.expect("GPT-5.3 Instant should be in the ChatGPT catalog");
assert!(instant.reasoning_efforts.is_empty());
}
#[test]
@@ -446,9 +439,29 @@ fn native_provider_settings_roundtrip_with_vertex_configuration() {
"models": []
}))
.expect("Legacy provider settings should remain compatible");
assert_eq!(legacy.kind, OpenAIProviderKind::OpenAICompatible);
assert_eq!(legacy.kind, OpenAIProviderKind::LiteLLM);
assert_eq!(legacy.project_id, None);
assert_eq!(legacy.location, None);
let legacy_openai_compatible: OpenAIProviderConfig =
serde_json::from_value(serde_json::json!({
"kind": "openai_compatible",
"name": "Legacy LiteLLM provider",
"base_url": "http://localhost:4000/v1",
"models": []
}))
.expect("Legacy OpenAI-compatible provider settings should deserialize");
assert_eq!(legacy_openai_compatible.kind, OpenAIProviderKind::LiteLLM);
let native_openai: OpenAIProviderConfig = serde_json::from_value(serde_json::json!({
"kind": "openai",
"name": "OpenAI",
"base_url": "https://api.openai.com/v1",
"api_key": "sk-test",
"models": []
}))
.expect("Native OpenAI provider settings should deserialize");
assert_eq!(native_openai.kind, OpenAIProviderKind::OpenAI);
}
#[test]