Skip to content
This repository was archived by the owner on Nov 23, 2025. It is now read-only.

Dev#26

Merged
AdithaBuwaneka merged 7 commits into
mainfrom
dev
Nov 12, 2025
Merged

Dev#26
AdithaBuwaneka merged 7 commits into
mainfrom
dev

Conversation

@AdithaBuwaneka

@AdithaBuwaneka AdithaBuwaneka commented Nov 12, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Chat widget now requires authentication; input and send button are disabled when unauthenticated.
    • Tool usage information is now displayed in AI responses.
    • Enhanced chat interface with new header, redesigned message bubbles, and improved "Thinking" indicator.
  • Bug Fixes

    • Improved error handling with distinct session-expired and connectivity error messages.
  • Style

    • Adjusted chat widget sizing for optimized display.

@vercel

vercel Bot commented Nov 12, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
techtorque Ready Ready Preview Comment Nov 12, 2025 10:23am

@coderabbitai

coderabbitai Bot commented Nov 12, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

A new API route proxies POST requests to an Agent_Bot service with authorization support. AIChatWidget.tsx receives a comprehensive overhaul introducing cookie-based authentication, user sender type support, theme constants, redesigned message bubbles, and a "Thinking" indicator. The chat widget container sizing is adjusted to explicit pixel dimensions. lucide-react dependency is added.

Changes

Cohort / File(s) Change Summary
Dependencies
package.json
Added lucide-react ^0.553.0 dependency
API Route
src/app/api/v1/ai/chat/route.ts
New POST endpoint that proxies requests to Agent_Bot service with authorization header support; includes error handling returning 500 status on failure
Chat Component
src/app/components/chatbot/AIChatWidget.tsx
Major UI/UX overhaul: introduced cookie-based token authentication, expanded Message interface to support 'user' sender, added tool_executed field to ChatResponse, replaced hardcoded endpoint with localhost, enhanced error messaging for 401 responses, added theme constants, redesigned message bubbles, added "Thinking" indicator with Sparkles icon, added login warning area, and implemented auto-scroll to latest messages
Dashboard Component
src/app/components/dashboards/CustomerDashboard.tsx
Adjusted chat widget container size from Tailwind classes (w-96 h-[32rem]) to explicit pixel dimensions (w-[480px] h-[600px])

Sequence Diagram

sequenceDiagram
    participant User
    participant Browser as Browser<br/>(AIChatWidget)
    participant API as Next.js API<br/>(route.ts)
    participant Agent as Agent_Bot<br/>Service
    
    User->>Browser: Loads page
    Browser->>Browser: Retrieve tt_access_token from cookies
    alt Token Present
        Browser->>Browser: Enable input & send button
    else No Token
        Browser->>Browser: Disable input, show login warning
    end
    
    User->>Browser: Sends message
    Browser->>Browser: Add user message to conversation
    Browser->>Browser: Display "Thinking..." indicator
    
    Browser->>API: POST /api/v1/ai/chat<br/>(with Authorization header + token)
    API->>Agent: Forward request to AGENT_BOT_URL
    
    alt Success (200)
        Agent-->>API: Response with reply & tool_executed
        API-->>Browser: Return JSON response
        Browser->>Browser: Display AI message<br/>+ optional tool usage note
        Browser->>Browser: Auto-scroll to latest
    else Unauthorized (401)
        Agent-->>API: 401 response
        API-->>Browser: Return error
        Browser->>Browser: Display session-expired message
    else Error (4xx/5xx)
        Agent-->>API: Error response
        API-->>Browser: Return 500 with detail
        Browser->>Browser: Display connectivity issue
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Extra attention areas:
    • Authentication flow change from useAuth to cookie-based tokens in AIChatWidget.tsx; verify token handling and session validation logic
    • Message interface expansion and tool_executed field integration; confirm backward compatibility
    • Error handling for 401 vs other errors; validate error message display behavior
    • New API route's proxy logic and Authorization header forwarding; review AGENT_BOT_URL environment variable handling

Possibly related PRs

  • Main #9: Modifies AIChatWidget.tsx authentication mechanism and sendMessage flow, switching from useAuth to cookie-based token handling

Poem

🐰 A chat widget hops with cookies in hand,
Tokens dancing through requests so grand,
With sparkling thoughts and bubbles so bright,
The Agent Bot service handles the flight—
From threshold to reply, the flow's rearranged,
Authentication's new, yet messages exchanged!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f0acdeb and 3170b1f.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • package.json (1 hunks)
  • src/app/api/v1/ai/chat/route.ts (1 hunks)
  • src/app/components/chatbot/AIChatWidget.tsx (2 hunks)
  • src/app/components/dashboards/CustomerDashboard.tsx (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@AdithaBuwaneka
AdithaBuwaneka merged commit 12fc83b into main Nov 12, 2025
9 of 10 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Nov 23, 2025
Merged
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants