index.ts 1.12 KB
Newer Older
1
2
import { writable } from 'svelte/store';

3
// Backend
4
5
export const config = writable(undefined);
export const user = writable(undefined);
6
7

// Frontend
Timothy J. Baek's avatar
Timothy J. Baek committed
8
export const theme = writable('dark');
Timothy J. Baek's avatar
Timothy J. Baek committed
9

10
export const chatId = writable('');
Timothy J. Baek's avatar
Timothy J. Baek committed
11

12
export const chats = writable([]);
Timothy J. Baek's avatar
Timothy J. Baek committed
13
export const tags = writable([]);
14
export const models = writable([]);
Timothy J. Baek's avatar
Timothy J. Baek committed
15

16
export const modelfiles = writable([]);
Timothy J. Baek's avatar
Timothy J. Baek committed
17
export const prompts = writable([]);
Timothy J. Baek's avatar
Timothy J. Baek committed
18
19
20
21
22
23
24
25
26
27
28
29
30
31
export const documents = writable([
	{
		collection_name: 'collection_name',
		filename: 'filename',
		name: 'name',
		title: 'title'
	},
	{
		collection_name: 'collection_name1',
		filename: 'filename1',
		name: 'name1',
		title: 'title1'
	}
]);
Timothy J. Baek's avatar
Timothy J. Baek committed
32

33
34
export const settings = writable({});
export const showSettings = writable(false);
Jannik Streidl's avatar
Jannik Streidl committed
35
36
37
38
39
40
41
42
43
44
45
46
47
function createLocalStorageStore(key, startValue) {
	const storedValue = localStorage.getItem(key);
	const initialValue = storedValue ? JSON.parse(storedValue) : startValue;

	const store = writable(initialValue);

	store.subscribe((value) => {
		localStorage.setItem(key, JSON.stringify(value));
	});

	return store;
}
export const showWhatsChanged = createLocalStorageStore('showWhatsChanged', true);