mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-02 14:22:28 +08:00
fix: validate XML before displaying diagram to catch duplicate IDs (#147)
- Add validation to loadDiagram in diagram-context, returns error or null - display_diagram and edit_diagram tools now check validation result - Return error to AI agent with state: output-error so it can retry - Skip validation for trusted sources (localStorage, history, internal templates) - Add debug logging for tool call inputs to diagnose Bedrock API issues
This commit is contained in:
@@ -185,7 +185,8 @@ export function ChatMessageDisplay({
|
||||
const validationError = validateMxCellStructure(replacedXML)
|
||||
if (!validationError) {
|
||||
previousXML.current = convertedXml
|
||||
onDisplayChart(replacedXML)
|
||||
// Skip validation in loadDiagram since we already validated above
|
||||
onDisplayChart(replacedXML, true)
|
||||
} else {
|
||||
console.log(
|
||||
"[ChatMessageDisplay] XML validation failed:",
|
||||
|
||||
Reference in New Issue
Block a user