This guide helps you understand what's happening when you send a message and why responses might not appear.
When you type a message and hit Send, you should see these logs in order:
📤 [ChatPanel] Sending user message: "your message here"
📊 [ChatPanel] Messages updated, total count: 2
1. [assistant] Hello! I'm Hexa ⟡ — your AI coding companion...
2. [user] your message here...
✅ If you see this: User message is being added correctly
❌ If you don't: Check if the form is submitting (maybe preventDefault failed)
Immediately after, you should see:
⏳ [ChatPanel] Waiting for AI response...
💬 [AI API] Generating response with provider: mock (or transformers)
📝 [AI API] User message: "your message here"
✅ If you see this: Message is being sent to AI provider
❌ If you don't: Check if isLoading is preventing submission
Depending on your provider, you'll see:
For Mock Mode:
🎭 [AI API] Routing to Mock API...
✅ [AI API] Mock response received
For Transformers.js:
🤖 [AI API] Routing to Transformers.js...
🔮 Generating python code for: "your message"
⏳ Calling model (this may take 5-10 seconds)...
📝 Raw model output: {...}
✅ [AI API] Transformers.js response received
✅ If you see this: AI is processing your request
❌ If you don't: AI call might have failed silently
After AI processing, you should see:
📥 [ChatPanel] Received AI response: {
id: "msg-1234567890",
content: "Here's a python solution ⟡",
hasCode: true,
language: "python",
codeLength: 145
}
✅ If you see this: Response was generated successfully
❌ If you don't: Check the previous step for errors
This is CRITICAL - the response must be added to React state:
💬 [ChatPanel] Adding AI message to state, current count: 2
💬 [ChatPanel] New message count: 3
✅ If you see this: Message is being added to state
❌ If you don't: React state update might have failed
When state updates, messages should re-render:
📊 [ChatPanel] Messages updated, total count: 3
1. [assistant] Hello! I'm Hexa ⟡...
2. [user] your message here...
3. [assistant] Here's a python solution ⟡...
✅ If you see this: Messages array has the new message
❌ If you don't: React isn't triggering re-render
If the response has code:
📝 [ChatPanel] Updating code editor with: python
✅ If you see this: Code editor should update
❌ If you don't: No code in response, or update failed
Finally:
✅ [ChatPanel] Request completed, loading=false
✅ If you see this: Everything completed successfully
Console shows:
📥 [ChatPanel] Received AI response: {...}
💬 [ChatPanel] Adding AI message to state, current count: 2
💬 [ChatPanel] New message count: 3
✅ [ChatPanel] Request completed
BUT: No new message in chat UI
Possible causes:
- React not re-rendering
- Solution: Check React DevTools, force refresh
- Message ID conflict
- Solution: Check if
message.idis unique
- Solution: Check if
- CSS hiding message
- Solution: Inspect element, check if it's in DOM
How to verify:
- Open React DevTools
- Find ChatPanel component
- Check
messagesstate - should have 3 items - If state is correct but UI isn't showing it → React rendering issue
Console shows:
⏳ Calling model (this may take 5-10 seconds)...
(nothing else for minutes)
Possible causes:
- Model is actually processing (wait longer)
- Model crashed silently
- Browser ran out of memory
Solution:
- Wait up to 30 seconds
- If nothing, check browser memory usage
- Try with a shorter prompt
- Switch back to Mock mode
Possible causes:
- Console tab not open
- Logs being filtered
- JavaScript disabled
- Dev server not running
Solution:
- Press F12, click Console tab
- Clear all filters
- Refresh page
- Check
npm run devis running
Open console and paste:
// Find the ChatPanel component in React DevTools
// Then in console:
$r.state // or props, depending on component structure// In console, while on the page:
window.location.reload()Add this temporarily to ChatPanel.tsx:
useEffect(() => {
console.log('=== MESSAGES ARRAY ===', JSON.stringify(messages, null, 2))
}, [messages])Here's what a SUCCESSFUL message should look like from start to finish:
📤 [ChatPanel] Sending user message: "fibonacci"
📊 [ChatPanel] Messages updated, total count: 2
1. [assistant] Hello! I'm Hexa ⟡...
2. [user] fibonacci...
⏳ [ChatPanel] Waiting for AI response...
💬 [AI API] Generating response with provider: mock
📝 [AI API] User message: "fibonacci"
🎭 [AI API] Routing to Mock API...
✅ [AI API] Mock response received
📥 [ChatPanel] Received AI response: {
id: "msg-1730345678901",
content: "Great choice ⟡ Here's an efficient O(n)...",
hasCode: true,
language: "typescript",
codeLength: 245
}
💬 [ChatPanel] Adding AI message to state, current count: 2
💬 [ChatPanel] New message count: 3
📊 [ChatPanel] Messages updated, total count: 3
1. [assistant] Hello! I'm Hexa ⟡...
2. [user] fibonacci...
3. [assistant] Great choice ⟡ Here's an efficient O(n)...
📝 [ChatPanel] Updating code editor with: typescript
✅ [ChatPanel] Request completed, loading=false
If you see all these logs but still no message → React rendering issue
If logs stop partway through → Check where they stopped for the issue
Ctrl+Shift+R (Windows/Linux)
Cmd+Shift+R (Mac)
F12 → Network tab → Disable cache (checkbox)
Refresh page
⌘+K → Click "Mock" → Try again
Look at bottom-right status indicator
Should say: "🎭 Mock Mode" or "🤖 AI Ready"
If you're still having problems, include:
- Full console log (copy/paste)
- Which provider you're using
- Your exact message
- Screenshot of UI
- Browser and version