Kuingsmile / word-GPT-Plus

Word GPT Plus is a word add-in which integrates the chatGPT model into Microsoft Word. Both official and web api is supported.
MIT License
706 stars 109 forks source link

[Bug]: 在使用azure的API时,报错RestError: Error sending request: Failed to fetch #51

Closed StarrySkyWill closed 6 months ago

StarrySkyWill commented 6 months ago

前置阅读 | Pre-reading

服务类型 | Service Type

Official hosted service

系统信息 | System Information

Windows

Office 版本 | Office Version

microsoft 365

问题重现 | Bug reproduce

您好,我在GPT plus中使用学校提供的azure api接口时,出现了错误“RestError: Error sending request: Failed to fetch”,测试信息: Endpoint: https://hkust.azure-api.net Deploy name: gpt-35-turbo 完整的URL: https://hkust.azure-api.net/openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-06-01-preview 该URL在服务器(Postman API Platform)上测试,是可以获得回答的,参见下图。 请问这可能是什么原因造成的?

2024-03-22_163049
StarrySkyWill commented 6 months ago

抱歉,刚刚忘记打开调试器,这里附上调试器的信息,似乎是CORS报头的问题

2024-03-22_164016
Kuingsmile commented 6 months ago

因为这个服务是纯前端部署的,所以请求存在跨域问题,如果你的服务方没有设置允许跨域的话

StarrySkyWill commented 6 months ago

因为这个服务是纯前端部署的,所以请求存在跨域问题,如果你的服务方没有设置允许跨域的话

是的带佬,我折腾一下午已经意识到这好像是server设置的问题,我在github上还找到了这个项目https://github.com/FlandiaYingman/chatgpt-at-hkust-cors 看起来不是我一个人遇到这个问题,应该是学校没打算让我们在第三方平台上用api,不是插件的问题,不好意思打扰了,感谢大佬回复。