From a1e4e7c007b3a748da875490927b2798f1bae9e4 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 22 Jan 2025 09:29:26 -0800 Subject: [PATCH] refac: omit reasoning content in payload --- src/lib/components/chat/Chat.svelte | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 507ec481e..ff9b47bfd 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -1473,6 +1473,10 @@ params?.stream_response ?? true; + const removeDetailsWithReasoning = (content) => { + return content.replace(/]*>.*?<\/details>/gis, '').trim(); + }; + const messages = [ params?.system || $settings.system || (responseMessage?.userContext ?? null) ? { @@ -1490,7 +1494,10 @@ }` } : undefined, - ...createMessagesList(responseMessageId) + ...createMessagesList(responseMessageId).map((message) => ({ + ...message, + content: removeDetailsWithReasoning(message.content) + })) ] .filter((message) => message?.content?.trim()) .map((message, idx, arr) => ({