feat: derive AI model list from Raycast SDK enum

Generate MODEL_OPTIONS at runtime from AI.Model (dedupe by value, drop
@deprecated aliases), so the AI-view dropdowns show every model the
installed @raycast/api ships — no more hand-maintained six-entry list.

Switch the summaryModel preference from a static dropdown to a textfield
holding a model ID. The discoverable picker lives in the AI views (now
fully dynamic), and the preference just stores the chosen default.

Drop duplicate MODEL_OPTIONS / CREATIVITY_OPTIONS constants from
summarize-email.tsx and reply-email.tsx; both pull from ./ai now like
the briefing and extract views already do.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
muena
2026-05-20 07:08:58 +02:00
parent c8b3cf44e3
commit c0078ce339
5 changed files with 25 additions and 60 deletions

View File

@@ -12,6 +12,7 @@ import {
} from "@raycast/api";
import { getSelectedTextSafely } from "./selection";
import { useEffect, useMemo, useRef, useState } from "react";
import { CREATIVITY_OPTIONS, MODEL_OPTIONS } from "./ai";
import { getPreferences } from "./preferences";
import {
buildDisclosureContent,
@@ -54,17 +55,6 @@ type FormValues = {
instructions: string;
};
const CREATIVITY_OPTIONS: Creativity[] = ["none", "low", "medium", "high"];
const MODEL_OPTIONS: Array<{ value: string; title: string }> = [
{ value: "anthropic-claude-sonnet-4-6", title: "Claude 4.6 Sonnet" },
{ value: "anthropic-claude-opus-4-7", title: "Claude 4.7 Opus" },
{ value: "anthropic-claude-4-5-haiku", title: "Claude 4.5 Haiku" },
{ value: "openai-gpt-5.3-instant", title: "OpenAI GPT-5.3 Instant" },
{ value: "openai-gpt-4.1", title: "OpenAI GPT-4.1" },
{ value: "openai-gpt-4o-mini", title: "OpenAI GPT-4o mini" },
];
export default function Command() {
const preferences = getPreferences();
const [text, setText] = useState("");