balibabu commited on
Commit
7b68d9e
·
1 Parent(s): e536bf7

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

Browse files

### 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)

web/src/hooks/chat-hooks.ts CHANGED
@@ -95,7 +95,12 @@ export const useSetNextDialog = () => {
95
  mutationFn: async (params: IDialog) => {
96
  const { data } = await chatService.setDialog(params);
97
  if (data.retcode === 0) {
98
- queryClient.invalidateQueries({ queryKey: ['fetchDialogList'] });
 
 
 
 
 
99
  message.success(
100
  i18n.t(`message.${params.dialog_id ? 'modified' : 'created'}`),
101
  );
@@ -110,7 +115,11 @@ export const useSetNextDialog = () => {
110
  export const useFetchNextDialog = () => {
111
  const { dialogId } = useGetChatSearchParams();
112
 
113
- const { data, isFetching: loading } = useQuery<IDialog>({
 
 
 
 
114
  queryKey: ['fetchDialog', dialogId],
115
  gcTime: 0,
116
  initialData: {} as IDialog,
@@ -123,7 +132,7 @@ export const useFetchNextDialog = () => {
123
  },
124
  });
125
 
126
- return { data, loading };
127
  };
128
 
129
  export const useFetchManualDialog = () => {
 
95
  mutationFn: async (params: IDialog) => {
96
  const { data } = await chatService.setDialog(params);
97
  if (data.retcode === 0) {
98
+ queryClient.invalidateQueries({
99
+ queryKey: ['fetchDialogList'],
100
+ });
101
+ queryClient.invalidateQueries({
102
+ queryKey: ['fetchDialog'],
103
+ });
104
  message.success(
105
  i18n.t(`message.${params.dialog_id ? 'modified' : 'created'}`),
106
  );
 
115
  export const useFetchNextDialog = () => {
116
  const { dialogId } = useGetChatSearchParams();
117
 
118
+ const {
119
+ data,
120
+ isFetching: loading,
121
+ refetch,
122
+ } = useQuery<IDialog>({
123
  queryKey: ['fetchDialog', dialogId],
124
  gcTime: 0,
125
  initialData: {} as IDialog,
 
132
  },
133
  });
134
 
135
+ return { data, loading, refetch };
136
  };
137
 
138
  export const useFetchManualDialog = () => {
web/src/pages/chat/hooks.ts CHANGED
@@ -429,7 +429,7 @@ export const useSendNextMessage = () => {
429
  if (
430
  answer.answer &&
431
  (answer?.conversationId === conversationId ||
432
- (!done && conversationId === ''))
433
  ) {
434
  addNewestAnswer(answer);
435
  }
 
429
  if (
430
  answer.answer &&
431
  (answer?.conversationId === conversationId ||
432
+ ((!done || (done && answer.audio_binary)) && conversationId === ''))
433
  ) {
434
  addNewestAnswer(answer);
435
  }