mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-02 14:22:28 +08:00
- Changed sendAutomaticallyWhen to only auto-resubmit on tool errors - Extracted logic to shouldAutoResubmit() function with JSDoc - Added TypeScript interfaces for type safety (MessagePart, ChatMessage) - Wrapped debug logs with DEBUG flag for production readiness - Added TOOL_ERROR_STATE constant to avoid hardcoded strings Problem: AI was regenerating diagrams 3+ times even after successful display Root cause: lastAssistantMessageIsCompleteWithToolCalls auto-resubmits on both success AND error Solution: Custom logic that only auto-resubmits on errors, stops on success