File tree Expand file tree Collapse file tree 3 files changed +36
-6
lines changed
Expand file tree Collapse file tree 3 files changed +36
-6
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ interface ChatInterfaceProps {
88
99export const ChatInterface = ( { messages } : ChatInterfaceProps ) => {
1010 const [ chatWidth , setChatWidth ] = useState ( 600 ) ; // Default width in pixels
11- const [ chatHeight , setChatHeight ] = useState ( 512 ) ; // Default height in pixels (32rem = 512px)
11+ const [ chatHeight , setChatHeight ] = useState ( 400 ) ; // Default height in pixels
1212 const [ isResizingWidth , setIsResizingWidth ] = useState ( false ) ;
1313 const [ isResizingHeight , setIsResizingHeight ] = useState ( false ) ;
1414 const [ initialWidth , setInitialWidth ] = useState ( 0 ) ;
Original file line number Diff line number Diff line change 1+ import { useState } from "react" ;
2+
13export const MetadataSection = ( {
24 title,
35 data,
6+ defaultExpanded = false ,
47} : {
58 title : string ;
69 data : any ;
10+ defaultExpanded ?: boolean ;
711} ) => {
12+ const [ isExpanded , setIsExpanded ] = useState ( defaultExpanded ) ;
13+
814 if ( ! data || Object . keys ( data ) . length === 0 ) return null ;
915
1016 return (
1117 < div className = "mb-2" >
12- < h4 className = "font-semibold text-xs text-gray-700 mb-1" > { title } </ h4 >
13- < div className = "border border-gray-200 p-2 text-xs bg-white" >
14- < pre className = "whitespace-pre-wrap overflow-x-auto" >
15- { JSON . stringify ( data , null , 1 ) }
16- </ pre >
18+ < div
19+ className = "flex items-center justify-between cursor-pointer hover:bg-gray-50 p-1 rounded"
20+ onClick = { ( ) => setIsExpanded ( ! isExpanded ) }
21+ >
22+ < h4 className = "font-semibold text-xs text-gray-700" > { title } </ h4 >
23+ < svg
24+ className = { `h-3 w-3 text-gray-500 transition-transform duration-200 ${
25+ isExpanded ? "rotate-180" : ""
26+ } `}
27+ fill = "none"
28+ stroke = "currentColor"
29+ viewBox = "0 0 24 24"
30+ >
31+ < path
32+ strokeLinecap = "round"
33+ strokeLinejoin = "round"
34+ strokeWidth = { 2 }
35+ d = "M19 9l-7 7-7-7"
36+ />
37+ </ svg >
1738 </ div >
39+ { isExpanded && (
40+ < div className = "border border-gray-200 p-2 text-xs bg-white mt-1" >
41+ < pre className = "whitespace-pre-wrap overflow-x-auto" >
42+ { JSON . stringify ( data , null , 1 ) }
43+ </ pre >
44+ </ div >
45+ ) }
1846 </ div >
1947 ) ;
2048} ;
Original file line number Diff line number Diff line change @@ -115,12 +115,14 @@ export const Row = observer(
115115 < MetadataSection
116116 title = "Eval Metadata"
117117 data = { row . eval_metadata }
118+ defaultExpanded = { true }
118119 />
119120
120121 { /* Evaluation Result */ }
121122 < MetadataSection
122123 title = "Evaluation Result"
123124 data = { row . evaluation_result }
125+ defaultExpanded = { true }
124126 />
125127
126128 { /* Ground Truth */ }
You can’t perform that action at this time.
0 commit comments