Skip to content

Commit 2d85d36

Browse files
andrewm4894claudegithub-actions[bot]
authored
fix(llma): Use HighlightedJSONViewer for span input/output display (#42573)
Co-authored-by: Claude <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 3964f30 commit 2d85d36

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed
-40.2 KB
Loading
-21.1 KB
Loading

products/llm_analytics/frontend/components/EventContentWithAsyncData.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import { HighlightedJSONViewer } from 'lib/components/HighlightedJSONViewer'
2+
import { isObject } from 'lib/utils'
3+
14
import { ConversationMessagesDisplay } from '../ConversationDisplay/ConversationMessagesDisplay'
25
import { useAIData } from '../hooks/useAIData'
36
import { normalizeMessages } from '../utils'
@@ -77,19 +80,27 @@ export function EventContentDisplayAsync({
7780
<div className="space-y-4">
7881
<div>
7982
<h3 className="font-semibold mb-2">Input</h3>
80-
<pre className="p-2 bg-surface-secondary rounded text-xs overflow-auto">
81-
{JSON.stringify(input, null, 2)}
82-
</pre>
83+
<div className="p-2 bg-surface-secondary rounded text-xs overflow-auto">
84+
{isObject(input) ? (
85+
<HighlightedJSONViewer src={input} name={null} collapsed={5} />
86+
) : (
87+
<span className="font-mono">{JSON.stringify(input ?? null)}</span>
88+
)}
89+
</div>
8390
</div>
8491
<div>
8592
<h3 className="font-semibold mb-2">Output</h3>
86-
<pre
93+
<div
8794
className={`p-2 rounded text-xs overflow-auto ${
8895
raisedError ? 'bg-danger-highlight' : 'bg-surface-secondary'
8996
}`}
9097
>
91-
{JSON.stringify(output, null, 2)}
92-
</pre>
98+
{isObject(output) ? (
99+
<HighlightedJSONViewer src={output} name={null} collapsed={5} />
100+
) : (
101+
<span className="font-mono">{JSON.stringify(output ?? null)}</span>
102+
)}
103+
</div>
93104
</div>
94105
</div>
95106
)

0 commit comments

Comments
 (0)