fix(model-selector): correct misspelled perplexity provider key (#17464)

This commit is contained in:
Harsh Kashyap
2026-09-25 21:01:37 -03:00
committed by GitHub
parent 8784a5946a
commit 31630682fa
4 changed files with 22 additions and 3 deletions
+11
View File
@@ -0,0 +1,11 @@
<!doctype html>
<html><head><meta charset="utf-8"><title>perplexity provider key - repro evidence</title>
<style>body{font-family:system-ui;margin:2rem;background:#141414;color:#eee}img{max-width:100%;border:1px solid #444}code{background:#222;padding:2px 6px;border-radius:4px}</style></head>
<body>
<h1>map-provider.ts: misspelled <code>perlexity</code> key</h1>
<p>The backend addresses providers by their litellm id (<code>perplexity</code>). The map key <code>perlexity</code>
never matches, so <code>mapProvider("perplexity")</code> falls through to the raw id and
<code>getProviderId("Perplexity AI")</code> round-trips the misspelling back to the settings API.</p>
<h2>Terminal evidence (before / after, repro run twice)</h2>
<img src="terminal.png" alt="vitest before: 2 failed; after: 2 passed; repro script output">
</body></html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

+10 -2
View File
@@ -1,5 +1,5 @@
import { test, expect } from "vitest";
import { mapProvider } from "../../src/utils/map-provider";
import { getProviderId, mapProvider } from "../../src/utils/map-provider";
test("mapProvider", () => {
expect(mapProvider("azure")).toBe("Azure");
@@ -14,7 +14,7 @@ test("mapProvider", () => {
expect(mapProvider("anyscale")).toBe("Anyscale");
expect(mapProvider("databricks")).toBe("Databricks");
expect(mapProvider("ollama")).toBe("Ollama");
expect(mapProvider("perlexity")).toBe("Perplexity AI");
expect(mapProvider("perplexity")).toBe("Perplexity AI");
expect(mapProvider("friendliai")).toBe("FriendliAI");
expect(mapProvider("groq")).toBe("Groq");
expect(mapProvider("fireworks_ai")).toBe("Fireworks AI");
@@ -27,3 +27,11 @@ test("mapProvider", () => {
expect(mapProvider("clarifai")).toBe("Clarifai");
expect(mapProvider("moonshot")).toBe("Moonshot");
});
test("getProviderId round-trips the display name back to the provider id", () => {
// The backend addresses providers by their litellm id (`perplexity`), so the
// display name must map back to that id, not to a misspelling of it.
expect(getProviderId("Perplexity AI")).toBe("perplexity");
expect(getProviderId("OpenAI")).toBe("openai");
expect(getProviderId("Some New Provider")).toBe("Some New Provider");
});
+1 -1
View File
@@ -13,7 +13,7 @@ export const MAP_PROVIDER = {
anyscale: "Anyscale",
databricks: "Databricks",
ollama: "Ollama",
perlexity: "Perplexity AI",
perplexity: "Perplexity AI",
friendliai: "FriendliAI",
groq: "Groq",
fireworks_ai: "Fireworks AI",