Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should we add support for configuring proxy access? #11

Open
qcgm1978 opened this issue May 28, 2023 · 3 comments
Open

Should we add support for configuring proxy access? #11

qcgm1978 opened this issue May 28, 2023 · 3 comments

Comments

@qcgm1978
Copy link

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,
        }),
    });
@ObservedObserver
Copy link
Owner

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

@qcgm1978
Copy link
Author

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.

@PFbHzsiF
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants