Skip to content

goyal02aditi/chat-app1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

36 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Ollama Chatbot Fullstack

A complete chatbot application built with Flutter frontend and Python FastAPI backend, powered by Ollama for AI conversations.

πŸ—οΈ Project Structure

ollama-chatbot-fullstack/
β”œβ”€β”€ README.md                 # This file
β”œβ”€β”€ .gitignore               # Git ignore rules
β”œβ”€β”€ frontend/                # Flutter mobile/web app
β”‚   β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ pubspec.yaml
β”‚   └── ...
└── backend/                 # Python FastAPI server
    β”œβ”€β”€ api_server.py
    β”œβ”€β”€ requirements.txt
    └── ...

πŸš€ Quick Start

Prerequisites

  • Flutter SDK (latest stable)
  • Python 3.8+
  • Ollama installed and running
  • Git

1. Clone the Repository

git clone <your-repo-url>
cd ollama-chatbot-fullstack

2. Backend Setup

cd backend

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Start the server
python api_server.py

The backend will be available at http://localhost:8000

3. Frontend Setup

cd frontend

# Install Flutter dependencies
flutter pub get

# Update API URL in lib/services/api_service.dart
# Change 'YOUR_BACKEND_URL_HERE' to 'http://localhost:8000'

# Run the app
flutter run -d chrome  # For web
# or
flutter run            # For mobile (with emulator/device connected)

πŸ”§ Configuration

Backend Configuration

  1. Ollama Model: Update the model in backend/api_server.py:

    runnable = build_chain(os.getenv("OLLAMA_MODEL", "llama3.1:8b"))
  2. Environment Variables: Create .env file in backend/ if needed:

    OLLAMA_MODEL=llama3.1:8b
    

Frontend Configuration

  1. API URL: Update lib/services/api_service.dart:

    static const String baseUrl = 'http://localhost:8000';
  2. Build for different platforms:

    flutter build web       # Web
    flutter build apk       # Android
    flutter build ios       # iOS

πŸ“± Features

  • User Authentication (registration/login)
  • Real-time Chat with Ollama AI models
  • Cross-platform (Web, iOS, Android)
  • Clean Architecture with proper separation of concerns
  • Error Handling and connection status indicators
  • Modern UI with Material Design

πŸ› οΈ Development

Backend Development

  • FastAPI with automatic docs at http://localhost:8000/docs
  • LangChain integration for AI pipeline
  • Simple in-memory authentication (replace with database in production)
  • CORS enabled for frontend development

Frontend Development

  • Flutter with Material Design 3
  • Service-based architecture
  • HTTP client for API communication
  • Responsive design for multiple screen sizes

πŸ“š API Endpoints

  • POST /auth/register - User registration
  • POST /auth/login - User login
  • POST /chat - Send message to AI
  • GET /docs - API documentation

πŸ”’ Security Notes

  • Replace in-memory user storage with proper database
  • Implement proper JWT token validation
  • Use HTTPS in production
  • Validate and sanitize all inputs

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ“„ License

[Add your license here]

πŸ™ Acknowledgments

  • Ollama for local AI model hosting
  • LangChain for AI pipeline framework
  • Flutter for cross-platform UI
  • FastAPI for backend framework

chat-app1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •