mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-30 15:16:45 +08:00
### What problem does this PR solve? Feat: The chat feature supports streaming output, displaying results one by one. ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -274,10 +274,23 @@ export const useSendMessageWithSse = (
|
||||
const val = JSON.parse(value?.data || '');
|
||||
const d = val?.data;
|
||||
if (typeof d !== 'boolean') {
|
||||
setAnswer({
|
||||
...d,
|
||||
conversationId: body?.conversation_id,
|
||||
chatBoxId: body.chatBoxId,
|
||||
setAnswer((prev) => {
|
||||
let newAnswer = (prev.answer || '') + (d.answer || '');
|
||||
|
||||
if (d.start_to_think === true) {
|
||||
newAnswer = newAnswer + '<think>';
|
||||
}
|
||||
|
||||
if (d.end_to_think === true) {
|
||||
newAnswer = newAnswer + '</think>';
|
||||
}
|
||||
|
||||
return {
|
||||
...d,
|
||||
answer: newAnswer,
|
||||
conversationId: body?.conversation_id,
|
||||
chatBoxId: body.chatBoxId,
|
||||
};
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user