Skip to content

Your lightweight open-source personal agent.

fix(webui): show custom provider API controls directly

chengyongru10a979ab006e
diff --git a/docs/configuration.md b/docs/configuration.md
index eb6360cc4..c6f0615fa 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -1433,7 +1433,7 @@ Set `agents.defaults.modelPreset` to choose the preset followed by sessions that
### Custom connection APIs
-Custom providers use Chat Completions by default. If your service requires another protocol, open its WebUI connection editor and expand **Advanced options**. Use **Supported APIs** to select the protocols the service accepts and **Default API** to choose the default for Auto presets. Hover, focus, or tap a setting label for help. Existing connections without a declaration retain their previous Auto behavior; use **Set supported APIs** to add one.
+Custom providers use Chat Completions by default. If your service requires another protocol, open its WebUI connection editor and expand **Advanced options**. Use **Supported APIs** to select the protocols the service accepts and **Default API** to choose the default for Auto presets. Hover, focus, or tap a setting label for help. Existing connections without a declaration retain their previous behavior until you change these controls.
In `config.json`, set `providers.<name>.api` for the built-in `custom` provider or a named custom provider:
diff --git a/webui/src/components/settings/models/ProviderAPIControl.tsx b/webui/src/components/settings/models/ProviderAPIControl.tsx
index 3d14f5b8c..81fb682ec 100644
--- a/webui/src/components/settings/models/ProviderAPIControl.tsx
+++ b/webui/src/components/settings/models/ProviderAPIControl.tsx
@@ -3,7 +3,6 @@ import { useTranslation } from "react-i18next";
import { MODEL_REQUEST_APIS, REQUEST_API_LABELS } from "@/components/settings/models/modelAPI";
import { ToggleButton } from "@/components/settings/ToggleButton";
import { SettingsHint } from "@/components/settings/shared/SettingsHint";
-import { Button } from "@/components/ui/button";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import type { ModelAPIConfig, ModelRequestAPI } from "@/lib/types";
@@ -12,17 +11,8 @@ export function ProviderAPIControl({ value, onChange }: {
onChange: (api: ModelAPIConfig) => void;
}) {
const { t } = useTranslation();
- if (value === null) {
- return (
- <Button variant="outline" className="rounded-full" onClick={() => onChange({
- supported_apis: ["chat_completions"], preferred_api: "chat_completions",
- })}>
- {t("settings.providers.declareAPIs")}
- </Button>
- );
- }
- const supported = value.supported_apis;
- const preferred = value.preferred_api ?? supported[0];
+ const supported = value?.supported_apis ?? [...MODEL_REQUEST_APIS];
+ const preferred = value?.preferred_api ?? supported[0];
return (
<div className="space-y-3">
<fieldset className="space-y-3 rounded-xl border border-border/60 p-3">