mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
fix: customGpt persistence blindspot, also remove free gpt
This commit is contained in:
parent
da55ac3774
commit
da61a2841f
5 changed files with 46 additions and 21 deletions
|
|
@ -9,14 +9,13 @@ const {
|
|||
customClient,
|
||||
detectCode
|
||||
} = require('../../app/');
|
||||
const { saveMessage, deleteMessages, saveConvo } = require('../../models');
|
||||
const { getConvo, saveMessage, deleteMessages, saveConvo } = require('../../models');
|
||||
const { handleError, sendMessage } = require('./handlers');
|
||||
|
||||
router.use('/bing', askBing);
|
||||
|
||||
router.post('/', async (req, res) => {
|
||||
const { model, text, parentMessageId, conversationId, chatGptLabel, promptPrefix } =
|
||||
req.body;
|
||||
let { model, text, parentMessageId, conversationId, chatGptLabel, promptPrefix } = req.body;
|
||||
if (!text.trim().includes(' ') && text.length < 5) {
|
||||
return handleError(res, 'Prompt empty or too short');
|
||||
}
|
||||
|
|
@ -43,6 +42,15 @@ router.post('/', async (req, res) => {
|
|||
client = browserClient;
|
||||
}
|
||||
|
||||
if (model === 'chatgptCustom' && !chatGptLabel && conversationId) {
|
||||
const convo = await getConvo({ conversationId });
|
||||
if (convo) {
|
||||
console.log('found convo for custom gpt', { convo })
|
||||
chatGptLabel = convo.chatGptLabel;
|
||||
promptPrefix = convo.promptPrefix;
|
||||
}
|
||||
}
|
||||
|
||||
res.writeHead(200, {
|
||||
Connection: 'keep-alive',
|
||||
'Content-Type': 'text/event-stream',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue