diff --git a/server/index.js b/server/index.js index 11a64045c8..3a5f56535d 100644 --- a/server/index.js +++ b/server/index.js @@ -1,5 +1,6 @@ const path = require('path'); const express = require('express'); +const { ask } = require('./app/chatgpt'); const app = express(); const port = 3050; app.use(express.json()); @@ -13,9 +14,21 @@ app.get('/', function (req, res) { }); app.post('/ask', (req, res) => { - // Here, you can add the logic to process the user's query - // and generate a response, which you can then send back - // in the response body. + console.log(req.body); + + // res.writeHead(200, { + // Connection: 'keep-alive', + // 'Content-Type': 'text/event-stream', + // 'Cache-Control': 'no-cache, no-transform', + // 'Access-Control-Allow-Origin':'*', + // 'X-Accel-Buffering':'no' + // }); + // res.write('data: This is chunk 1\n'); + // res.write('data: This is chunk 2\n'); + // setTimeout(() => { + // res.write('data: This is chunk 3\n'); + // res.end(); + // }, 3500); }); app.listen(port, () => {