Skip to content

Commit

Permalink
fix(bing): increase timeout to prevent timeout error (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard-Weiss authored Aug 26, 2023
1 parent de60051 commit 918a39d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/BingAIClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import './fetch-polyfill.js';
import crypto from 'crypto';
import WebSocket from 'ws';
import Keyv from 'keyv';
import { ProxyAgent } from 'undici';
import { Agent, ProxyAgent } from 'undici';
import { HttpsProxyAgent } from 'https-proxy-agent';
import { BingImageCreator } from '@timefox/bic-sydney';

Expand Down Expand Up @@ -113,6 +113,8 @@ export default class BingAIClient {
};
if (this.options.proxy) {
fetchOptions.dispatcher = new ProxyAgent(this.options.proxy);
} else {
fetchOptions.dispatcher = new Agent({ connect: { timeout: 20_000 } });
}
const response = await fetch(`${this.options.host}/turing/conversation/create`, fetchOptions);
const body = await response.text();
Expand Down

0 comments on commit 918a39d

Please sign in to comment.