diff --git a/src/components/ChatMessageItem.tsx b/src/components/ChatMessageItem.tsx index e259442..436b672 100644 --- a/src/components/ChatMessageItem.tsx +++ b/src/components/ChatMessageItem.tsx @@ -45,6 +45,30 @@ function formatLocalTime(utcString: string): string { return utcDate.toLocaleString(); } +function linkifyText(text: string): React.ReactNode { + // URL regex pattern to match http/https URLs + const urlRegex = /(https?:\/\/[^\s]+)/g; + + const parts = text.split(urlRegex); + + return parts.map((part, index) => { + if (urlRegex.test(part)) { + return ( + + {part} + + ); + } + return part; + }); +} + function ChatMessageItem({ msg, showErrorRow }: { msg: ChatMessage, showErrorRow?: boolean }) { const { config } = useConfig(); const knownKeys = useMemo(() => [ @@ -314,7 +338,7 @@ function ChatMessageItem({ msg, showErrorRow }: { msg: ChatMessage, showErrorRow