Skip to content

Devang76/Enhanced_AI-Powered_Chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Enhanced_AI-Powered_Chatbot

This enhanced version of the AI chatbot includes several improvements:

  1. Persistent Chat History: The chat messages are stored in the browser's local storage, allowing the conversation to persist across page reloads.
  2. Loading State: A loading spinner is displayed while waiting for the AI's response.
  3. Error Handling: If an error occurs during the chat process, an error message is displayed to the user.
  4. Improved Styling: The chat interface is more spacious and easier to read.
  5. Server-Side Integration: The API route uses OpenAI's GPT-3.5-turbo model to generate responses, leveraging the Vercel AI SDK for efficient streaming of responses.

To use this enhanced chatbot, you'll need to:

  1. Install the necessary dependencies:
npm install ai openai-edge
  1. Set up your OpenAI API key as an environment variable (OPENAI_API_KEY) in your Vercel project settings or in a .env.local file for local development.
  2. Ensure you have the UI components from a component library like shadcn/ui or create your own versions of Button, Card, Input, and ScrollArea.

This implementation provides a more robust and user-friendly AI chatbot experience, with real-time streaming responses, persistent chat history, and proper error handling. The server-side implementation uses OpenAI's GPT model, but you can easily swap this out for another AI model of your choice.

Remember to handle rate limiting, implement user authentication if needed, and consider adding features like chat history management or the ability to clear the chat for a production-ready application.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published