2024-12-10 13:07:23 +00:00
|
|
|
import { atom, map } from 'nanostores';
|
2024-07-29 12:37:23 +00:00
|
|
|
import { workbenchStore } from './workbench';
|
2024-12-10 13:07:23 +00:00
|
|
|
import { PROVIDER_LIST } from '~/utils/constants';
|
2024-12-11 08:32:21 +00:00
|
|
|
import type { IProviderConfig } from '~/types/model';
|
2024-07-29 12:37:23 +00:00
|
|
|
|
|
|
|
export interface Shortcut {
|
|
|
|
key: string;
|
|
|
|
ctrlKey?: boolean;
|
|
|
|
shiftKey?: boolean;
|
|
|
|
altKey?: boolean;
|
|
|
|
metaKey?: boolean;
|
|
|
|
ctrlOrMetaKey?: boolean;
|
|
|
|
action: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Shortcuts {
|
|
|
|
toggleTerminal: Shortcut;
|
|
|
|
}
|
|
|
|
|
2024-12-10 13:07:23 +00:00
|
|
|
export const URL_CONFIGURABLE_PROVIDERS = ['Ollama', 'LMStudio', 'OpenAILike'];
|
|
|
|
export const LOCAL_PROVIDERS = ['OpenAILike', 'LMStudio', 'Ollama'];
|
2024-07-29 12:37:23 +00:00
|
|
|
|
2024-12-10 13:07:23 +00:00
|
|
|
export type ProviderSetting = Record<string, IProviderConfig>;
|
2024-12-07 15:27:50 +00:00
|
|
|
|
2024-07-29 12:37:23 +00:00
|
|
|
export const shortcutsStore = map<Shortcuts>({
|
|
|
|
toggleTerminal: {
|
|
|
|
key: 'j',
|
|
|
|
ctrlOrMetaKey: true,
|
|
|
|
action: () => workbenchStore.toggleTerminal(),
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2024-12-10 13:07:23 +00:00
|
|
|
const initialProviderSettings: ProviderSetting = {};
|
|
|
|
PROVIDER_LIST.forEach((provider) => {
|
|
|
|
initialProviderSettings[provider.name] = {
|
|
|
|
...provider,
|
|
|
|
settings: {
|
2024-12-13 05:49:57 +00:00
|
|
|
enabled: true,
|
2024-12-10 13:07:23 +00:00
|
|
|
},
|
|
|
|
};
|
2024-07-29 12:37:23 +00:00
|
|
|
});
|
2024-12-10 13:07:23 +00:00
|
|
|
export const providersStore = map<ProviderSetting>(initialProviderSettings);
|
2024-07-29 12:37:23 +00:00
|
|
|
|
2024-12-10 13:07:23 +00:00
|
|
|
export const isDebugMode = atom(false);
|
|
|
|
|
2024-12-13 00:11:35 +00:00
|
|
|
export const isEventLogsEnabled = atom(false);
|
|
|
|
|
2024-12-10 13:07:23 +00:00
|
|
|
export const isLocalModelsEnabled = atom(true);
|
2024-12-15 11:17:16 +00:00
|
|
|
|
|
|
|
export const promptStore = atom<string>('default');
|
2024-12-15 21:09:55 +00:00
|
|
|
|
|
|
|
export const latestBranchStore = atom(false);
|