Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: 设置OpenAI的请求地址里如果域名后面带端口的话就会一直报错 #999

Open
coulsontl opened this issue Dec 15, 2024 · 0 comments
Assignees

Comments

@coulsontl
Copy link

coulsontl commented Dec 15, 2024

Description

设置OpenAI的请求地址里域名后面如果带自定义的端口号的话就会一直报错

Network Error: error sending request for url (https://xxxx.com:3030/v1/chat/completions): error trying to connect: 接收到的消息异常,或格式不正确。 (os error -2146893018): error sending request for url (https://xxxx.com:3030/v1/chat/completions): error trying to connect: 接收到的消息异常,或格式不正确。 (os error -2146893018): error trying to connect: 接收到的消息异常,或格式不正确。 (os error -2146893018): 接收到的消息异常,或格式不正确。 (os error -2146893018)

看代码.\src\services\translate\openai现在的请求方式是:

let res = await fetch(apiUrl.href, {
    method: 'POST',
    headers: headers,
    body: Body.json(body),
});

相同的地址使用下面这种方式去请求的话就不会报错了

const res = await window.fetch(apiUrl.href, {
    method: 'POST',
    headers: headers,
    body: JSON.stringify(body)
});

const result = await res.json();

感觉是tauri的网络库版本太老了,需要升级了

Reproduction

添加内置服务OpenAI,然后设置请求地址,保存时报错

Platform

Windows

System Version

Win11 24H2 26100.2605

Window System (Linux Only)

None

Software Version

3.0.6

Log File

No response

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants