From 65b1695e068c09726149dbea664b76032e71d53b Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Mon, 10 Mar 2025 13:26:12 -0600 Subject: [PATCH] Update ReasoningMessageSelector.stories.tsx --- .../ReasoningMessageSelector.stories.tsx | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) diff --git a/web/src/controllers/ReasoningController/ReasoningMessages/ReasoningMessageSelector.stories.tsx b/web/src/controllers/ReasoningController/ReasoningMessages/ReasoningMessageSelector.stories.tsx index f18fd7bbd..c75a81588 100644 --- a/web/src/controllers/ReasoningController/ReasoningMessages/ReasoningMessageSelector.stories.tsx +++ b/web/src/controllers/ReasoningController/ReasoningMessages/ReasoningMessageSelector.stories.tsx @@ -223,3 +223,118 @@ export const SameIdDifferentTypes: Story = { } ] }; + +export const InteractiveTitles: Story = { + args: { + reasoningMessageId: 'reasoning-1', + messageId: 'message-1', + isCompletedStream: false, + chatId: 'chat-1' + }, + decorators: [ + (Story) => { + const queryClient = new QueryClient({ + defaultOptions: { + queries: { + retry: false + } + } + }); + + // Initial message data + const initialMessage = { + ...mockBusterChatMessage, + reasoning_messages: { + 'reasoning-1': { + id: 'reasoning-1', + type: 'text', + title: 'Initial Title', + secondary_title: 'Initial Secondary Title', + message: 'This is the initial message content.', + status: 'completed' + } + } + }; + + // Set initial data + queryClient.setQueryData(['chats', 'messages', 'message-1'], initialMessage); + + // Function to update the message + const updateMessage = ( + updates: Partial<(typeof initialMessage.reasoning_messages)['reasoning-1']> + ) => { + const currentData = queryClient.getQueryData([ + 'chats', + 'messages', + 'message-1' + ]) as typeof initialMessage; + queryClient.setQueryData(['chats', 'messages', 'message-1'], { + ...currentData, + reasoning_messages: { + 'reasoning-1': { + ...currentData.reasoning_messages['reasoning-1'], + ...updates + } + } + }); + }; + + return ( + +
+
+ + + + +
+
+ +
+
+
+ ); + } + ] +};