Fix typo in "Haiku" model name

This commit is contained in:
James Babcock committed 2026-08-09 23:15:47 -07:00
1 parent b4728f4f15
commit 6103c00ca3
1 file changed
+23 -3
+23 -3
View File
@@ -1,3 +1,5 @@
import { isLocalModelReady, LOCAL_MODEL } from "../native/llama";
export const ASSISTANT_MODEL_VALUES = [
"auto",
"hauku",
@@ -7,10 +9,11 @@ export const ASSISTANT_MODEL_VALUES = [
"luna",
"terra",
"sol",
"qwen",
] as const;
export type AssistantModel = (typeof ASSISTANT_MODEL_VALUES)[number];
export type AssistantProvider = "anthropic" | "openai";
export type AssistantProvider = "anthropic" | "openai" | "local";
export type AssistantApiKeys = {
anthropic: string;
@@ -35,13 +38,16 @@ type ModelDefinition = {
const MODEL_DEFINITIONS: Record<Exclude<AssistantModel, "auto">, ModelDefinition> = {
// Keep the user-facing spelling requested for the picker while using
// Anthropic's canonical Haiku alias on the wire.
hauku: { label: "Hauku", provider: "anthropic", model: "claude-haiku-4-5" },
hauku: { label: "Haiku", provider: "anthropic", model: "claude-haiku-4-5" },
sonnet: { label: "Sonnet", provider: "anthropic", model: "claude-sonnet-5", effort: "low" },
opus: { label: "Opus", provider: "anthropic", model: "claude-opus-5", effort: "low" },
fable: { label: "Fable", provider: "anthropic", model: "claude-fable-5", effort: "low" },
luna: { label: "Luna", provider: "openai", model: "gpt-5.6-luna", effort: "low" },
terra: { label: "Terra", provider: "openai", model: "gpt-5.6-terra", effort: "low" },
sol: { label: "Sol", provider: "openai", model: "gpt-5.6-sol", effort: "low" },
// Runs on the phone itself (llama.cpp); needs the downloaded model file,
// not an API key. The default for users who haven't set any key.
qwen: { label: `${LOCAL_MODEL.label} (on-phone)`, provider: "local", model: LOCAL_MODEL.id },
};
export function assistantModelLabel(value: AssistantModel): string {
@@ -54,7 +60,9 @@ export function assistantModelProvider(value: AssistantModel): AssistantProvider
/**
* Resolve Auto and attach the credential needed by the chosen provider.
* Auto intentionally prefers Terra over Sonnet when both keys are available.
* Auto intentionally prefers Terra over Sonnet when both keys are available,
* and falls back to the on-phone model when no key is set but the model file
* has been downloaded.
*/
export function resolveAssistantModel(
selection: AssistantModel,
@@ -70,12 +78,24 @@ export function resolveAssistantModel(
resolvedSelection = "terra";
} else if (normalizedKeys.anthropic) {
resolvedSelection = "sonnet";
} else if (isLocalModelReady()) {
resolvedSelection = "qwen";
} else {
return null;
}
}
const definition = MODEL_DEFINITIONS[resolvedSelection as Exclude<AssistantModel, "auto">];
if (definition.provider === "local") {
if (!isLocalModelReady()) return null;
return {
selection,
provider: definition.provider,
model: definition.model,
apiKey: "",
effort: definition.effort,
};
}
const apiKey = normalizedKeys[definition.provider];
if (!apiKey) return null;
return {