mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
Update useServerStream.ts
This commit is contained in:
parent
3e36c16817
commit
c041c329cf
1 changed files with 5 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ import { useResetRecoilState, useSetRecoilState } from 'recoil';
|
||||||
import { SSE, createPayload, tMessageSchema, tConversationSchema } from 'librechat-data-provider';
|
import { SSE, createPayload, tMessageSchema, tConversationSchema } from 'librechat-data-provider';
|
||||||
import type { TResPlugin, TMessage, TConversation, TSubmission } from 'librechat-data-provider';
|
import type { TResPlugin, TMessage, TConversation, TSubmission } from 'librechat-data-provider';
|
||||||
import { useAuthContext } from '~/hooks/AuthContext';
|
import { useAuthContext } from '~/hooks/AuthContext';
|
||||||
|
import useSpeechSynthesis from '../Messages/SpeechSynthesis';
|
||||||
import store from '~/store';
|
import store from '~/store';
|
||||||
|
|
||||||
type TResData = {
|
type TResData = {
|
||||||
|
|
@ -20,6 +21,7 @@ export default function useServerStream(submission: TSubmission | null) {
|
||||||
const setConversation = useSetRecoilState(store.conversation);
|
const setConversation = useSetRecoilState(store.conversation);
|
||||||
const resetLatestMessage = useResetRecoilState(store.latestMessage);
|
const resetLatestMessage = useResetRecoilState(store.latestMessage);
|
||||||
const { token } = useAuthContext();
|
const { token } = useAuthContext();
|
||||||
|
const { synthesizeSpeech } = useSpeechSynthesis();
|
||||||
|
|
||||||
const { refreshConversations } = store.useConversations();
|
const { refreshConversations } = store.useConversations();
|
||||||
|
|
||||||
|
|
@ -226,6 +228,9 @@ export default function useServerStream(submission: TSubmission | null) {
|
||||||
const { plugins } = data;
|
const { plugins } = data;
|
||||||
finalHandler(data, { ...submission, plugins, message });
|
finalHandler(data, { ...submission, plugins, message });
|
||||||
console.log('final', data);
|
console.log('final', data);
|
||||||
|
if (data.responseMessage.text) {
|
||||||
|
synthesizeSpeech(data.responseMessage.text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (data.created) {
|
if (data.created) {
|
||||||
message = {
|
message = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue