mirror of
https://github.com/jackhh66/ChatGPT_Web_accessToken.git
synced 2026-12-03 21:49:39 +00:00
feat: #响应式 (#22)
* feat: #响应式 * fix: #兼容node 16 * feat: #接口代理 * fix: #延长超时时长到30秒 * fix: #for node 16 * fix: #node 16 * Update settings.json * Update package.json * Update index.vue * Update Layout.vue --------- Co-authored-by: Redon <790348264@qq.com>
This commit is contained in:
1 parent
79eeb51537
commit
c617205a8c
7 files changed
+70
-15
No files matched your search
+10
-3
@@ -1,6 +1,6 @@
|
||||
import * as dotenv from 'dotenv'
|
||||
import type { SendMessageOptions } from 'chatgpt'
|
||||
import { ChatGPTAPI } from 'chatgpt'
|
||||
import 'isomorphic-fetch'
|
||||
import type { ChatGPTAPI, SendMessageOptions } from 'chatgpt'
|
||||
import { sendResponse } from './utils'
|
||||
|
||||
export interface ChatContext {
|
||||
@@ -18,7 +18,14 @@ if (apiKey === undefined)
|
||||
/**
|
||||
* More Info: https://github.com/transitive-bullshit/chatgpt-api
|
||||
*/
|
||||
const api = new ChatGPTAPI({ apiKey, debug: false })
|
||||
let api: ChatGPTAPI
|
||||
// To use ESM in CommonJS, you can use a dynamic import
|
||||
(async () => {
|
||||
const { ChatGPTAPI } = await import('chatgpt')
|
||||
|
||||
api = new ChatGPTAPI(
|
||||
{ apiKey: process.env.OPENAI_API_KEY })
|
||||
})()
|
||||
|
||||
async function chatReply(
|
||||
message: string,
|
||||
|
||||
Reference in new issue
Block a user