Skip to content

Commit 78fd894

Browse files
Refactor content compatibility check and simplify test cases
Co-authored-by: me <[email protected]>
1 parent cbb3ebc commit 78fd894

File tree

3 files changed

+30
-242
lines changed

3 files changed

+30
-242
lines changed

client/src/components/ToolResults.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ const checkContentCompatibility = (
2020
}>,
2121
): { isCompatible: boolean; message: string } => {
2222
// Look for at least one text content block that matches the structured content
23-
const textBlocks = unstructuredContent.filter(block => block.type === "text");
24-
23+
const textBlocks = unstructuredContent.filter(
24+
(block) => block.type === "text",
25+
);
26+
2527
if (textBlocks.length === 0) {
2628
return {
2729
isCompatible: false,
28-
message: "No text content blocks found to match structured content",
30+
message: "No text blocks found",
2931
};
3032
}
3133

@@ -44,7 +46,7 @@ const checkContentCompatibility = (
4446
if (isEqual) {
4547
return {
4648
isCompatible: true,
47-
message: `Found matching JSON content (${textBlocks.length > 1 ? 'among multiple text blocks' : 'in single text block'})${unstructuredContent.length > textBlocks.length ? ' with additional content blocks' : ''}`,
49+
message: `Matching JSON found${textBlocks.length > 1 ? " (multiple blocks)" : ""}${unstructuredContent.length > textBlocks.length ? " + other content" : ""}`,
4850
};
4951
}
5052
} catch {
@@ -55,7 +57,7 @@ const checkContentCompatibility = (
5557

5658
return {
5759
isCompatible: false,
58-
message: "No text content block contains JSON matching structured content",
60+
message: "No matching JSON found",
5961
};
6062
};
6163

client/src/components/__tests__/ToolResults.test.tsx

Lines changed: 0 additions & 185 deletions
This file was deleted.

0 commit comments

Comments
 (0)