export const PROVIDERS = ["cohere", "textsynth", "ocp", "openai", "openai-chat", "azure", "azure-chat"]; export type Provider = (typeof PROVIDERS)[number]; type ProviderProps = { "openai": { organization: string }; "openai-chat": { organization: string }; "ocp": { url: string }; "azure": { url: string }; "azure-chat": { url: string }; }; type SharedPresetSettings = { name: string; model: string; contextLength: number; apiKey: string; }; export type ModelPreset

= SharedPresetSettings & (P extends keyof ProviderProps ? ProviderProps[P] : {}) & { provider: P }; export interface LoomSettings { passageFolder: string; defaultPassageSeparator: string; defaultPassageFrontmatter: string; modelPresets: ModelPreset[]; modelPreset: number; visibility: Record; maxTokens: number; temperature: number; topP: number; frequencyPenalty: number; presencePenalty: number; prepend: string; bestOf: number; n: number; showSettings: boolean; showSearchBar: boolean; showNodeBorders: boolean; showExport: boolean; } export const getPreset = (settings: LoomSettings) => settings.modelPresets[settings.modelPreset]; export type SearchResultState = "result" | "ancestor" | "none" | null; export interface Node { text: string; parentId: string | null; collapsed: boolean; unread: boolean; bookmarked: boolean; lastVisited?: number; searchResultState: SearchResultState; } export interface NoteState { current: string; hoisted: string[]; searchTerm: string; nodes: Record; generating: string | null; }