mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
fix: Fixed an issue where the first message would be displayed when sending the second message #2625 (#2626)
### What problem does this PR solve? fix: Fixed an issue where the first message would be displayed when sending the second message #2625 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [ ] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Other (please describe):
This commit is contained in:
@ -224,6 +224,7 @@ export const useSendMessageWithSse = (
|
||||
const send = useCallback(
|
||||
async (
|
||||
body: any,
|
||||
controller?: AbortController,
|
||||
): Promise<{ response: Response; data: ResponseType } | undefined> => {
|
||||
try {
|
||||
setDone(false);
|
||||
@ -234,6 +235,7 @@ export const useSendMessageWithSse = (
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
signal: controller?.signal,
|
||||
});
|
||||
|
||||
const res = response.clone().json();
|
||||
@ -249,6 +251,7 @@ export const useSendMessageWithSse = (
|
||||
const { done, value } = x;
|
||||
if (done) {
|
||||
console.info('done');
|
||||
setAnswer({} as IAnswer);
|
||||
break;
|
||||
}
|
||||
try {
|
||||
@ -268,9 +271,12 @@ export const useSendMessageWithSse = (
|
||||
}
|
||||
console.info('done?');
|
||||
setDone(true);
|
||||
setAnswer({} as IAnswer);
|
||||
return { data: await res, response };
|
||||
} catch (e) {
|
||||
setDone(true);
|
||||
setAnswer({} as IAnswer);
|
||||
|
||||
console.warn(e);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user