Merge pull request #1529 from PaRaD1SE98/main

fix: typo reqestTimeoutId -> requestTimeoutId
This commit is contained in:
Yifei Zhang 2023-05-16 15:31:39 +08:00 committed by GitHub
commit 34426d86dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,7 +61,7 @@ export class ChatGPTApi implements LLMApi {
}; };
// make a fetch request // make a fetch request
const reqestTimeoutId = setTimeout( const requestTimeoutId = setTimeout(
() => controller.abort(), () => controller.abort(),
REQUEST_TIMEOUT_MS, REQUEST_TIMEOUT_MS,
); );
@ -78,7 +78,7 @@ export class ChatGPTApi implements LLMApi {
fetchEventSource(chatPath, { fetchEventSource(chatPath, {
...chatPayload, ...chatPayload,
async onopen(res) { async onopen(res) {
clearTimeout(reqestTimeoutId); clearTimeout(requestTimeoutId);
if (res.status === 401) { if (res.status === 401) {
let extraInfo = { error: undefined }; let extraInfo = { error: undefined };
try { try {
@ -119,7 +119,7 @@ export class ChatGPTApi implements LLMApi {
}); });
} else { } else {
const res = await fetch(chatPath, chatPayload); const res = await fetch(chatPath, chatPayload);
clearTimeout(reqestTimeoutId); clearTimeout(requestTimeoutId);
const resJson = await res.json(); const resJson = await res.json();
const message = this.extractMessage(resJson); const message = this.extractMessage(resJson);