Skip to content

Open source CapCut alternative.

TypeScript

feat(chat): move retired Claude and GPT picks to their successors [rebuild]

David Le97ee0c4fc9ab
diff --git a/site/src/cut/components/AiPanel.tsx b/site/src/cut/components/AiPanel.tsx
index 1928aa45..015c589c 100644
--- a/site/src/cut/components/AiPanel.tsx
+++ b/site/src/cut/components/AiPanel.tsx
@@ -113,7 +113,7 @@ import { projectBackend } from "@/cut/lib/residency";
import { beginBrowserChat, browserChatRunning, cancelBrowserChat, watchBrowserChatTurns } from "@/cut/lib/browserChatTurns";
import { putCloudThread } from "@/cut/lib/chatCloud";
import type { AgentMessage } from "@earendil-works/pi-agent-core";
-import { AI_MODELS, aiModelProvider as provider } from "@/cut/lib/aiModels";
+import { AI_MODELS, aiModelProvider as provider, currentChatModel } from "@/cut/lib/aiModels";
import { saveAssetToLibrary } from "@/cut/lib/library";
import { formatDuration, useGenScene } from "@/cut/lib/genScene";
import { lightboxItemFromRef, useLightbox } from "@/cut/lib/lightbox";
@@ -449,14 +449,16 @@ export function AiPanel({
const engineUp = useLocalCompute();
const readOnly = useEditor((s) => s.readOnly);
const signedIn = useSignedIn();
- // A saved id whose model left the catalog (a retired model after a bump)
- // falls back to the default; passed through, the hosted route rejects it.
+ // A saved id that was retired moves to its replacement and the move is
+ // written back; an id the catalog has never known falls back to the
+ // default, since passed through the hosted route rejects it.
const [model, setModel] = useState<string>(() => {
if (typeof window === "undefined") return DEFAULT_MODEL;
const saved = localStorage.getItem(MODEL_KEY);
- return saved && AI_MODELS.some((m) => m.id === saved)
- ? saved
- : DEFAULT_MODEL;
+ const current = saved ? currentChatModel(saved) : undefined;
+ if (!current) return DEFAULT_MODEL;
+ if (current !== saved) localStorage.setItem(MODEL_KEY, current);
+ return current;
});
// One chat is active at a time; every past chat lives in the Threads panel.
// The id persists so closing and reopening the panel resumes the same chat.
@@ -2816,10 +2818,13 @@ function ModelSelector({
model: string;
onSelect: (id: string) => void;
}) {
+ // Favorites follow the catalog: a retired id becomes its replacement, an
+ // unknown id drops, and one replacement standing in for two ids lists once.
const [favs, setFavs] = useState<string[]>(() => {
if (typeof window === "undefined") return [];
try {
- return JSON.parse(localStorage.getItem(FAVS_KEY) ?? "[]") as string[];
+ const saved = JSON.parse(localStorage.getItem(FAVS_KEY) ?? "[]") as string[];
+ return [...new Set(saved.map(currentChatModel).filter((id): id is string => !!id))];
} catch {
return [];
}
diff --git a/site/src/cut/components/editor-mock/MockAiPanel.tsx b/site/src/cut/components/editor-mock/MockAiPanel.tsx
index e354830f..cf212197 100644
--- a/site/src/cut/components/editor-mock/MockAiPanel.tsx
+++ b/site/src/cut/components/editor-mock/MockAiPanel.tsx
@@ -59,7 +59,7 @@ export function MockAiPanel({ project }: { project: MockProject }) {
<div className="flex items-center gap-1 px-1.5 pb-1.5">
<span className="flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] font-medium text-muted-foreground">
<Sparkles className="size-3" />
- Fable 5
+ Fable 5.1
<ChevronDown className="size-3" />
</span>
<div className="flex-1" />
diff --git a/site/src/cut/lib/aiModels.test.ts b/site/src/cut/lib/aiModels.test.ts
index 2bdd0e0a..5b8774de 100644
--- a/site/src/cut/lib/aiModels.test.ts
+++ b/site/src/cut/lib/aiModels.test.ts
@@ -1,6 +1,12 @@
import { describe, expect, test } from "bun:test";
import { throws } from "node:assert/strict";
-import { AI_MODELS, aiModelProvider, type AiModel } from "@/cut/lib/aiModels";
+import {
+ AI_MODELS,
+ RETIRED_CHAT_MODELS,
+ aiModelProvider,
+ currentChatModel,
+ type AiModel,
+} from "@/cut/lib/aiModels";
import { geminiModelRoleNames } from "@/lib/inference/gemini-models";
describe("chat model providers", () => {
@@ -30,3 +36,33 @@ describe("chat model providers", () => {
});
}
});
+
+describe("retired chat models", () => {
+ const providerOf = (id: string) => {
+ const family = id.startsWith("claude") ? "claude" : id.startsWith("gpt") ? "codex" : "gemini";
+ return family;
+ };
+
+ test("every replacement is in the catalog, from the retired id's provider", () => {
+ for (const [retired, replacement] of Object.entries(RETIRED_CHAT_MODELS)) {
+ expect(AI_MODELS.some((m) => m.id === replacement)).toBe(true);
+ expect(aiModelProvider(replacement)).toBe(providerOf(retired));
+ }
+ });
+
+ test("no retired id is still in the catalog", () => {
+ for (const retired of Object.keys(RETIRED_CHAT_MODELS)) {
+ expect(AI_MODELS.some((m) => m.id === retired)).toBe(false);
+ }
+ });
+
+ test("currentChatModel maps retired ids and passes current ids through", () => {
+ for (const [retired, replacement] of Object.entries(RETIRED_CHAT_MODELS)) {
+ expect(currentChatModel(retired)).toBe(replacement);
+ }
+ for (const model of AI_MODELS) {
+ expect(currentChatModel(model.id)).toBe(model.id);
+ }
+ expect(currentChatModel("unknown-model")).toBeUndefined();
+ });
+});
diff --git a/site/src/cut/lib/aiModels.ts b/site/src/cut/lib/aiModels.ts
index 0d40657c..d84e8cf3 100644
--- a/site/src/cut/lib/aiModels.ts
+++ b/site/src/cut/lib/aiModels.ts
@@ -15,18 +15,35 @@ export interface AiModel {
* Gemini runs through Donkey's hosted inference (sign-in + credits), not a local CLI. */
export const AI_MODELS: AiModel[] = [
{ id: "claude-fable-5-1", label: "Fable 5.1", provider: "claude" },
- { id: "claude-opus-5", label: "Opus 5", provider: "claude" },
- { id: "claude-sonnet-5", label: "Sonnet 5", provider: "claude" },
+ { id: "claude-opus-5-5", label: "Opus 5.5", provider: "claude" },
+ { id: "claude-sonnet-5-5", label: "Sonnet 5.5", provider: "claude" },
{ id: "claude-haiku-4-5-20251001", label: "Haiku 4.5", provider: "claude" },
{ id: "gpt-6-astra", label: "GPT-6 Astra", provider: "codex" },
- { id: "gpt-5.6-sol", label: "GPT-5.6 Sol", provider: "codex" },
+ { id: "gpt-6-sol", label: "GPT-6 Sol", provider: "codex" },
{ id: "gpt-5.6-terra", label: "GPT-5.6 Terra", provider: "codex" },
- { id: "gpt-5.6-luna", label: "GPT-5.6 Luna", provider: "codex" },
+ { id: "gpt-6-luna", label: "GPT-6 Luna", provider: "codex" },
{ id: geminiModelRoleNames.chat, label: "Gemini Flash", provider: "gemini" },
// Hermetic test provider for e2e runs — hidden unless enabled in the UI.
{ id: "cut-test", label: "Test model", provider: "test", hidden: true },
];
+/** Ids that left the catalog, each mapped to the current model from the same
+ * provider that takes over its role. A saved selection or favorite that names
+ * a retired id moves to its replacement on load. */
+export const RETIRED_CHAT_MODELS: Record<string, string> = {
+ "claude-opus-5": "claude-opus-5-5",
+ "claude-sonnet-5": "claude-sonnet-5-5",
+ "gpt-5.6-sol": "gpt-6-sol",
+ "gpt-5.6-luna": "gpt-6-luna",
+};
+
+/** The catalog id a saved id runs as today: itself when it is in the catalog,
+ * its replacement when it was retired, undefined when it is unknown. */
+export function currentChatModel(id: string): string | undefined {
+ if (AI_MODELS.some((m) => m.id === id)) return id;
+ return RETIRED_CHAT_MODELS[id];
+}
+
export function aiModelProvider(id: string): AiModel["provider"] {
const model = AI_MODELS.find((m) => m.id === id);
if (!model) throw new Error(`Unknown chat model: ${id}`);