mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
building potential Server side events
This commit is contained in:
parent
641dcfad73
commit
502bdc5dd5
1 changed files with 16 additions and 3 deletions
|
|
@ -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, () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue