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:
Dayuan Jiang
2025-12-07 14:38:15 +09:00
committed by GitHub
parent a54068fec2
commit 0baf21fadb
5 changed files with 109 additions and 24 deletions

View File

@@ -32,7 +32,8 @@ export function HistoryDialog({
const handleConfirmRestore = () => {
if (selectedIndex !== null) {
onDisplayChart(diagramHistory[selectedIndex].xml)
// Skip validation for trusted history snapshots
onDisplayChart(diagramHistory[selectedIndex].xml, true)
handleClose()
}
}