mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 09:50:15 +01:00
Fix Input losing focus (#382)
* fix(PaLM2): input losing focus on message stream ending * fix(askOpenAI.js): fix typo in variable name from newUserMassageId to newUserMessageId * feat(chatgpt-browser.js, askBingAI.js, askChatGPTBrowser.js): add onEventMessage callback to browserClient Add onEventMessage callback to browserClient to handle event messages from the server. In askChatGPTBrowser.js, add a getPartialMessage variable to store the partial message text. In askBingAI.js, fix a typo in the variable name newUserMassageId to newUserMessageId. In askChatGPTBrowser.js, remove the preSendRequest parameter and move the sendMessage call to the onEventMessage callback. In askChatGPTBrowser.js, add a check for null or undefined value of getPartialMessage before appending it to the error message. * fix(bing): input no longer loses input focus as convoId is persisted from beginning of convo * refactor(Input): remove unused code and fix input autofocus feat(package.json): add e2e:test-auth script to test authentication flow with saved storage
This commit is contained in:
parent
11b98d3d13
commit
c0845ad0b1
8 changed files with 59 additions and 72 deletions
|
|
@ -1,5 +1,6 @@
|
|||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const crypto = require('crypto');
|
||||
const { titleConvo } = require('../../../app/');
|
||||
const GoogleClient = require('../../../app/google/GoogleClient');
|
||||
const { saveMessage, getConvoTitle, saveConvo, getConvo } = require('../../../models');
|
||||
|
|
@ -7,7 +8,7 @@ const { handleError, sendMessage, createOnProgress } = require('./handlers');
|
|||
const requireJwtAuth = require('../../../middleware/requireJwtAuth');
|
||||
|
||||
router.post('/', requireJwtAuth, async (req, res) => {
|
||||
const { endpoint, text, parentMessageId, conversationId } = req.body;
|
||||
const { endpoint, text, parentMessageId, conversationId: oldConversationId } = req.body;
|
||||
if (text.length === 0) return handleError(res, { text: 'Prompt empty or too short' });
|
||||
if (endpoint !== 'google') return handleError(res, { text: 'Illegal request' });
|
||||
|
||||
|
|
@ -31,6 +32,8 @@ router.post('/', requireJwtAuth, async (req, res) => {
|
|||
return handleError(res, { text: `Illegal request: model` });
|
||||
}
|
||||
|
||||
const conversationId = oldConversationId || crypto.randomUUID();
|
||||
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
return await ask({
|
||||
text,
|
||||
|
|
@ -64,6 +67,8 @@ const ask = async ({ text, endpointOption, parentMessageId = null, conversationI
|
|||
if (!conversationId) {
|
||||
conversationId = data.conversationId;
|
||||
}
|
||||
|
||||
sendMessage(res, { message: userMessage, created: true });
|
||||
};
|
||||
|
||||
const { onProgress: progressCallback } = createOnProgress({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue