From 6a413cdaefea4e048167440090d1eff8ad680114 Mon Sep 17 00:00:00 2001 From: Arik Chakma Date: Thu, 5 Jun 2025 14:42:20 +0600 Subject: [PATCH] wip --- src/components/AIChat/AIChat.tsx | 1 + src/lib/chat.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/AIChat/AIChat.tsx b/src/components/AIChat/AIChat.tsx index 46208b075..61ed86243 100644 --- a/src/components/AIChat/AIChat.tsx +++ b/src/components/AIChat/AIChat.tsx @@ -183,6 +183,7 @@ export function AIChat(props: AIChatProps) { }, credentials: 'include', body: JSON.stringify({ + chatHistoryId: chatDetails?.chatHistoryId, messages: messages.slice(-10), force, }), diff --git a/src/lib/chat.ts b/src/lib/chat.ts index 2c9cb4650..4593c8ffc 100644 --- a/src/lib/chat.ts +++ b/src/lib/chat.ts @@ -24,7 +24,8 @@ export async function readChatStream( break; } - const text = decoder.decode(value); + const textWithNewLine = decoder.decode(value); + const text = textWithNewLine.replace(/\n$/, ''); if (text.startsWith(CHAT_RESPONSE_PREFIX.message)) { const textWithoutPrefix = text.replace(CHAT_RESPONSE_PREFIX.message, '');