From a6bdd0eeb576eac80f7c9d609ed3165a896f1eeb Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Wed, 16 Apr 2025 09:08:53 -0600 Subject: [PATCH] =?UTF-8?q?add=20test=20for=20snapping=20over=20reasoning?= =?UTF-8?q?=20message=20=F0=9F=90=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../helpers/assetParamsToRoute.test.ts | 17 +++++++++++++ .../helpers/assetParamsToRoute.ts | 25 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/web/src/layouts/ChatLayout/ChatLayoutContext/helpers/assetParamsToRoute.test.ts b/web/src/layouts/ChatLayout/ChatLayoutContext/helpers/assetParamsToRoute.test.ts index 6f7c978b6..0466cd087 100644 --- a/web/src/layouts/ChatLayout/ChatLayoutContext/helpers/assetParamsToRoute.test.ts +++ b/web/src/layouts/ChatLayout/ChatLayoutContext/helpers/assetParamsToRoute.test.ts @@ -503,4 +503,21 @@ describe('assetParamsToRoute', () => { }) ); }); + + test('reasoning messaged with chatid', () => { + const test = { + assetId: '06d9d8b7-eb96-59af-9a03-0436205b60a9', + type: 'reasoning', + chatId: 'chat-123' + } as const; + + const result = assetParamsToRoute(test); + expect(result).toBe( + createBusterRoute({ + route: BusterRoutes.APP_CHAT_ID_REASONING_ID, + chatId: test.chatId, + messageId: test.assetId + }) + ); + }); }); diff --git a/web/src/layouts/ChatLayout/ChatLayoutContext/helpers/assetParamsToRoute.ts b/web/src/layouts/ChatLayout/ChatLayoutContext/helpers/assetParamsToRoute.ts index f3879915a..8a0245583 100644 --- a/web/src/layouts/ChatLayout/ChatLayoutContext/helpers/assetParamsToRoute.ts +++ b/web/src/layouts/ChatLayout/ChatLayoutContext/helpers/assetParamsToRoute.ts @@ -144,6 +144,24 @@ const createDashboardRoute = ({ }); }; +const createReasoningRoute = ({ + messageId, + chatId +}: { + messageId: string; + chatId: string | undefined; +}) => { + if (!chatId) { + return undefined; + } + + return createBusterRoute({ + route: BusterRoutes.APP_CHAT_ID_REASONING_ID, + chatId, + messageId + }); +}; + export const assetParamsToRoute = ({ chatId, assetId, @@ -169,6 +187,13 @@ export const assetParamsToRoute = ({ }); } + if (type === 'reasoning') { + return createReasoningRoute({ + messageId: assetId, + chatId + }); + } + console.warn('Asset params to route has not been implemented for this file type', type); return ''; };