@@ -8,6 +8,54 @@ import {
8
8
useStorage ,
9
9
} from 'vellma/peripherals'
10
10
11
+ type ModelOption = {
12
+ id : string ,
13
+ label : string ,
14
+ contextWindow : string ,
15
+ comingSoon ?: boolean ,
16
+ disabled ?: boolean ,
17
+ }
18
+
19
+ const defaultLanguageModels : ModelOption [ ] = [
20
+ {
21
+ id : 'gpt-4o' ,
22
+ label : 'GPT-4o' ,
23
+ contextWindow : '128k' ,
24
+ } ,
25
+ {
26
+ id : 'gpt-4-turbo' ,
27
+ label : 'GPT-4 Turbo' ,
28
+ contextWindow : '128k' ,
29
+ } ,
30
+ {
31
+ id : 'gpt-4-turbo-preview' ,
32
+ label : 'GPT-4 Turbo (Preview)' ,
33
+ contextWindow : '128k' ,
34
+ } ,
35
+ {
36
+ id : 'gpt-4-vision-preview' ,
37
+ label : 'GPT-4 Turbo Vision' ,
38
+ contextWindow : '128k' ,
39
+ comingSoon : true ,
40
+ disabled : true ,
41
+ } ,
42
+ {
43
+ id : 'gpt-4' ,
44
+ label : 'GPT-4' ,
45
+ contextWindow : '8k' ,
46
+ } ,
47
+ {
48
+ id : 'gpt-4-32k' ,
49
+ label : 'GPT-4 (32k)' ,
50
+ contextWindow : '32k' ,
51
+ } ,
52
+ {
53
+ id : 'gpt-3.5-turbo-0125' ,
54
+ label : 'GPT-3.5 Turbo' ,
55
+ contextWindow : '16k' ,
56
+ } ,
57
+ ]
58
+
11
59
export const dexieStorage = ( ) : StorageAdapter => {
12
60
const { db } = useDatabase ( )
13
61
@@ -50,7 +98,7 @@ export const dexieStorage = (): StorageAdapter => {
50
98
}
51
99
}
52
100
53
- export const useAssistant = ( { chatId, languageModel = ref ( { id : 'gpt-4-1106-preview' , label : 'GPT-4 Turbo' } ) } : { chatId : Ref < string > , languageModel ?: Ref < { id : string , label : string } > } ) => {
101
+ export const useAssistant = ( { chatId, languageModel = ref ( defaultLanguageModels [ 0 ] ) } : { chatId : Ref < string > , languageModel ?: Ref < ModelOption > } ) => {
54
102
const storageAdapter = dexieStorage ( )
55
103
const apiKey = useLocalStorage < string > ( 'openAiApiKey' , '' , {
56
104
initOnMounted : true ,
@@ -63,40 +111,7 @@ export const useAssistant = ({ chatId, languageModel = ref({ id: 'gpt-4-1106-pre
63
111
const chatModel = computed ( ( ) => chatInterface . value . model )
64
112
const chatFactory = computed ( ( ) => chatInterface . value . factory )
65
113
66
- const languageModels = ref ( [
67
- {
68
- id : 'gpt-4-turbo' ,
69
- label : 'GPT-4 Turbo' ,
70
- contextWindow : '128k' ,
71
- } ,
72
- {
73
- id : 'gpt-4-turbo-preview' ,
74
- label : 'GPT-4 Turbo (Preview)' ,
75
- contextWindow : '128k' ,
76
- } ,
77
- {
78
- id : 'gpt-4-vision-preview' ,
79
- label : 'GPT-4 Turbo Vision' ,
80
- contextWindow : '128k' ,
81
- comingSoon : true ,
82
- disabled : true ,
83
- } ,
84
- {
85
- id : 'gpt-4' ,
86
- label : 'GPT-4' ,
87
- contextWindow : '8k' ,
88
- } ,
89
- {
90
- id : 'gpt-4-32k' ,
91
- label : 'GPT-4 (32k)' ,
92
- contextWindow : '32k' ,
93
- } ,
94
- {
95
- id : 'gpt-3.5-turbo-0125' ,
96
- label : 'GPT-3.5 Turbo' ,
97
- contextWindow : '16k' ,
98
- } ,
99
- ] )
114
+ const languageModels = ref ( defaultLanguageModels )
100
115
101
116
return {
102
117
apiKey,
0 commit comments