fix: normalize Ollama Local provider input (#955)

This commit is contained in:
Aqil Aziz
2026-05-09 10:05:22 +07:00
committed by GitHub
parent 9080336c5d
commit 0f0c7ede46
3 changed files with 47 additions and 6 deletions
+3 -1
View File
@@ -5,6 +5,7 @@ import { getDefaultModel } from "open-sse/config/providerModels.js";
import { resolveOllamaLocalHost, PROVIDERS } from "open-sse/config/providers.js";
import { openaiToCommandCode } from "open-sse/translator/request/openai-to-commandcode.js";
import { PROVIDER_ENDPOINTS } from "@/shared/constants/config";
import { normalizeProviderId } from "@/lib/providerNormalization";
// Probe a webSearch/webFetch provider using its searchConfig/fetchConfig.
// Returns true if API key is accepted (status !== 401 && !== 403).
@@ -84,7 +85,8 @@ async function probeMediaProvider(provider, apiKey) {
export async function POST(request) {
try {
const body = await request.json();
const { provider, apiKey, providerSpecificData } = body;
const provider = normalizeProviderId(body.provider);
const { apiKey, providerSpecificData } = body;
const isNoAuth = AI_PROVIDERS[provider]?.noAuth === true;
if (!provider || (!apiKey && provider !== "ollama-local" && !isNoAuth)) {