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 347491f0af..5f65569b27 100644 --- a/api/server/index.js +++ b/api/server/index.js @@ -1,28 +1,29 @@ -const express = require('express'); -const dbConnect = require('../models/dbConnect'); -const path = require('path'); -const cors = require('cors'); -const routes = require('./routes'); -const app = express(); -const port = process.env.PORT || 3080; -const projectPath = path.join(__dirname, '..', '..', 'client'); -dbConnect().then(() => console.log('Connected to MongoDB')); - -app.use(cors()); -app.use(express.json()); -app.use(express.static(path.join(projectPath, 'public'))); - -app.get('/', function (req, res) { - console.log(path.join(projectPath, 'public', 'index.html')); - res.sendFile(path.join(projectPath, 'public', 'index.html')); -}); - -app.use('/api/ask', routes.ask); -app.use('/api/messages', routes.messages); -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 +const express = require('express'); +const dbConnect = require('../models/dbConnect'); +const path = require('path'); +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')); + +app.use(cors()); +app.use(express.json()); +app.use(express.static(path.join(projectPath, 'public'))); + +app.get('/', function (req, res) { + console.log(path.join(projectPath, 'public', 'index.html')); + res.sendFile(path.join(projectPath, 'public', 'index.html')); +}); + +app.use('/api/ask', routes.ask); +app.use('/api/messages', routes.messages); +app.use('/api/convos', routes.convos); +app.use('/api/customGpts', routes.customGpts); +app.use('/api/prompts', routes.prompts); + +app.listen(port, host, () => { + console.log(`Server listening at http://${host}:${port}`); +}); \ No newline at end of file