import { useEffect, useRef, useState } from 'react'; import { Bot, Send, Sparkles } from 'lucide-react'; import { motion } from 'framer-motion'; import { askQuestion } from '../../api/client'; import { useRepoStore } from '../../store/useRepoStore'; import MessageBubble from './MessageBubble'; import SuggestedQuestions from './SuggestedQuestions'; import TypingIndicator from './TypingIndicator'; export default function ChatInterface() { const [input, setInput] = useState(''); const endRef = useRef(null); const { repoId, chatHistory, addChatMessage, isAsking, setAsking } = useRepoStore(); useEffect(() => { endRef.current?.scrollIntoView({ behavior: 'smooth' }); }, [chatHistory, isAsking]); const handleSend = async (question = input) => { const trimmed = question.trim(); if (!trimmed || !repoId || isAsking) return; const historyBeforeSend = chatHistory; setInput(''); addChatMessage({ role: 'user', content: trimmed }); setAsking(true); try { const response = await askQuestion(repoId, trimmed, historyBeforeSend); addChatMessage({ role: 'assistant', content: response.data.answer, details: response.data }); } catch (error) { addChatMessage({ role: 'assistant', content: error?.response?.data?.detail || 'IBM Bob could not complete that analysis. Please try another question.', error: true, }); } finally { setAsking(false); } }; return (

Engineering Assistant

Repository-aware IBM Bob analysis

Active
{chatHistory.length === 0 && (

Ask about architecture, risks, APIs, or onboarding

Answers are grounded in the scanned repository context.

)} {chatHistory.map((message, index) => ( ))} {isAsking && }