forked from r.muellner/velum-raycast
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>
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
import { getPreferenceValues } from "@raycast/api";
|
|
import type { ExtensionPreferences, QuickOutput, SessionMode } from "./types";
|
|
|
|
export type NormalizedPreferences = {
|
|
velumBaseUrl: string;
|
|
authentikTokenUrl: string;
|
|
clientId: string;
|
|
serviceAccountUsername: string;
|
|
serviceAccountPassword: string;
|
|
scope: string;
|
|
sessionMode: SessionMode;
|
|
quickOutput: QuickOutput;
|
|
userFullName: string;
|
|
maxSessions: number;
|
|
closeAfterAction: boolean;
|
|
};
|
|
|
|
function trimTrailingSlash(value: string): string {
|
|
return value.trim().replace(/\/+$/, "");
|
|
}
|
|
|
|
function parsePositiveInteger(value: string, fallback: number): number {
|
|
const parsed = Number.parseInt(value, 10);
|
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
|
}
|
|
|
|
export function getPreferences(): NormalizedPreferences {
|
|
const preferences = getPreferenceValues<ExtensionPreferences>();
|
|
|
|
return {
|
|
velumBaseUrl: trimTrailingSlash(preferences.velumBaseUrl),
|
|
authentikTokenUrl: preferences.authentikTokenUrl.trim(),
|
|
clientId: preferences.clientId.trim(),
|
|
serviceAccountUsername: preferences.serviceAccountUsername.trim(),
|
|
serviceAccountPassword: preferences.serviceAccountPassword,
|
|
scope: preferences.scope?.trim() || "profile",
|
|
sessionMode: preferences.sessionMode,
|
|
quickOutput: preferences.quickOutput,
|
|
userFullName: preferences.userFullName?.trim() ?? "",
|
|
maxSessions: parsePositiveInteger(preferences.maxSessions, 20),
|
|
closeAfterAction: preferences.closeAfterAction ?? true,
|
|
};
|
|
}
|