diff --git a/.env b/.env index d58fd21..87e0f0b 100644 --- a/.env +++ b/.env @@ -2,7 +2,7 @@ VITE_SUPABASE_URL=https://nvatjthzedykhikmttot.supabase.co VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im52YXRqdGh6ZWR5a2hpa210dG90Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MzM1OTYxOTMsImV4cCI6MjA0OTE3MjE5M30.u4euR8U-XxxvOdLFmWJD2yrd4E_MPMt_X1yqRrDTF2I # N8N Configuration -VITE_N8N_WEBHOOK_URL=https://harivansh.app.n8n.cloud/webhook-test/chat-webhook +VITE_N8N_WEBHOOK_URL=https://harivansh.app.n8n.cloud/webhook/chat-webhook VITE_N8N_UPLOAD_WEBHOOK_URL=https://harivansh.app.n8n.cloud/webhook/upload-webhook # Google Drive Configuration diff --git a/src/components/chat/Message.tsx b/src/components/chat/Message.tsx index 120a3a4..58c5eee 100644 --- a/src/components/chat/Message.tsx +++ b/src/components/chat/Message.tsx @@ -37,12 +37,27 @@ function extractCitations(content: string): { cleanContent: string; citations: C return { cleanContent, citations }; } +function extractUsedTool(content: string): { cleanContent: string; usedTools: string[] } { + const usedToolRegex = /^\*\*Used Tool(?:s)?: ([^*]+)\*\*\n\n/; + const match = content.match(usedToolRegex); + + if (match) { + const usedToolsString = match[1]; + const usedTools = usedToolsString.split(',').map(tool => tool.trim()); + const cleanContent = content.replace(usedToolRegex, ''); + return { cleanContent, usedTools }; + } + + return { cleanContent: content, usedTools: [] }; +} + export function Message({ message }: MessageProps) { const [copied, setCopied] = React.useState(false); const [messageCopied, setMessageCopied] = React.useState(false); const [isLiked, setIsLiked] = React.useState(false); const [isDisliked, setIsDisliked] = React.useState(false); const { cleanContent, citations } = extractCitations(message.content); + const { cleanContent: finalContent, usedTools } = extractUsedTool(cleanContent); const handleCopy = async (text: string) => { await navigator.clipboard.writeText(text); @@ -175,7 +190,7 @@ export function Message({ message }: MessageProps) { )} components={components} > - {cleanContent} + {finalContent} {message.role === 'assistant' && citations.length > 0 && ( @@ -197,6 +212,26 @@ export function Message({ message }: MessageProps) { )} + + {message.role === 'assistant' && usedTools.length > 0 && ( + <> + +
+
+ + Used Tools +
+ {usedTools.map((tool, index) => ( +
+ + + {tool} + +
+ ))} +
+ + )}