fix: country code judgement problem

This commit is contained in:
ikechan8370 2023-03-24 12:38:03 +08:00
parent c1ca4f2f9b
commit cc1f5611a7
3 changed files with 5 additions and 5 deletions

View file

@ -106,15 +106,17 @@ export default class SydneyAIClient {
let accessible = !(await isCN()) || this.opts.proxy
if (accessible && !Config.sydneyForceUseReverse) {
// 本身能访问bing.com那就不用反代啦重置host
logger.info('change hosts to https://www.bing.com')
this.opts.host = 'https://www.bing.com'
}
logger.mark('使用host' + this.opts.host)
const response = await fetch(`${this.opts.host}/turing/conversation/create`, fetchOptions)
let text = await response.text()
try {
return JSON.parse(text)
} catch (err) {
logger.error('创建sydney对话失败: status code: ' + response.status + response.statusText)
console.error(text)
logger.error(text)
throw new Error(text)
}
}