File tree 3 files changed +6
-2
lines changed
3 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -6,14 +6,14 @@ export function defineMessages(message: Message[]): Message[] {
6
6
}
7
7
8
8
export async function fetchCompletion ( messages : Message [ ] , options : AI ) : Promise < Completion > {
9
- return ofetch < Completion > ( 'https://api.openai.com/v1/chat/completions' , {
9
+ return ofetch < Completion > ( options . endpoint , {
10
10
method : 'POST' ,
11
11
headers : {
12
12
'Content-Type' : 'application/json' ,
13
13
'Authorization' : `Bearer ${ options . accessKey } ` ,
14
14
} ,
15
15
body : {
16
- model : 'gpt-3.5-turbo' ,
16
+ model : options . model ,
17
17
messages,
18
18
max_tokens : options . maxTokens ?? null ,
19
19
} ,
Original file line number Diff line number Diff line change @@ -14,5 +14,7 @@ export const defaultConfig = defineUtilsAIConfig<Config>({
14
14
accessKey : null ,
15
15
maxTokens : 2048 ,
16
16
temperature : 0.7 ,
17
+ endpoint : 'https://api.openai.com/v1/chat/completions' ,
18
+ model : 'gpt-3.5-turbo' ,
17
19
} ,
18
20
} )
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ export interface AI {
7
7
accessKey : string | null
8
8
maxTokens ?: number
9
9
temperature ?: number
10
+ endpoint : string
11
+ model : string
10
12
}
11
13
12
14
export type Language = 'fr' | 'en'
You can’t perform that action at this time.
0 commit comments