viz-gpt icon indicating copy to clipboard operation
viz-gpt copied to clipboard

Should we add support for configuring proxy access?

Open qcgm1978 opened this issue 1 year ago • 3 comments

You can use HttpsProxyAgent to access the proxy in vizchat.ts. PROXY_URL can be configured in the .env file as shown below:

PROXY_URL=
import {HttpsProxyAgent} from "https-proxy-agent";
const proxy_url = process.env.PROXY_URL;
const agent= new HttpsProxyAgent(proxy_url)
...
const response = await fetch(url, {
        method: "POST",
        headers: {
            "Content-Type": "application/json",
            Authorization: `Bearer ${process.env.OPENAI_KEY}`,
        },
        agent,
        body: JSON.stringify({
            model: "gpt-3.5-turbo",
            messages: messages,
            temperature: TEMPERATURE,
            n: 1,
        }),
    });

qcgm1978 avatar May 28 '23 01:05 qcgm1978

I'm not quite sure when we need a proxy and why.

ObservedObserver avatar May 29 '23 03:05 ObservedObserver

I'm not quite sure when we need a proxy and why.

I come from a country where direct access to the OpenAI API is not possible, so I can only access it through a proxy. Therefore, I need this feature, otherwise I won't be able to connect to OpenAI and get answers when using this project.

qcgm1978 avatar May 29 '23 06:05 qcgm1978

There are quite a few different apps can working at enhanced mode to force all internet traffic to flow through the proxy. Surge and Clash. It works at virtual physical layer. Should be working at here.

PFbHzsiF avatar May 29 '23 12:05 PFbHzsiF