Coder Social home page Coder Social logo

Comments (25)

WAGMY avatar WAGMY commented on June 11, 2024 1

Same problem, Macos + Docker, Set api to localhost works fine, but it won't work if set to my own server ip, but I can access the api service well via python script.

from chatgpt-next-web.

likeman66 avatar likeman66 commented on June 11, 2024 1

kind reminder, ur api domain exposed in ur first image

from chatgpt-next-web.

Issues-translate-bot avatar Issues-translate-bot commented on June 11, 2024

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


Title: http custom API only supports localhost, and cannot be accessed using non-native IP or url [Bug]

from chatgpt-next-web.

fred-bf avatar fred-bf commented on June 11, 2024

from you screenshot it seems to the cors issue with your openai api provider?

from chatgpt-next-web.

wjfu99 avatar wjfu99 commented on June 11, 2024

from you screenshot it seems to the cors issue with your openai api provider?

but if i forward the api provider ip&port to local, then the nextweb works well, it's very strange. By the way, the api provider is deployed in a server on the same subnet, and i currently use vscode for prot forwarding.😂

from chatgpt-next-web.

wjfu99 avatar wjfu99 commented on June 11, 2024

sorry, close the issue by accident.

from chatgpt-next-web.

wjfu99 avatar wjfu99 commented on June 11, 2024

from you screenshot it seems to the cors issue with your openai api provider?

Besides, I can access the API service well via curl command:

curl --location 'http://ip:port/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: xxxxx' \
--data '{
  "model": "gpt-4",
  "messages": [ {"role": "user", "content": "hello"}]
}'

the api service also works with a congeneric app ChatX, but in NextChat, it still not work.

from chatgpt-next-web.

wjfu99 avatar wjfu99 commented on June 11, 2024

I have used Burp Suite to capture http package, and the result demonstrate that when using a API deployed in localhost, the request packages are sent correctly:

OPTIONS /v1/chat/completions HTTP/1.1
Host: localhost:1999
Accept: */*
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type,x-requested-with
Origin: https://app.nextchat.dev
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.6167.160 Safari/537.36
Sec-Fetch-Mode: cors
Sec-Fetch-Site: cross-site
Sec-Fetch-Dest: empty
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Connection: close
POST /v1/chat/completions HTTP/1.1
Host: localhost:1999
Content-Length: 773
sec-ch-ua: "Chromium";v="121", "Not A(Brand";v="99"
Accept: application/json, text/event-stream
Content-Type: application/json
x-requested-with: XMLHttpRequest
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.6167.160 Safari/537.36
sec-ch-ua-platform: "macOS"
Origin: https://app.nextchat.dev
Sec-Fetch-Site: cross-site
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Connection: close

{"messages":[{"role":"system","content":"\nYou are ChatGPT, a large language model trained by OpenAI.\nKnowledge cutoff: 2021-09\nCurrent model: gpt-4\nCurrent time: 2/22/2024, 9:31:13 AM\nLatex inline: $x^2$ \nLatex block: $$e=mc^2$$\n\n"},{"role":"user","content":"hello"},{"role":"assistant","content":"Hello! How can I assist you today?"},{"role":"user","content":"0.0.0.0 是监听本机所有 ip 吗"},{"role":"assistant","content":"\n\nUnauthorized access, please enter access code in [auth](/#/auth) page, or enter your OpenAI API Key.\n\n```json\n{\n  \"error\": \"Unauthorized\"\n}\n```"},{"role":"user","content":"docker -e 可以添加多个环境变量吗"}],"stream":true,"model":"gpt-4","temperature":0.5,"presence_penalty":0,"frequency_penalty":0,"top_p":1}

And if I set the endpoint API to another subnet host (Like http://222.21.136.207:1999), then no http package is captured, and the NextChat just raise an error:
image

However, if I set the API to localhost back, then capture and redirect the http package to the subnet host. In this way, NextChat can receive the response package from the subnet host and works correctly, which can not achieved by directly set the subnet host API as the endpoint API in the configuration.

from chatgpt-next-web.

SubtleSpark avatar SubtleSpark commented on June 11, 2024

你是不是使用了 NAT 进行了端口映射,这可能会有 NAT 环回的问题。

from chatgpt-next-web.

Issues-translate-bot avatar Issues-translate-bot commented on June 11, 2024

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


Have you used NAT for port mapping? This may cause NAT loopback problems.

from chatgpt-next-web.

wjfu99 avatar wjfu99 commented on June 11, 2024

你是不是使用了 NAT 进行了端口映射,这可能会有 NAT 环回的问题。

我应该没有主动配置 NAT 端口映射,而且 NAT 环回会导致 NextChat这类 app不能 send url request 吗?主要用 curl又是好的,就很奇怪。

from chatgpt-next-web.

Issues-translate-bot avatar Issues-translate-bot commented on June 11, 2024

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


Have you used NAT for port mapping? This may cause NAT loopback problems.
I should not have actively configured NAT port mapping, and will NAT loopback prevent apps like NextChat from sending url requests? Mainly using curl is fine, but it's strange.

from chatgpt-next-web.

WAGMY avatar WAGMY commented on June 11, 2024

Same problem, Macos + Docker, Set api to localhost works fine, but it won't work if set to my own server ip, but I can access the api service well via python script.

Supplement: If using windows nextchat client, it work fine if set to my own server ip

from chatgpt-next-web.

wjfu99 avatar wjfu99 commented on June 11, 2024

Same problem, Macos + Docker, Set api to localhost works fine, but it won't work if set to my own server ip, but I can access the api service well via python script.

Supplement: If using windows nextchat client, it work fine if set to my own server ip

Very useful information, i'm a mac user too, and the nextchat web also didn't work on ios device. i will test it on windows later.

from chatgpt-next-web.

daobee avatar daobee commented on June 11, 2024

Same problem.
I hosted a OpenAI-Like API on server and it works fine with curl(on macos)/Next-Web(on windows client),but raised a error using Next-Web(on macos client)

curl(on macos):
image
Next-Web(on windows client):
Just works fine.
Next-Web(on macos client):
image

from chatgpt-next-web.

wjfu99 avatar wjfu99 commented on June 11, 2024

@fred-bf I believe the bug tag should be added back, since another issue #2810 reveals this bug too. This bug seems to exist for a period.

from chatgpt-next-web.

H0llyW00dzZ avatar H0llyW00dzZ commented on June 11, 2024

I don't have any issues with this; it has been running on Kubernetes (k8s) without problems

from chatgpt-next-web.

wjfu99 avatar wjfu99 commented on June 11, 2024

I don't have any issues with this; it has been running on Kubernetes (k8s) without problems

Are you using an Mac client? It seems that the issue only exist on Mac.

from chatgpt-next-web.

H0llyW00dzZ avatar H0llyW00dzZ commented on June 11, 2024

I don't have any issues with this; it has been running on Kubernetes (k8s) without problems

Are you using an Mac client? It seems that the issue only exist on Mac.

right now I am using windows client and using port-forward pods k8s

from chatgpt-next-web.

fred-bf avatar fred-bf commented on June 11, 2024

I just tried build a development macOS client, it could make request to custom ip. But when switching to a online version, I could reproduce this issue. It might be released to tauri production build configuration?

from chatgpt-next-web.

H0llyW00dzZ avatar H0llyW00dzZ commented on June 11, 2024

I just tried build a development macOS client, it could make request to custom ip. But when switching to a online version, I could reproduce this issue. It might be released to tauri production build configuration?

no,the problem its not only desktop

image

from chatgpt-next-web.

wjfu99 avatar wjfu99 commented on June 11, 2024

I just tried build a development macOS client, it could make request to custom ip. But when switching to a online version, I could reproduce this issue. It might be released to tauri production build configuration?

Supplement: the same problem also occurs on the online web version (app.nextchat.dev) and the self-deployed vercel version. Hope this info help.

from chatgpt-next-web.

fred-bf avatar fred-bf commented on June 11, 2024

@wjfu99 For web version, plz check whether its blocked by mixed https content
CleanShot 2024-02-26 at 12 39 17@2x

from chatgpt-next-web.

wjfu99 avatar wjfu99 commented on June 11, 2024

@fred-bf Hi, you are absolutely right! i check the console log, and find the mixed content error:
image
So, this issue on web version can be solved by allowing the insecure content in website permission:
image
By the way, do you have any ideas on how to solve this problem in the local client version?🤣

@wjfu99 For web version, plz check whether its blocked by mixed https content CleanShot 2024-02-26 at 12 39 17@2x

from chatgpt-next-web.

fred-bf avatar fred-bf commented on June 11, 2024

close for now, please feel free to report if you encounter any additional issue

from chatgpt-next-web.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.