11import React , { useState } from "react" ;
22import clsx from "clsx" ;
33import { ToolCall } from "src/contexts/MessagesContext" ;
4+ import IconChevronDown from "src/assets/SvgIcons/IconChevronDown" ;
5+ import IconCaretUp from "src/assets/SvgIcons/IconCaretUp" ;
6+ import IconExternalLink from "src/assets/SvgIcons/IconExternalLink" ;
47
58interface ToolCallsProps {
69 toolCalls : ToolCall [ ] ;
@@ -35,7 +38,7 @@ const extractArgumentSummary = (inputs: Record<string, any>): string | null => {
3538} ;
3639
3740const ToolCallCard : React . FC < { toolCall : ToolCall } > = ( { toolCall } ) => {
38- const { title, inputs, return_value, is_running, icon } = toolCall ;
41+ const { title, inputs, return_value, is_running, icon, url } = toolCall ;
3942 const [ isExpanded , setIsExpanded ] = useState ( false ) ;
4043
4144 const argumentSummary = extractArgumentSummary ( inputs || { } ) ;
@@ -59,26 +62,28 @@ const ToolCallCard: React.FC<{ toolCall: ToolCall }> = ({ toolCall }) => {
5962 style = { {
6063 backgroundColor : "transparent" ,
6164 display : "flex" ,
62- alignItems : "center " ,
65+ alignItems : "baseline " ,
6366 gap : "6px" ,
6467 listStyle : "none" ,
6568 } }
6669 >
67- { icon && (
70+ { icon ? (
6871 icon . startsWith ( 'http' ) || icon . startsWith ( '/' ) ? (
6972 < img
7073 src = { icon }
7174 alt = ""
7275 style = { {
73- width : "16px " ,
74- height : "16px " ,
76+ width : "14px " ,
77+ height : "14px " ,
7578 objectFit : "contain" ,
7679 flexShrink : 0 ,
7780 } }
7881 />
7982 ) : (
80- < span style = { { fontSize : "16px " , flexShrink : 0 } } > { icon } </ span >
83+ < span style = { { fontSize : "12px " , flexShrink : 0 } } > { icon } </ span >
8184 )
85+ ) : (
86+ < span style = { { fontSize : "12px" , flexShrink : 0 } } > 🛠️</ span >
8287 ) }
8388 < div
8489 style = { {
@@ -89,15 +94,15 @@ const ToolCallCard: React.FC<{ toolCall: ToolCall }> = ({ toolCall }) => {
8994 flex : 1 ,
9095 } }
9196 >
92- < span className = "font_14_600 " > { title } </ span >
97+ < span className = "font_12_600 " > { title } </ span >
9398 { argumentSummary && (
9499 < >
95- < span className = "font_14_600 " > - </ span >
96- < span className = "font_14_400 text-muted" > { argumentSummary } </ span >
100+ < span className = "font_12_600 " > - </ span >
101+ < span className = "font_12_400 text-muted" > { argumentSummary } </ span >
97102 </ >
98103 ) }
99104 { is_running && (
100- < span className = "font_12_400 text-muted" > Running...</ span >
105+ < span className = "font_11_400 text-muted" > Running...</ span >
101106 ) }
102107 </ div >
103108 < div
@@ -114,25 +119,63 @@ const ToolCallCard: React.FC<{ toolCall: ToolCall }> = ({ toolCall }) => {
114119 />
115120 < div
116121 style = { {
117- fontSize : "10px" ,
118122 color : "#6c757d" ,
119123 flexShrink : 0 ,
120- transform : isExpanded ? "rotate(180deg)" : "rotate(0deg) ",
121- transition : "transform 0.2s ease " ,
124+ display : "flex ",
125+ alignItems : "center " ,
122126 } }
123127 >
124- ▼
128+ { isExpanded ? (
129+ < IconCaretUp size = { 10 } />
130+ ) : (
131+ < IconChevronDown size = { 10 } />
132+ ) }
125133 </ div >
126134 </ summary >
127135
128136 < div style = { { padding : "8px 0" } } >
129137 { inputs && Object . keys ( inputs ) . length > 0 && (
130138 < div className = "mb-3" >
131- < div className = "font_14_600 text-dark mb-2" > Inputs</ div >
132139 < div
133- className = "font_12_400"
140+ style = { {
141+ display : "flex" ,
142+ justifyContent : "space-between" ,
143+ alignItems : "center" ,
144+ marginBottom : "8px" ,
145+ width : "100%"
146+ } }
147+ >
148+ < div className = "font_12_600 text-dark" > Inputs</ div >
149+ { url && (
150+ < a
151+ href = { url }
152+ target = "_blank"
153+ rel = "noopener noreferrer"
154+ style = { {
155+ display : "flex" ,
156+ alignItems : "center" ,
157+ fontSize : "11px" ,
158+ textDecoration : "none" ,
159+ gap : "4px" ,
160+ color : "#6c757d" ,
161+ marginLeft : "auto"
162+ } }
163+ onMouseEnter = { ( e ) => {
164+ e . currentTarget . style . textDecoration = "underline" ;
165+ } }
166+ onMouseLeave = { ( e ) => {
167+ e . currentTarget . style . textDecoration = "none" ;
168+ } }
169+ >
170+ < IconExternalLink size = { 10 } />
171+ View Tool Call
172+ </ a >
173+ ) }
174+ </ div >
175+ < div
134176 style = { {
135177 fontFamily : "ui-monospace, SFMono-Regular, 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace" ,
178+ fontSize : "10px" ,
136179 backgroundColor : "#f8f9fa" ,
137180 border : "1px solid #e9ecef" ,
138181 padding : "12px" ,
@@ -150,11 +193,11 @@ const ToolCallCard: React.FC<{ toolCall: ToolCall }> = ({ toolCall }) => {
150193
151194 { ! is_running && return_value && (
152195 < div >
153- < div className = "font_14_600 text-dark mb-2" > Return value </ div >
196+ < div className = "font_12_600 text-dark mb-2" > Output </ div >
154197 < div
155- className = "font_12_400"
156198 style = { {
157199 fontFamily : "ui-monospace, SFMono-Regular, 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace" ,
200+ fontSize : "10px" ,
158201 backgroundColor : "#f8f9fa" ,
159202 border : "1px solid #e9ecef" ,
160203 padding : "12px" ,
0 commit comments