Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

feat: support config host name and proxy address

Wentao Lyu67156f4a7a64
diff --git a/api/.env.example b/api/.env.example
index 47576c119a..14209cff03 100644
--- a/api/.env.example
+++ b/api/.env.example
@@ -1,7 +1,13 @@
OPENAI_KEY=
+HOST=
PORT=3080
NODE_ENV=development
+
# Change this to your MongoDB URI if different and I recommend appending chatgpt-clone
MONGO_URI="mongodb://127.0.0.1:27017/chatgpt-clone"
+
+# Change this to proxy any request.
+PROXY=
+
CHATGPT_TOKEN=""
BING_TOKEN=""
\ No newline at end of file
diff --git a/api/app/chatgpt-browser.js b/api/app/chatgpt-browser.js
index 442d2a731d..a17f277822 100644
--- a/api/app/chatgpt-browser.js
+++ b/api/app/chatgpt-browser.js
@@ -7,6 +7,7 @@ const clientOptions = {
// Access token from https://chat.openai.com/api/auth/session
accessToken: process.env.CHATGPT_TOKEN,
// debug: true
+ proxy: process.env.PROXY || null,
};
const browserClient = async ({ text, progressCallback, convo }) => {
diff --git a/api/app/chatgpt-client.js b/api/app/chatgpt-client.js
index ce3c0e2271..afd31e0a81 100644
--- a/api/app/chatgpt-client.js
+++ b/api/app/chatgpt-client.js
@@ -5,6 +5,7 @@ const clientOptions = {
modelOptions: {
model: 'gpt-3.5-turbo'
},
+ proxy: process.env.PROXY || null,
debug: false
};
diff --git a/api/app/chatgpt-custom.js b/api/app/chatgpt-custom.js
index d31901c75f..a356ba4b1a 100644
--- a/api/app/chatgpt-custom.js
+++ b/api/app/chatgpt-custom.js
@@ -5,6 +5,7 @@ const clientOptions = {
modelOptions: {
model: 'gpt-3.5-turbo'
},
+ proxy: process.env.PROXY || null,
debug: false
};
diff --git a/api/server/index.js b/api/server/index.js
index a98b5e54fc..be2feffd89 100644
--- a/api/server/index.js
+++ b/api/server/index.js
@@ -5,6 +5,7 @@ const cors = require('cors');
const routes = require('./routes');
const app = express();
const port = process.env.PORT || 3080;
+const host = process.env.HOST || 'localhost'
const projectPath = path.join(__dirname, '..', '..', 'client');
dbConnect().then(() => console.log('Connected to MongoDB'));
@@ -23,6 +24,6 @@ app.use('/api/convos', routes.convos);
app.use('/api/customGpts', routes.customGpts);
app.use('/api/prompts', routes.prompts);
-app.listen(port, () => {
- console.log(`Server listening at http://localhost:${port}`);
-});
\ No newline at end of file
+app.listen(port, host, () => {
+ console.log(`Server listening at http://${host}:${port}`);
+});