ChatGPTNextWeb / ChatGPT-Next-Web

A cross-platform ChatGPT/Gemini UI (Web / PWA / Linux / Win / MacOS). 一键拥有你自己的跨平台 ChatGPT/Gemini 应用。
https://app.nextchat.dev/
MIT License
72.61k stars 57.69k forks source link

[Bug] 自定义api仅仅可以再localhost中使用 #4907

Closed grmebdn closed 17 hours ago

grmebdn commented 3 days ago

Bug Description

仅能使用localhost无法使用ip地址访问

Steps to Reproduce

1.我使用one-api将多类大模型统一转换成openai接口部署在 一台IP地址为192.168.31.118的UBUNTU计算机上。 2.在测试nextchat的时,仅在192.168.31.118此台机器上可以使用nextchat访问http://localhost:3000才能正常使用,在本机使用局域网地址即http://192.168.31.118:3000也无法使用。 3.在局域网内另外的计算机上接口地址填写http://192.168.31.118:3000依旧无法访问显示Failed to fetch。 4.在局域网内另外的计算机使用地址http://192.168.31.118:3000抓去post请求,发现没有任何响应结果,复制curl使用控制台测试,可以测试完成 以下为CURL: curl 'http://192.168.31.118:3000/v1/chat/completions' \ -H 'Accept: application/json, text/event-stream' \ -H 'Referer;' \ -H 'Authorization: Bearer sk-YHEjYQEM8NITzIHB400357Dd90De42C0A59710Ec3c50846d' \ -H 'Content-Type: application/json' \ --data-raw $'{"messages":[{"role":"system","content":"\nYou are ChatGPT, a large language model trained by OpenAI.\nKnowledge cutoff: 2021-09\nCurrent model: gpt-3.5-turbo\nCurrent time: Mon Jul 01 2024 23:03:06 GMT+0800 (中国标准时间)\nLatex inline: \\(x^2\\) \nLatex block: $$e=mc^2$$\n\n"},{"role":"user","content":"11111"},{"role":"assistant","content":"It seems like you\'ve entered a series of numbers. Is there something specific you would like to know or discuss about the number 11111? Let me know how I can assist you further\u0021"},{"role":"user","content":"模型类型"},{"role":"assistant","content":"我是 GPT-3.5 Turbo 模型,这是由 OpenAI 开发的一种大型语言模型。如果您有关于模型类型或人工智能的其他问题,请随时告诉我,我会尽力回答您的问题。"},{"role":"user","content":"111"}],"stream":true,"model":"gpt-3.5-turbo","temperature":0.5,"presence_penalty":0,"frequency_penalty":0,"top_p":1}'

Expected Behavior

希望提供解决方案

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

Issues-translate-bot commented 3 days ago

Bot detected the issue body's language is not English, translate it automatically.


Title: [Bug] Custom api can only be used in localhost

grmebdn commented 17 hours ago

我一发现问题由于 nextchat 是基于https协议当api为非回环地址的http协议会被拒绝访问,中转服务器最好部署到有ssl的服务器上,或者自签证书

Issues-translate-bot commented 17 hours ago

Bot detected the issue body's language is not English, translate it automatically.


As soon as I discovered the problem, because nextchat is based on the https protocol, when the api is a non-loopback address of the http protocol, access will be denied. The transfer server is best deployed on a server with SSL, or a self-signed certificate.