File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -31,11 +31,14 @@ let api: ChatGPTAPI | ChatGPTUnofficialProxyAPI
31
31
// More Info: https://github.com/transitive-bullshit/chatgpt-api
32
32
33
33
if ( process . env . OPENAI_API_KEY ) {
34
+ const OPENAI_API_MODEL = process . env . OPENAI_API_MODEL
35
+ const model = ( typeof OPENAI_API_MODEL === 'string' && OPENAI_API_MODEL . length > 0 )
36
+ ? OPENAI_API_MODEL
37
+ : 'gpt-3.5-turbo'
38
+
34
39
const options : ChatGPTAPIOptions = {
35
40
apiKey : process . env . OPENAI_API_KEY ,
36
- completionParams : {
37
- model : process . env . OPENAI_API_MODEL ?? 'gpt-3.5-turbo' ,
38
- } ,
41
+ completionParams : { model } ,
39
42
debug : false ,
40
43
}
41
44
@@ -108,7 +111,6 @@ async function chatReplyProcess(
108
111
}
109
112
catch ( error : any ) {
110
113
const code = error . statusCode
111
- global . console . log ( error )
112
114
if ( Reflect . has ( ErrorCodeMessage , code ) )
113
115
return sendResponse ( { type : 'Fail' , message : ErrorCodeMessage [ code ] } )
114
116
return sendResponse ( { type : 'Fail' , message : error . message ?? 'Please check the back-end console' } )
You can’t perform that action at this time.
0 commit comments