Back to course

Your First Web-Based Chatbot UI

Generative AI for Web & Mobile Apps

Building the Chatbot UI

A good chatbot needs a clean interface. We'll build a basic message-based UI using HTML/CSS or React.

Components needed:

  • Message List: Displays history.
  • Input Field: Where user types.
  • Send Button: Triggers the API call.

Basic HTML/JS Logic:

javascript async function sendMessage() { const input = document.getElementById('chat-input').value; // Call your API here... // Update UI with response }

Focus on accessibility and clear distinctions between User and AI messages.