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.

feat(replay-vision): collapse the prompt on the observation page (#91178)

Kim Svatos Dugane18f91af1c08
diff --git a/products/replay_vision/frontend/observations/ReplayObservation.tsx b/products/replay_vision/frontend/observations/ReplayObservation.tsx
index 8a9bf817dc1d..3cb7d4fde4e9 100644
--- a/products/replay_vision/frontend/observations/ReplayObservation.tsx
+++ b/products/replay_vision/frontend/observations/ReplayObservation.tsx
@@ -5,6 +5,7 @@ import { useEffect, useRef, useState } from 'react'
import {
IconArrowLeft,
IconArrowRight,
+ IconChevronRight,
IconClock,
IconCollapse,
IconExpand,
@@ -22,6 +23,7 @@ import { dayjs } from 'lib/dayjs'
import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'
+import { cn } from 'lib/utils/css-classes'
import { humanFriendlyDuration, humanFriendlyMilliseconds } from 'lib/utils/durations'
import { SceneExport } from 'scenes/sceneTypes'
import { SessionRecordingPlayer } from 'scenes/session-recordings/player/SessionRecordingPlayer'
@@ -102,6 +104,34 @@ function AutoSeekToTime({
return null
}
+// A reader opens an observation for the result, not the prompt they configured. Collapse the prompt to one
+// peek line so the verdict and reasoning stay above the fold.
+function PromptRow({ prompt }: { prompt: string }): JSX.Element {
+ const [expanded, setExpanded] = useState(false)
+ return (
+ <div>
+ <button
+ type="button"
+ className="flex items-center gap-0.5 text-xs text-muted mb-0.5 hover:text-default"
+ onClick={() => setExpanded(!expanded)}
+ aria-expanded={expanded}
+ data-attr="vision-observation-prompt-toggle"
+ >
+ <IconChevronRight className={cn('transition-transform', expanded && 'rotate-90')} />
+ Prompt
+ </button>
+ <p
+ className={cn(
+ 'text-sm m-0 leading-snug',
+ expanded ? 'text-default whitespace-pre-wrap' : 'text-muted line-clamp-1'
+ )}
+ >
+ {prompt}
+ </p>
+ </div>
+ )
+}
+
export function ReplayObservationSceneComponent(): JSX.Element {
const { observationId } = useValues(replayObservationSceneLogic)
const { searchParams } = useValues(router)
@@ -384,11 +414,6 @@ export function ReplayObservationSceneComponent(): JSX.Element {
<ScannerTypeBadge scannerType={scannerType} />
</LabeledRow>
)}
- {prompt && scannerType !== 'summarizer' && (
- <LabeledRow label="Prompt">
- <p className="text-sm text-default m-0 leading-snug">{prompt}</p>
- </LabeledRow>
- )}
<LabeledRow label={scannerType ? SUCCEEDED_OUTPUT_LABEL[scannerType] : ''}>
<ObservationPrimaryOutput
observation={observation}
@@ -397,6 +422,7 @@ export function ReplayObservationSceneComponent(): JSX.Element {
copyable
/>
</LabeledRow>
+ {prompt && scannerType !== 'summarizer' && <PromptRow prompt={prompt} />}
{observation.completed_at && (
<LabeledRow label="Event">
<Link to={urls.event(observation.id, observation.completed_at)}>