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

APP:// CORS问题 #158

Open
conql opened this issue Apr 2, 2024 · 9 comments
Open

APP:// CORS问题 #158

conql opened this issue Apr 2, 2024 · 9 comments
Assignees
Labels
bug Something isn't working version up Pro version features of the devolution of the open source version

Comments

@conql
Copy link

conql commented Apr 2, 2024

使用OpenAI Node API库请求时会导致CORS错误。
image

X-Stainless-.......的请求头是由OpenAI的官方库引入的
image

@zmh-program zmh-program changed the title X-Stainless请求头导致CORS问题 APP:// CORS问题 Apr 2, 2024
@zmh-program zmh-program added bug Something isn't working browser-compatibility Browser compatibility labels Apr 2, 2024
@zmh-program zmh-program self-assigned this Apr 2, 2024
@zmh-program
Copy link
Member

自定义请求头一般是不会影响的,目测可能是app:// scheme的问题

@conql
Copy link
Author

conql commented Apr 2, 2024

自定义请求头一般是不会影响的,目测可能是app:// scheme的问题

又测试了一下,好像不是

image

复现代码:

await fetch("https://api.chatnio.net/v1/models",{
    method:"GET",
    headers:{
    }
}).then(t=>t.json()).then(t=>console.log("No header",t))

await fetch("https://api.chatnio.net/v1/models",{
    method:"GET",
    headers:{
        "X-Stainless-Lang":"js"
    }
}).then(t=>t.json()).then(t=>console.log("Has header",t))

@zmh-program
Copy link
Member

这是你的app的问题吧

@conql
Copy link
Author

conql commented Apr 2, 2024

image

@conql
Copy link
Author

conql commented Apr 2, 2024

https://chatnio.net 上跑也一样

@zmh-program
Copy link
Member

浏览器?

@conql
Copy link
Author

conql commented Apr 2, 2024

是的

@zmh-program
Copy link
Member

zmh-program commented Apr 2, 2024

OK 复现到了 等我处理完 #77 来处理

@zmh-program
Copy link
Member

商业版和chatnio官网已经修复,功能将由 @Sh1n3zZ 下放开源版。

@zmh-program zmh-program added version up Pro version features of the devolution of the open source version and removed browser-compatibility Browser compatibility labels Apr 8, 2024
@zmh-program zmh-program assigned Sh1n3zZ and unassigned zmh-program Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working version up Pro version features of the devolution of the open source version
Projects
None yet
Development

No branches or pull requests

3 participants