ilhamdev commited on
Commit
7da299a
·
verified ·
1 Parent(s): bf0f3b5

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +2 -3
index.js CHANGED
@@ -3,13 +3,14 @@ const axios = require('axios');
3
  const bodyParser = require('body-parser');
4
  const fs = require('fs').promises;
5
  const path = require('path');
 
6
 
7
  const app = express();
8
  const port = process.env.PORT || 7860;
9
 
10
  app.use(bodyParser.json());
11
 
12
- const sessionFilePath = path.join(__dirname, 'session.json');
13
  const SESSION_TIMEOUT = 5 * 60 * 1000;
14
  let sessions = {};
15
 
@@ -151,8 +152,6 @@ app.use((req, res, next) => {
151
  next();
152
  });
153
 
154
-
155
-
156
  app.post('/', async (req, res) => {
157
  const { content, user, prompt, webSearchMode } = req.body;
158
  if (!content) {
 
3
  const bodyParser = require('body-parser');
4
  const fs = require('fs').promises;
5
  const path = require('path');
6
+ const os = require('os');
7
 
8
  const app = express();
9
  const port = process.env.PORT || 7860;
10
 
11
  app.use(bodyParser.json());
12
 
13
+ const sessionFilePath = path.join(os.tmpdir(), 'session.json'); // Menggunakan direktori sementara
14
  const SESSION_TIMEOUT = 5 * 60 * 1000;
15
  let sessions = {};
16
 
 
152
  next();
153
  });
154
 
 
 
155
  app.post('/', async (req, res) => {
156
  const { content, user, prompt, webSearchMode } = req.body;
157
  if (!content) {