@@ -22,17 +22,14 @@ const checkContentCompatibility = (
2222 text ?: string ;
2323 [ key : string ] : unknown ;
2424 } > ,
25- ) : { isCompatible : boolean ; message : string } => {
25+ ) : { hasMatch : boolean ; message : string } | null => {
2626 // Look for at least one text content block that matches the structured content
2727 const textBlocks = unstructuredContent . filter (
2828 ( block ) => block . type === "text" ,
2929 ) ;
3030
3131 if ( textBlocks . length === 0 ) {
32- return {
33- isCompatible : false ,
34- message : "No text blocks to match structured content" ,
35- } ;
32+ return null ;
3633 }
3734
3835 // Check if any text block contains JSON that matches the structured content
@@ -49,7 +46,7 @@ const checkContentCompatibility = (
4946
5047 if ( isEqual ) {
5148 return {
52- isCompatible : true ,
49+ hasMatch : true ,
5350 message : `Structured content matches text block${ textBlocks . length > 1 ? " (multiple blocks)" : "" } ${ unstructuredContent . length > textBlocks . length ? " + other content" : "" } ` ,
5451 } ;
5552 }
@@ -59,10 +56,7 @@ const checkContentCompatibility = (
5956 }
6057 }
6158
62- return {
63- isCompatible : false ,
64- message : "No text block matches structured content" ,
65- } ;
59+ return null ;
6660} ;
6761
6862const ToolResults = ( {
@@ -195,16 +189,9 @@ const ToolResults = ({
195189 < h5 className = "font-semibold mb-2 text-sm" >
196190 Unstructured Content:
197191 </ h5 >
198- { compatibilityResult && (
199- < div
200- className = { `mb-2 p-2 rounded text-sm ${
201- compatibilityResult . isCompatible
202- ? "bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200"
203- : "bg-yellow-100 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-200"
204- } `}
205- >
206- { compatibilityResult . isCompatible ? "✓" : "⚠" } { " " }
207- { compatibilityResult . message }
192+ { compatibilityResult ?. hasMatch && (
193+ < div className = "mb-2 p-2 rounded text-sm bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200" >
194+ ✓ { compatibilityResult . message }
208195 </ div >
209196 ) }
210197 </ >
0 commit comments