File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -52,14 +52,17 @@ export class ChatGPTAPI {
52
52
53
53
/** @defaultValue 60000 (60 seconds) */
54
54
accessTokenTTL ?: number
55
+
56
+ accessToken ?: string
55
57
} ) {
56
58
const {
57
59
sessionToken,
58
60
markdown = true ,
59
61
apiBaseUrl = 'https://chat.openai.com/api' ,
60
62
backendApiBaseUrl = 'https://chat.openai.com/backend-api' ,
61
63
userAgent = USER_AGENT ,
62
- accessTokenTTL = 60000 // 60 seconds
64
+ accessTokenTTL = 60000 , // 60 seconds
65
+ accessToken
63
66
} = opts
64
67
65
68
this . _sessionToken = sessionToken
@@ -76,6 +79,7 @@ export class ChatGPTAPI {
76
79
}
77
80
78
81
this . _accessTokenCache = new ExpiryMap < string , string > ( accessTokenTTL )
82
+ this . _accessTokenCache . set ( KEY_ACCESS_TOKEN , accessToken ?? '' )
79
83
80
84
if ( ! this . _sessionToken ) {
81
85
throw new types . ChatGPTError ( 'ChatGPT invalid session token' )
You can’t perform that action at this time.
0 commit comments