diff --git a/src/components/Citation.tsx b/src/components/Citation.tsx new file mode 100644 index 0000000..25cc064 --- /dev/null +++ b/src/components/Citation.tsx @@ -0,0 +1,19 @@ +const Citation = ({ + href, + children, +}: { + href: string; + children: React.ReactNode; +}) => { + return ( + + {children} + + ); +}; + +export default Citation; diff --git a/src/components/MessageBox.tsx b/src/components/MessageBox.tsx index e16f891..c5dcbb7 100644 --- a/src/components/MessageBox.tsx +++ b/src/components/MessageBox.tsx @@ -20,6 +20,7 @@ import SearchVideos from './SearchVideos'; import { useSpeech } from 'react-text-to-speech'; import ThinkBox from './ThinkBox'; import { useChat, Section } from '@/lib/hooks/useChat'; +import Citation from './Citation'; const ThinkTagProcessor = ({ children, @@ -46,7 +47,6 @@ const MessageBox = ({ }) => { const { loading, chatTurns, sendMessage, rewrite } = useChat(); - // Use the pre-processed data from section const parsedMessage = section.parsedAssistantMessage || ''; const speechMessage = section.speechMessage || ''; const thinkingEnded = section.thinkingEnded; @@ -61,6 +61,9 @@ const MessageBox = ({ thinkingEnded: thinkingEnded, }, }, + citation: { + component: Citation, + }, }, }; diff --git a/src/lib/hooks/useChat.tsx b/src/lib/hooks/useChat.tsx index 0b8b143..fc94174 100644 --- a/src/lib/hooks/useChat.tsx +++ b/src/lib/hooks/useChat.tsx @@ -446,7 +446,7 @@ export const ChatProvider = ({ const url = source?.metadata?.url; if (url) { - return `${numStr}`; + return `${numStr}`; } else { return ``; }