fix: address code review issues

- Remove verbose debug console.logs (kept only token usage log)
- Add basic input validation for messages array
- Fix XML comparison using formatXML for consistency
- Extract CACHED_TOOL_PREFIX constant to avoid magic string
- Fix addToolResult API to use correct tool/output params
This commit is contained in:
dayuan.jiang
2025-12-02 19:20:06 +09:00
parent a20d14ef9d
commit 43021bafa2
4 changed files with 24 additions and 60 deletions

View File

@@ -44,7 +44,6 @@ export function DiagramProvider({ children }: { children: React.ReactNode }) {
const getLastAgentGeneratedXml = () => lastAgentGeneratedXmlRef.current;
const markAgentDiagramPending = () => {
console.log('[DiagramContext] markAgentDiagramPending called');
agentDiagramPendingRef.current = true;
};
@@ -80,7 +79,6 @@ export function DiagramProvider({ children }: { children: React.ReactNode }) {
// This ensures we compare apples-to-apples (both formatted the same way)
if (agentDiagramPendingRef.current) {
const formatted = formatXML(extractedXML);
console.log('[DiagramContext] Setting lastAgentGeneratedXml from export, length:', formatted.length);
setLastAgentGeneratedXml(formatted);
agentDiagramPendingRef.current = false;
}