From 276273c5ed5c748736c1ceeb48611609b24e6fac Mon Sep 17 00:00:00 2001 From: bran18 Date: Mon, 24 Feb 2025 13:34:22 -0600 Subject: [PATCH 1/3] feat: improve clickable text with sentence content --- .../routes/chat/chat-clickable-text.tsx | 38 ++++++++++++------- apps/masterbots.ai/lib/clickable-results.ts | 25 ++++++------ apps/masterbots.ai/lib/utils.ts | 5 --- apps/masterbots.ai/types/types.ts | 6 +++ 4 files changed, 44 insertions(+), 30 deletions(-) diff --git a/apps/masterbots.ai/components/routes/chat/chat-clickable-text.tsx b/apps/masterbots.ai/components/routes/chat/chat-clickable-text.tsx index fe990e02..395c2d97 100644 --- a/apps/masterbots.ai/components/routes/chat/chat-clickable-text.tsx +++ b/apps/masterbots.ai/components/routes/chat/chat-clickable-text.tsx @@ -23,11 +23,12 @@ export function ClickableText({ ? extractTextFromReactNodeWeb(children) : extractTextFromReactNodeNormal(children) - const createClickHandler = (text: string) => () => { + const createClickHandler = (text: string, fullContext: string) => () => { if (sendMessageFromResponse && text.trim()) { const cleanedText = cleanClickableText(text) + const contextToUse = fullContext || cleanedText sendMessageFromResponse( - `Explain more in-depth and in detail about ${cleanedText}` + `Explain more in-depth and in detail about ${contextToUse}` ) } } @@ -85,14 +86,18 @@ export function ClickableText({ return linkElement } - const renderClickableContent = (clickableText: string, restText: string) => ( + const renderClickableContent = ( + clickableText: string, + restText: string, + fullContext: string + ) => (