diff --git a/components/SessionDetails.tsx b/components/SessionDetails.tsx index a7cee93..36b994a 100644 --- a/components/SessionDetails.tsx +++ b/components/SessionDetails.tsx @@ -3,6 +3,7 @@ import { ChatSession } from "../lib/types"; import LanguageDisplay from "./LanguageDisplay"; import CountryDisplay from "./CountryDisplay"; +import TranscriptViewer from "./TranscriptViewer"; interface SessionDetailsProps { session: ChatSession; @@ -19,7 +20,7 @@ export default function SessionDetails({ session }: SessionDetailsProps) {
No transcript content available.
]; + } + + // Split the transcript by lines + const lines = content.split("\n"); + + const elements: React.ReactNode[] = []; + let currentSpeaker: string | null = null; + let currentMessages: string[] = []; + + // Process each line + lines.forEach((line) => { + line = line.trim(); + if (!line) { + // Empty line, ignore + return; + } + + // Check if this is a new speaker line + if (line.startsWith("User:") || line.startsWith("Assistant:")) { + // If we have accumulated messages for a previous speaker, add them + if (currentSpeaker && currentMessages.length > 0) { + elements.push( +{msg}
+ ))} +{msg}
+ ))} +