quivr/frontend/app/chat/[chatId]/hooks
王春跃 7c9fdd28ed
fix(streaming): Data Truncation Issue in useHandleStream Function (#2079)
**Description**
This PR introduces modifications to the useHandleStream function in the
useHandleStream.ts file, aiming to resolve the issue of data truncation
leading to incomplete display of Q&A on the front end. By optimizing
data handling logic and enhancing error management, this change ensures
the integrity of data streams and accurate display on the front end.

**Changes Made**
Introduced a variable incompleteData to store and process incomplete
data fragments.
Implemented logic to concatenate incomplete data with new chunks and
parse them once complete.
Added error handling to gracefully manage the parsing of incomplete data
and data strings.
Improved the handling of the first data chunk, enhancing the coherence
of data processing.
**Motivation and Context**
The primary motivation for these changes is to address the issue of
incomplete front-end display, caused by data stream truncation under
unstable network conditions. This optimization is intended to enhance
the stability and reliability of the application when handling large
volumes of real-time data streams, ensuring that the user interface
correctly displays complete Q&A information.

**Checklist before requesting a review**
 My code follows the style guidelines of this project.
 I have performed a self-review of my own code.
 I have commented in hard-to-understand areas of my code.
 I have made corresponding changes to the documentation (if applicable).
I have added tests that prove my fix is effective or that my feature
works (if applicable).
 New and existing unit tests pass locally with my changes.
Any dependent changes have been merged and published in downstream
modules (if applicable).
**Screenshots (if appropriate)**

![image](https://github.com/StanGirard/quivr/assets/80630709/fb4f4c7f-5541-418c-8d9a-2cdc8ea641b9)

Co-authored-by: qcloud <ubuntu@localhost.localdomain>
Co-authored-by: Stan Girard <girard.stanislas@gmail.com>
2024-01-25 18:03:08 -08:00
..
useChat.ts feat(panel): added (#2088) 2024-01-25 12:44:24 -08:00
useChatNotificationsSync.ts fix(frontend): set chat messages only if needed (#2040) 2024-01-20 18:39:27 -08:00
useChatsList.ts feat: add chat view new design (#1897) 2023-12-14 16:22:09 +01:00
useHandleStream.ts fix(streaming): Data Truncation Issue in useHandleStream Function (#2079) 2024-01-25 18:03:08 -08:00
useLocalStorageChatConfig.ts feat: update models logic (#1767) 2023-11-30 22:08:36 +01:00
useQuestion.ts feat(frontend): Add Brain On Search Page (#2067) 2024-01-22 17:37:45 -08:00