Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

941 B
Raw Blame
import { useState } from 'react'

import { CitedMarkdown } from '../components/CitedMarkdown'
import { ClippedPreview } from '../replay_scanners/components/ClippedPreview'

/** The model's reasoning in full, clipped only when it runs past about 20 lines, which few scans do. */
export function ObservationReasoning({
    reasoning,
    segments,
    onSeek,
}: {
    reasoning: string
    segments: unknown
    onSeek: (timestampMs: number) => void
}): JSX.Element {
    const [expanded, setExpanded] = useState(false)
    const markdown = <CitedMarkdown text={reasoning} segments={segments} onSeek={onSeek} />
    if (expanded) {
        return markdown
    }
    return (
        <ClippedPreview
            clip="long"
            buttonLabel="Show full reasoning"
            dataAttr="vision-observation-show-reasoning"
            onOpenFull={() => setExpanded(true)}
        >
            {markdown}
        </ClippedPreview>
    )
}