Update index.jsx

This commit is contained in:
bsu3338 2023-08-09 00:59:58 -05:00 committed by GitHub
parent f9ed2ad8db
commit 09c68d159e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,7 @@ import { useEffect } from 'react';
import { useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil';
import { SSE, createPayload } from 'librechat-data-provider';
import store from '~/store';
import useSpeechSynthesis from '../Messages/SpeechSynthesis';
import { useAuthContext } from '~/hooks/AuthContext';
export default function MessageHandler() {
@ -11,6 +12,7 @@ export default function MessageHandler() {
const setConversation = useSetRecoilState(store.conversation);
const resetLatestMessage = useResetRecoilState(store.latestMessage);
const { token } = useAuthContext();
const { synthesizeSpeech } = useSpeechSynthesis();
const { refreshConversations } = store.useConversations();
@ -207,6 +209,9 @@ export default function MessageHandler() {
if (data.final) {
finalHandler(data, { ...submission, message });
console.log('final', data);
if (data.responseMessage.text) {
synthesizeSpeech(data.responseMessage.text);
}
}
if (data.created) {
message = {