fix(webui): show custom provider API controls directly
This commit is contained in:
1 parent
87a1e36833
commit
10a979ab00
2 files changed
+3
-13
No files matched your search
@@ -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:
|
||||
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in new issue
Block a user