@@ -6,47 +6,42 @@ export default function CodeInterpreterView({
6
6
} : {
7
7
invocation : UIToolInvocation < ReturnType < typeof openai . tools . codeInterpreter > > ;
8
8
} ) {
9
- switch ( invocation . state ) {
10
- case 'output-available' :
11
- return (
12
- < div className = "mb-2 bg-gray-900 rounded-xl border border-gray-600 shadow-lg" >
13
- < div className = "px-6 py-3 bg-gray-800 rounded-t-xl border-b border-gray-700" >
14
- < div className = "overflow-hidden tracking-wide text-gray-500 whitespace-nowrap text-xxs font-small text-ellipsis" >
15
- { invocation . input . containerId }
16
- </ div >
17
- </ div >
9
+ return (
10
+ < div className = "mb-2 bg-gray-900 rounded-xl border border-gray-600 shadow-lg" >
11
+ < div className = "px-6 py-3 bg-gray-800 rounded-t-xl border-b border-gray-700" >
12
+ < div className = "overflow-hidden tracking-wide text-gray-500 whitespace-nowrap text-xxs font-small text-ellipsis" >
13
+ { invocation . input ?. containerId }
14
+ </ div >
15
+ </ div >
18
16
19
- < div className = "p-6" >
20
- < div className = "mb-3" >
21
- < div className = "mb-2 text-sm font-medium text-blue-400" >
22
- Code:
23
- </ div >
24
- < pre className = "overflow-x-auto p-4 text-sm text-gray-100 whitespace-pre-wrap bg-black rounded-lg" >
25
- { invocation . input . code }
26
- </ pre >
27
- </ div >
17
+ < div className = "p-6" >
18
+ < div className = "mb-3" >
19
+ < div className = "mb-2 text-sm font-medium text-blue-400" > Code:</ div >
20
+ < pre className = "overflow-x-auto p-4 text-sm text-gray-100 whitespace-pre-wrap bg-black rounded-lg" >
21
+ { invocation . input ?. code }
22
+ </ pre >
23
+ </ div >
28
24
29
- < div className = "mb-3" >
30
- < div className = "mb-2 text-sm font-medium text-yellow-400" >
31
- Output:
32
- </ div >
33
- < div className = "space-y-2" >
34
- { invocation . output . outputs ?. map ( ( output , index ) => (
35
- < div key = { index } className = "p-3 bg-black rounded-lg" >
36
- { output . type === 'logs' && (
37
- < div className = "font-mono text-sm text-green-300" >
38
- < span className = "whitespace-pre-wrap" >
39
- { output . logs }
40
- </ span >
41
- </ div >
42
- ) }
43
- { output . type === 'image' && < img src = { output . url } /> }
44
- </ div >
45
- ) ) }
46
- </ div >
25
+ { invocation . state === 'output-available' && (
26
+ < div className = "mb-3" >
27
+ < div className = "mb-2 text-sm font-medium text-yellow-400" >
28
+ Output:
29
+ </ div >
30
+ < div className = "space-y-2" >
31
+ { invocation . output . outputs ?. map ( ( output , index ) => (
32
+ < div key = { index } className = "p-3 bg-black rounded-lg" >
33
+ { output . type === 'logs' && (
34
+ < div className = "font-mono text-sm text-green-300" >
35
+ < span className = "whitespace-pre-wrap" > { output . logs } </ span >
36
+ </ div >
37
+ ) }
38
+ { output . type === 'image' && < img src = { output . url } /> }
39
+ </ div >
40
+ ) ) }
47
41
</ div >
48
42
</ div >
49
- </ div >
50
- ) ;
51
- }
43
+ ) }
44
+ </ div >
45
+ </ div >
46
+ ) ;
52
47
}
0 commit comments