feat: When voice is turned on, the page will not display an empty reply message when the answer is empty #1877 (#2447)

### What problem does this PR solve?

feat: When voice is turned on, the page will not display an empty reply
message when the answer is empty #1877

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu 2024-09-14 18:39:13 +08:00 committed by GitHub
parent 3b1375ef99
commit 2f33ec7ad0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 4 deletions

View File

@ -95,7 +95,12 @@ export const useSetNextDialog = () => {
mutationFn: async (params: IDialog) => { mutationFn: async (params: IDialog) => {
const { data } = await chatService.setDialog(params); const { data } = await chatService.setDialog(params);
if (data.retcode === 0) { if (data.retcode === 0) {
queryClient.invalidateQueries({ queryKey: ['fetchDialogList'] }); queryClient.invalidateQueries({
queryKey: ['fetchDialogList'],
});
queryClient.invalidateQueries({
queryKey: ['fetchDialog'],
});
message.success( message.success(
i18n.t(`message.${params.dialog_id ? 'modified' : 'created'}`), i18n.t(`message.${params.dialog_id ? 'modified' : 'created'}`),
); );
@ -110,7 +115,11 @@ export const useSetNextDialog = () => {
export const useFetchNextDialog = () => { export const useFetchNextDialog = () => {
const { dialogId } = useGetChatSearchParams(); const { dialogId } = useGetChatSearchParams();
const { data, isFetching: loading } = useQuery<IDialog>({ const {
data,
isFetching: loading,
refetch,
} = useQuery<IDialog>({
queryKey: ['fetchDialog', dialogId], queryKey: ['fetchDialog', dialogId],
gcTime: 0, gcTime: 0,
initialData: {} as IDialog, initialData: {} as IDialog,
@ -123,7 +132,7 @@ export const useFetchNextDialog = () => {
}, },
}); });
return { data, loading }; return { data, loading, refetch };
}; };
export const useFetchManualDialog = () => { export const useFetchManualDialog = () => {

View File

@ -429,7 +429,7 @@ export const useSendNextMessage = () => {
if ( if (
answer.answer && answer.answer &&
(answer?.conversationId === conversationId || (answer?.conversationId === conversationId ||
(!done && conversationId === '')) ((!done || (done && answer.audio_binary)) && conversationId === ''))
) { ) {
addNewestAnswer(answer); addNewestAnswer(answer);
} }