feat: persist last-used model in LocalStorage instead of preference

Drop the summaryModel preference (and the awkward textfield holding a
raw model ID nobody could discover without poking the SDK types). Each
AI view now controls its model dropdown, loads the shared
velum.ai.last-model on mount, and writes it back on submit — so picking
Claude 4.7 Opus in the summarize command becomes the prefilled default
in briefing, action-items, structured-data, and reply next time around.

Also drops 'model' from ReplyDefaults; the shared key supersedes it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
muena
2026-05-20 07:33:27 +02:00
parent cc4742cf38
commit 9bc621307c
11 changed files with 88 additions and 52 deletions

View File

@@ -1,3 +1,5 @@
import { LocalStorage } from "@raycast/api";
export type Creativity = "none" | "low" | "medium" | "high";
export const CREATIVITY_OPTIONS: Creativity[] = [
@@ -77,6 +79,22 @@ export const MODEL_OPTIONS: ModelOption[] = [
{ value: "together-moonshotai/Kimi-K2.5", title: "Kimi K2.5" },
];
const LAST_MODEL_STORAGE_KEY = "velum.ai.last-model";
export const DEFAULT_MODEL: string = MODEL_OPTIONS[0].value;
export async function getLastUsedModel(): Promise<string> {
const stored = await LocalStorage.getItem<string>(LAST_MODEL_STORAGE_KEY);
if (stored && MODEL_OPTIONS.some((option) => option.value === stored)) {
return stored;
}
return DEFAULT_MODEL;
}
export async function setLastUsedModel(model: string): Promise<void> {
await LocalStorage.setItem(LAST_MODEL_STORAGE_KEY, model);
}
export const STRICT_PLACEHOLDER_RULE = [
"STRENGE REGEL: Gib jeden Platzhalter zeichengetreu (inklusive spitzer Klammern, Großbuchstaben und Unterstrich + Nummer) zurück.",
"Du darfst Platzhalter NIEMALS auflösen, raten, übersetzen oder mit erfundenen Namen ersetzen. Schreibe sie exakt so, wie sie in der Eingabe stehen.",