diff --git a/apps/extension/src/SideBar.tsx b/apps/extension/src/SideBar.tsx index babe0bc1..96b1dd4c 100644 --- a/apps/extension/src/SideBar.tsx +++ b/apps/extension/src/SideBar.tsx @@ -79,6 +79,9 @@ function SideBar({ jwt }: { jwt: string }) { // Process each part to extract JSON objects parts.forEach((part, index) => { + if (part.startsWith('data: [DONE]data: ')) { + part = part.replace('data: [DONE]data: ', 'data: '); + } try { const parsedPart = JSON.parse(part.replace('data: ', '')); // Try to parse the part as JSON diff --git a/apps/web/src/components/ChatMessage.tsx b/apps/web/src/components/ChatMessage.tsx index 8647e8d7..13a391b7 100644 --- a/apps/web/src/components/ChatMessage.tsx +++ b/apps/web/src/components/ChatMessage.tsx @@ -1,8 +1,9 @@ -import React, { useEffect } from "react"; -import { motion } from "framer-motion"; -import { ArrowUpRight, Globe } from "lucide-react"; -import { convertRemToPixels } from "@/lib/utils"; -import { SpaceIcon } from "@/assets/Memories"; +import React, { useEffect } from 'react'; +import { motion } from 'framer-motion'; +import { ArrowUpRight, Globe } from 'lucide-react'; +import { convertRemToPixels } from '@/lib/utils'; +import { SpaceIcon } from '@/assets/Memories'; +import Markdown from 'react-markdown'; export function ChatAnswer({ children: message, @@ -18,7 +19,9 @@ export function ChatAnswer({ {loading ? ( ) : ( -
{message}
+
+ {message} +
)} {!loading && sources && sources?.length > 0 && ( <> @@ -47,7 +50,7 @@ export function ChatAnswer({ export function ChatQuestion({ children }: { children: string }) { return (
200 ? "text-xl" : "text-2xl"}`} + className={`text-rgray-12 w-full text-left ${children.length > 200 ? 'text-xl' : 'text-2xl'}`} > {children}
@@ -68,13 +71,13 @@ export function ChatMessage({ useEffect(() => { if (!isLast) return; console.log( - "last", + 'last', messageRef.current?.offsetTop, messageRef.current?.parentElement, ); messageRef.current?.parentElement?.scrollTo({ top: messageRef.current?.offsetTop, - behavior: "smooth", + behavior: 'smooth', }); }, []); @@ -83,11 +86,11 @@ export function ChatMessage({ initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ - type: "tween", + type: 'tween', duration: 0.5, }} ref={messageRef} - className={`${index === 0 ? "pt-16" : "pt-28"} flex w-full flex-col items-start justify-start gap-5 transition-[height] ${isLast ? "min-h-screen" : "h-auto"}`} + className={`${index === 0 ? 'pt-16' : 'pt-28'} flex w-full flex-col items-start justify-start gap-5 transition-[height] ${isLast ? 'min-h-screen' : 'h-auto'}`} > {children}