This commit is contained in:
@@ -9,7 +9,7 @@ export async function POST(request) {
|
|||||||
const body = await request.json();
|
const body = await request.json();
|
||||||
const { provider, apiKey } = body;
|
const { provider, apiKey } = body;
|
||||||
|
|
||||||
if (!provider || !apiKey) {
|
if (!provider || (!apiKey && provider !== "ollama-local")) {
|
||||||
return NextResponse.json({ error: "Provider and API key required" }, { status: 400 });
|
return NextResponse.json({ error: "Provider and API key required" }, { status: 400 });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,9 +189,9 @@ export async function POST(request) {
|
|||||||
chutes: "https://llm.chutes.ai/v1/models",
|
chutes: "https://llm.chutes.ai/v1/models",
|
||||||
nvidia: "https://integrate.api.nvidia.com/v1/models"
|
nvidia: "https://integrate.api.nvidia.com/v1/models"
|
||||||
};
|
};
|
||||||
const res = await fetch(endpoints[provider], {
|
const headers = {};
|
||||||
headers: { "Authorization": `Bearer ${apiKey}` },
|
if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`;
|
||||||
});
|
const res = await fetch(endpoints[provider], { headers });
|
||||||
isValid = res.ok;
|
isValid = res.ok;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user