diff --git a/src/components/AIQueryInterface.astro b/src/components/AIQueryInterface.astro index 076b322..38a5547 100644 --- a/src/components/AIQueryInterface.astro +++ b/src/components/AIQueryInterface.astro @@ -672,6 +672,15 @@ class AIQueryInterface { } displayResults(recommendation, originalQuery) { + console.log('[AI DEBUG] Full recommendation object:', recommendation); + console.log('[AI DEBUG] Recommended tools:', recommendation.recommended_tools); + + if (recommendation.recommended_tools) { + recommendation.recommended_tools.forEach((tool, index) => { + console.log(`[AI DEBUG] Tool ${index}:`, tool.name, 'Confidence:', tool.confidence); + }); + } + if (this.currentMode === 'workflow') { this.displayWorkflowResults(recommendation, originalQuery); } else { @@ -693,16 +702,24 @@ class AIQueryInterface { toolsByPhase[phase] = []; }); + // DEBUG: Log recommendation structure + console.log('[AI Results] Recommendation structure:', recommendation); + console.log('[AI Results] Recommended tools:', recommendation.recommended_tools); + recommendation.recommended_tools?.forEach(recTool => { + // DEBUG: Log each tool's confidence data + console.log('[AI Results] Tool confidence data:', recTool.name, recTool.confidence); + if (toolsByPhase[recTool.phase]) { const fullTool = tools.find(t => t.name === recTool.name); if (fullTool) { toolsByPhase[recTool.phase].push({ ...fullTool, recommendation: recTool, - confidence: recTool.confidence, + confidence: recTool.confidence, // Ensure confidence is passed justification: recTool.justification, - priority: recTool.priority + priority: recTool.priority, + recommendationStrength: recTool.recommendationStrength }); } } @@ -737,6 +754,106 @@ class AIQueryInterface { this.elements.results.innerHTML = html; } + renderConfidenceTooltip(confidence) { + if (!confidence || typeof confidence.overall !== 'number') { + console.log('[AI DEBUG] No confidence data or invalid format:', confidence); + return ''; + } + + const confidenceColor = confidence.overall >= 80 ? 'var(--color-accent)' : + confidence.overall >= 60 ? 'var(--color-warning)' : 'var(--color-error)'; + + const tooltipId = `tooltip-${Math.random().toString(36).substr(2, 9)}`; + + console.log(`[AI DEBUG] Generating confidence tooltip: ${confidence.overall}% with ID ${tooltipId}`); + + return ` + + + ${confidence.overall}% + + + + `; + } + renderAuditTrail(auditTrail) { if (!auditTrail || !Array.isArray(auditTrail) || auditTrail.length === 0) { return ''; @@ -1003,74 +1120,6 @@ class AIQueryInterface { return String(data); } - renderConfidenceIndicator(confidence) { - if (!confidence || typeof confidence.overall !== 'number') return ''; - - const confidenceColor = confidence.overall >= 80 ? 'var(--color-accent)' : - confidence.overall >= 60 ? 'var(--color-warning)' : 'var(--color-error)'; - - const strengthText = confidence.overall >= 80 ? 'HOCH' : - confidence.overall >= 60 ? 'MITTEL' : 'NIEDRIG'; - - return ` -