Skip to content

Commit

Permalink
feat: add event logging into production and space between chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeocodes committed Nov 18, 2024
1 parent 83c5406 commit f04c2a0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/context/WebSocketContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export const WebSocketProvider = ({ children }: WebSocketProviderProps) => {
// WebSocket message handler
function handleWebSocketMessage(event: MessageEvent) {
if (typeof event.data === "string") {
console.log(event);
const msgObj = JSON.parse(event.data);
const { type: messageType } = msgObj;

Expand All @@ -161,7 +162,7 @@ export const WebSocketProvider = ({ children }: WebSocketProviderProps) => {
if (incomingMessage.current) {
incomingMessage.current = {
...incomingMessage.current,
content: incomingMessage.current.content + text,
content: incomingMessage.current.content + " " + text,
};
setChatMessages((prev) => {
const updatedMessages = [...prev];
Expand Down

1 comment on commit f04c2a0

@vercel
Copy link

@vercel vercel bot commented on f04c2a0 Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.