Closed kulame closed 2 months ago
Bot detected the issue body's language is not English, translate it automatically.
Title: [Bug] Configure Alibaba's Tongyi Qianwen to report errors and display cors restrictions
通义千问目前不支持跨域请求,当下只有修改源代码中的地址才行
Tongyi Qianwen does not currently support cross-domain requests. Currently, the only way to do this is to modify the address in the source code.
直接填写官方的地址,在浏览器发请求会触发跨域错误。
可以使用 /api/alibaba
这个内置的地址走next server做转发,或者使用自己部署的转发地址。
但是还是建议通过ALIBABA_API_KEY
以及ALIBABA_URL
自己部署服务使用,以保护自己的key不外泄。
Bot detected the issue body's language is not English, translate it automatically.
Directly filling in the official address and making a request in the browser will trigger a cross-domain error. You can use the built-in address
/api/alibaba
to go to the next server for forwarding, or use the forwarding address deployed by yourself. However, it is still recommended to deploy services yourself throughALIBABA_API_KEY
andALIBABA_URL
to protect your own keys from being leaked.
Bug Description
Access to fetch at 'https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
应该如何处理?
Steps to Reproduce
1 配置ALIBABA_API_KEY和ALIBABA_URL
Expected Behavior
配置通义千问的api结果报错,提示cors错误。
Screenshots
No response
Deployment Method
Desktop OS
No response
Desktop Browser
No response
Desktop Browser Version
No response
Smartphone Device
No response
Smartphone OS
No response
Smartphone Browser
No response
Smartphone Browser Version
No response
Additional Logs
No response