feat: support config host name and proxy address

This commit is contained in:
Wentao Lyu 2023-03-11 14:12:51 +08:00
parent fb9f77ae5e
commit 06c99154ac
4 changed files with 32 additions and 28 deletions

View file

@ -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 }) => {

View file

@ -5,6 +5,7 @@ const clientOptions = {
modelOptions: {
model: 'gpt-3.5-turbo'
},
proxy: process.env.PROXY || null,
debug: false
};

View file

@ -5,6 +5,7 @@ const clientOptions = {
modelOptions: {
model: 'gpt-3.5-turbo'
},
proxy: process.env.PROXY || null,
debug: false
};

View file

@ -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}`);
app.listen(port, host, () => {
console.log(`Server listening at http://${host}:${port}`);
});