mirror of
https://github.com/yuezk/chatgpt-mirror
synced 2025-09-26 18:51:10 +08:00
修复macos下fetch错误
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
"chatgpt": "^5.0.8",
|
||||
"compression": "^1.7.4",
|
||||
"dotenv": "^16.0.3",
|
||||
"isomorphic-unfetch": "^4.0.2",
|
||||
"node-fetch": "^3.3.0",
|
||||
"proxy-agent-v2": "^1.0.3",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rxjs": "^7.8.0",
|
||||
@@ -76,5 +76,12 @@
|
||||
],
|
||||
"coverageDirectory": "../coverage",
|
||||
"testEnvironment": "node"
|
||||
},
|
||||
"pnpm": {
|
||||
"peerDependencyRules": {
|
||||
"ignoreMissing": [
|
||||
"webpack"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
630
pnpm-lock.yaml
generated
630
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
import { Injectable, Logger, MessageEvent, OnModuleInit } from '@nestjs/common';
|
||||
import { ChatGPTAPI, ChatMessage, ConversationResponseEvent } from 'chatgpt';
|
||||
import fetch from 'isomorphic-unfetch';
|
||||
import fetch from './fetch.js';
|
||||
|
||||
import ProxyAgent from 'proxy-agent-v2';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
|
12
src/fetch.ts
Normal file
12
src/fetch.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import fetch, {
|
||||
Headers,
|
||||
Request,
|
||||
Response,
|
||||
} from 'node-fetch';
|
||||
|
||||
globalThis.fetch = fetch
|
||||
globalThis.Headers = Headers;
|
||||
globalThis.Request = Request;
|
||||
globalThis.Response = Response;
|
||||
|
||||
export default fetch;
|
@@ -1,13 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "ES2022",
|
||||
"module": "esnext",
|
||||
"lib": ["esnext"],
|
||||
"moduleResolution": "node",
|
||||
"declaration": true,
|
||||
"removeComments": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"target": "es2017",
|
||||
"target": "es2020",
|
||||
"sourceMap": true,
|
||||
"outDir": "./dist",
|
||||
"baseUrl": "./",
|
||||
|
Reference in New Issue
Block a user