mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-23 11:50:14 +01:00
saves all conversations with messages
This commit is contained in:
parent
232a823b9b
commit
511c8c9599
3 changed files with 38 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ const express = require('express');
|
|||
const { ask } = require('../app/chatgpt');
|
||||
const dbConnect = require('../models/dbConnect');
|
||||
const { saveMessage } = require('../models/Message');
|
||||
const { saveConversation } = require('../models/Conversation');
|
||||
const crypto = require('crypto');
|
||||
const path = require('path');
|
||||
const cors = require('cors');
|
||||
|
|
@ -55,6 +56,7 @@ app.post('/ask', async (req, res) => {
|
|||
|
||||
gptResponse.sender = 'GPT';
|
||||
await saveMessage(gptResponse);
|
||||
await saveConversation(gptResponse);
|
||||
|
||||
res.write(`event: message\ndata: ${JSON.stringify(gptResponse)}\n\n`);
|
||||
res.end();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue