// Review Inline: renders AI review suggestions inline in a diff view const ReviewInline = { suggestions: [], init(diffContainerId, suggestionsContainerId) { this.diffContainer = document.getElementById(diffContainerId); this.suggestionsContainer = document.getElementById(suggestionsContainerId); this.suggestions = []; }, // Add a suggestion to the collection addSuggestion(suggestion) { this.suggestions.push(suggestion); }, // Render all collected suggestions inline in the diff renderInline() { if (!this.diffContainer) return; this.suggestions.forEach((s, index) => { DiffViewer.insertSuggestion( s.file, s.line, s.side || 'right', s.severity || 'info', s.content || '', `suggestion-${index}` ); }); }, // Render a single suggestion card (for the card-based view) renderSuggestionCard(suggestion) { const severityStyles = { critical: { border: 'border-l-4 border-red-500', bg: 'bg-red-50', badge: 'bg-red-100 text-red-800', icon: '🔴', label: '严重', }, warning: { border: 'border-l-4 border-yellow-500', bg: 'bg-yellow-50', badge: 'bg-yellow-100 text-yellow-800', icon: '🟡', label: '建议', }, info: { border: 'border-l-4 border-green-500', bg: 'bg-green-50', badge: 'bg-green-100 text-green-800', icon: '🟢', label: '提示', }, }; const style = severityStyles[suggestion.severity] || severityStyles.info; return `
${this._escapeHtml(suggestion.code_example)}
` : ''}
${fileReview.summary}
` : ''}