Added Streaming output rendering functionality #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several changes to the chat functionality, focusing on adding support for streaming responses and refactoring the existing code to improve maintainability. The most important changes include the addition of streaming response handling, updates to the
ChatService
to support streaming, and modifications to theChatContainer
andChatInput
components to accommodate these new features.Streaming Response Handling:
src/components/ChatContainer/ChatContainer.tsx
: Added a new stateuseStreaming
and modified thehandleMessageSubmit
function to handle streaming responses using the newhandleStreamingResponse
andhandleSyncResponse
functions. [1] [2] [3] [4] [5]src/components/ChatInput/ChatInput.tsx
: Updated theonSubmit
function to accept aMessageHandlerConfig
parameter and handle streaming settings. [1] [2] [3]src/services/ChatService.ts
: Added thesendStreamMessage
function to handle streaming responses from the API. [1] [2]src/types/chat.ts
: Added new interfacesStreamSettings
andMessageHandlerConfig
to support streaming configurations.Code Refactoring:
src/components/ChatContainer/ChatContainer.tsx
: Refactored theChatContainerProps
interface to move it to thetypes/chat.ts
file.src/services/APIClient.ts
: Added a newfetchStream
method to handle streaming API requests.