forked from Blendman974/faceclaw
Fix typo in "Haiku" model name
This commit is contained in:
1 parent
b4728f4f15
commit
6103c00ca3
1 file changed
+23
-3
+23
-3
@@ -1,3 +1,5 @@
|
|||||||
|
import { isLocalModelReady, LOCAL_MODEL } from "../native/llama";
|
||||||
|
|
||||||
export const ASSISTANT_MODEL_VALUES = [
|
export const ASSISTANT_MODEL_VALUES = [
|
||||||
"auto",
|
"auto",
|
||||||
"hauku",
|
"hauku",
|
||||||
@@ -7,10 +9,11 @@ export const ASSISTANT_MODEL_VALUES = [
|
|||||||
"luna",
|
"luna",
|
||||||
"terra",
|
"terra",
|
||||||
"sol",
|
"sol",
|
||||||
|
"qwen",
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type AssistantModel = (typeof ASSISTANT_MODEL_VALUES)[number];
|
export type AssistantModel = (typeof ASSISTANT_MODEL_VALUES)[number];
|
||||||
export type AssistantProvider = "anthropic" | "openai";
|
export type AssistantProvider = "anthropic" | "openai" | "local";
|
||||||
|
|
||||||
export type AssistantApiKeys = {
|
export type AssistantApiKeys = {
|
||||||
anthropic: string;
|
anthropic: string;
|
||||||
@@ -35,13 +38,16 @@ type ModelDefinition = {
|
|||||||
const MODEL_DEFINITIONS: Record<Exclude<AssistantModel, "auto">, ModelDefinition> = {
|
const MODEL_DEFINITIONS: Record<Exclude<AssistantModel, "auto">, ModelDefinition> = {
|
||||||
// Keep the user-facing spelling requested for the picker while using
|
// Keep the user-facing spelling requested for the picker while using
|
||||||
// Anthropic's canonical Haiku alias on the wire.
|
// 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" },
|
sonnet: { label: "Sonnet", provider: "anthropic", model: "claude-sonnet-5", effort: "low" },
|
||||||
opus: { label: "Opus", provider: "anthropic", model: "claude-opus-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" },
|
fable: { label: "Fable", provider: "anthropic", model: "claude-fable-5", effort: "low" },
|
||||||
luna: { label: "Luna", provider: "openai", model: "gpt-5.6-luna", 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" },
|
terra: { label: "Terra", provider: "openai", model: "gpt-5.6-terra", effort: "low" },
|
||||||
sol: { label: "Sol", provider: "openai", model: "gpt-5.6-sol", 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 {
|
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.
|
* 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(
|
export function resolveAssistantModel(
|
||||||
selection: AssistantModel,
|
selection: AssistantModel,
|
||||||
@@ -70,12 +78,24 @@ export function resolveAssistantModel(
|
|||||||
resolvedSelection = "terra";
|
resolvedSelection = "terra";
|
||||||
} else if (normalizedKeys.anthropic) {
|
} else if (normalizedKeys.anthropic) {
|
||||||
resolvedSelection = "sonnet";
|
resolvedSelection = "sonnet";
|
||||||
|
} else if (isLocalModelReady()) {
|
||||||
|
resolvedSelection = "qwen";
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const definition = MODEL_DEFINITIONS[resolvedSelection as Exclude<AssistantModel, "auto">];
|
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];
|
const apiKey = normalizedKeys[definition.provider];
|
||||||
if (!apiKey) return null;
|
if (!apiKey) return null;
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in new issue
Block a user