Skip to content

Latest commit

ย 

History

74 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Wieland-AI

License Node.js React Express SQLite Status

Wieland-AI is a full-featured, locally hosted AI chat assistant powered by Ollama. Built with React, Express, and SQLite, it provides a complete solution for offline AI interactions with text and image support, user authentication, chat history, and admin dashboards.

Features โ€ข Tech Stack โ€ข Installation โ€ข Usage โ€ข Configuration โ€ข Contributing


๐ŸŽฏ Features

  • ๐Ÿ” User Authentication - Secure JWT-based authentication with bcrypt password hashing
  • ๐Ÿ’ฌ AI Chat Interface - Interactive chat with live streaming responses
  • ๐Ÿ–ผ๏ธ Image Support - Upload and process images with vision-capable models
  • ๐Ÿ“ Chat History - Persistent chat storage with automatic and manual titles
  • ๐ŸŽฏ Intent Recognition - Automatic intent detection and memory management using NLU
  • ๐ŸŒ Multilingual Support - Built-in i18n support (English, German, Italian)
  • ๐Ÿ“Š Admin Dashboard - Comprehensive dashboard for user management and analytics
  • ๐Ÿ’ณ Payment Integration - Support for payment processing and subscription management
  • ๐Ÿ—„๏ธ Data Export - Download chat history and data exports
  • ๐Ÿ“ฑ Responsive Design - Mobile-friendly interface with modern UI
  • ๐Ÿ›ก๏ธ Privacy First - Runs locally with no cloud dependencies
  • โšก Multiple AI Models - Support for multiple Ollama models

๐Ÿ—๏ธ Tech Stack

Frontend

  • React 19 - Modern UI library with hooks
  • Vite - Lightning-fast build tool
  • React Router - Client-side routing
  • i18next - Internationalization framework
  • Three.js - 3D graphics and visualizations
  • GSAP - Animation library
  • Recharts - Data visualization
  • Multer - File upload handling

Backend

  • Express.js 5.2 - Web framework
  • Node.js >= 18 - Runtime environment
  • SQLite 3 - Database with async/await support
  • JWT - Token-based authentication
  • Bcrypt - Password hashing
  • CORS - Cross-origin resource sharing

Development Tools

  • ESLint - Code quality
  • Concurrently - Run multiple processes
  • Nodemon - Auto-reload during development
  • Archiver - Data backup and export

๐Ÿ“‹ Prerequisites

  • Node.js >= 18.x
  • npm or yarn package manager
  • Ollama - Running locally (default: http://localhost:11434)
  • SQLite - Included with Node.js

โš™๏ธ Installation

1. Clone the Repository

git clone https://github.com/yourusername/wieland-ai.git
cd wieland-ai

2. Install Frontend Dependencies

npm install

3. Install Backend Dependencies

npm run server:install

4. Configure Environment Variables

Create a .env file in the root directory:

# Server Configuration
PORT=3001
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_KEEP_ALIVE=30m

# Authentication
JWT_SECRET=your_super_secret_jwt_key_change_this_in_production
JWT_EXPIRES=7d
BCRYPT_ROUNDS=12

# Database
SQLITE_PATH=./server/data/wieland.sqlite

# AI Model Configuration
INTENT_NLU_ENABLED=true
INTENT_NLU_DEBUG=false
INTENT_NLU_MODEL=qwen3-vl:2b-instruct
INTENT_NLU_TIMEOUT_MS=2800
INTENT_NLU_MAX_MESSAGE_CHARS=520
INTENT_NLU_MAX_MEMORY_ITEMS=3

# Ollama Prewarming (Optional)
OLLAMA_STARTUP_PREWARM=true
OLLAMA_PREWARM_TIMEOUT_MS=90000
OLLAMA_STARTUP_PREWARM_DELAY_MS=0
OLLAMA_STARTUP_PREWARM_MODELS=qwen3-vl:4b-instruct,qwen3-vl:2b-instruct

5. Ensure Ollama is Running

ollama serve

6. Start Development Server

npm run dev

This will start both frontend (Vite on port 5173) and backend (Express on port 3001) concurrently.


๐Ÿš€ Usage

Development

# Start both frontend and backend
npm run dev

# Start only frontend
npm run dev:frontend

# Start only backend
npm run dev:backend

# Build for production
npm build

# Preview production build
npm run preview

# Run linter
npm run lint

Production

# Start the application
npm start

# Access the app
# Frontend: http://localhost:5173
# Backend API: http://localhost:3001

๐Ÿ“ Project Structure

wieland-ai/
โ”œโ”€โ”€ src/                           # Frontend React application
โ”‚   โ”œโ”€โ”€ components/               # React components
โ”‚   โ”‚   โ”œโ”€โ”€ ChatInterface.jsx     # Main chat component
โ”‚   โ”‚   โ”œโ”€โ”€ Header.jsx            # Navigation header
โ”‚   โ”‚   โ”œโ”€โ”€ Sidebar.jsx           # Chat sidebar
โ”‚   โ”‚   โ”œโ”€โ”€ AuthModal.jsx         # Authentication modal
โ”‚   โ”‚   โ”œโ”€โ”€ dashboard/            # Admin dashboard components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ UsersTable.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ChatsTable.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ChatViewer.jsx
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ActivityChart.jsx
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”œโ”€โ”€ pages/                    # Page components
โ”‚   โ”‚   โ”œโ”€โ”€ ChatPage.jsx          # Main chat page
โ”‚   โ”‚   โ”œโ”€โ”€ Dashboard.jsx         # Admin dashboard
โ”‚   โ”‚   โ”œโ”€โ”€ Profile.jsx           # User profile
โ”‚   โ”‚   โ”œโ”€โ”€ Pricing.jsx           # Pricing page
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”œโ”€โ”€ context/                  # React context
โ”‚   โ”‚   โ””โ”€โ”€ AuthContext.jsx       # Authentication context
โ”‚   โ”œโ”€โ”€ locales/                  # i18n translations
โ”‚   โ”‚   โ”œโ”€โ”€ en.json
โ”‚   โ”‚   โ”œโ”€โ”€ de.json
โ”‚   โ”‚   โ””โ”€โ”€ it.json
โ”‚   โ”œโ”€โ”€ styles/                   # CSS modules
โ”‚   โ””โ”€โ”€ utils/                    # Utility functions
โ”œโ”€โ”€ server/                        # Backend Express application
โ”‚   โ”œโ”€โ”€ server.js                 # Main server file
โ”‚   โ”œโ”€โ”€ data/                     # SQLite database
โ”‚   โ”œโ”€โ”€ contacts/                 # Contact data
โ”‚   โ”œโ”€โ”€ history/                  # Chat history storage
โ”‚   โ””โ”€โ”€ scripts/                  # Utility scripts
โ”œโ”€โ”€ wieland-extension/            # Browser extension
โ”œโ”€โ”€ package.json                  # Frontend dependencies
โ””โ”€โ”€ vite.config.js               # Vite configuration

๐Ÿ”ง API Endpoints

Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - Login user
  • POST /api/auth/refresh - Refresh JWT token
  • GET /api/auth/verify - Verify token validity

Chat

  • POST /api/chat - Send chat message
  • GET /api/chats - Get user's chat history
  • DELETE /api/chats/:id - Delete chat
  • GET /api/chat/:id - Get specific chat

User Profile

  • GET /api/user/profile - Get user profile
  • PUT /api/user/profile - Update user profile
  • DELETE /api/user/account - Delete user account

Admin

  • GET /api/admin/users - List all users
  • GET /api/admin/stats - Get database statistics
  • DELETE /api/admin/users/:id - Remove user

AI Models

  • GET /api/models - List available Ollama models
  • POST /api/chat/stream - Stream AI response

๐ŸŒ Supported Languages

  • ๐Ÿ‡ฌ๐Ÿ‡ง English
  • ๐Ÿ‡ฉ๐Ÿ‡ช German (Deutsch)
  • ๐Ÿ‡ฎ๐Ÿ‡น Italian (Italiano)

โšก Performance Configuration

Ollama Settings

  • OLLAMA_KEEP_ALIVE - How long to keep model in memory (default: 30m)
  • OLLAMA_STARTUP_PREWARM - Preload models on startup
  • OLLAMA_PREWARM_TIMEOUT_MS - Timeout for prewarming (default: 90s)

Intent NLU Settings

  • INTENT_NLU_ENABLED - Enable automatic intent detection
  • INTENT_NLU_MODEL - Model for intent recognition
  • INTENT_NLU_MAX_MEMORY_ITEMS - Number of memory context items

๐Ÿ” Security Features

  • JWT Authentication - Secure token-based authentication
  • Bcrypt Password Hashing - Industry-standard password security
  • CORS Protection - Cross-origin request validation
  • SQL Injection Prevention - Using parameterized queries
  • Offline-First Design - No external API dependencies
  • Input Validation - Server-side validation of all inputs

๐Ÿ“ฆ Database Schema

Users Table

  • id - Unique user identifier
  • email - User email (unique)
  • password - Bcrypt hashed password
  • username - Display name
  • created_at - Account creation timestamp
  • updated_at - Last update timestamp

Chats Table

  • id - Chat unique identifier
  • user_id - Reference to user
  • title - Chat title
  • created_at - Chat creation timestamp
  • updated_at - Last message timestamp

Messages Table

  • id - Message unique identifier
  • chat_id - Reference to chat
  • role - 'user' or 'assistant'
  • content - Message content
  • created_at - Message timestamp

๐Ÿ› Troubleshooting

Ollama Connection Issues

# Check if Ollama is running
curl http://localhost:11434/api/tags

# Start Ollama service
ollama serve

Database Errors

# Reset database (CAUTION: Deletes all data)
rm server/data/wieland.sqlite

Port Already in Use

# Change port in .env
PORT=3002

Module Not Found Errors

# Reinstall all dependencies
rm -rf node_modules package-lock.json
npm install
npm run server:install

๐Ÿค Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Standards

  • Use ESLint for code quality
  • Follow React best practices
  • Add meaningful commit messages
  • Include comments for complex logic

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ‘จโ€๐Ÿ’ป Author

Created by Ryhox


๐Ÿ“ž Support & Contact

For questions or issues:

  • ๐Ÿ’ฌ Discussions: GitHub Discussions
  • ๐Ÿ› Issues: GitHub Issues

๐ŸŽ‰ Acknowledgments


โฌ† Back to Top

Made with โค๏ธ by Ryhox

About

Locally hosted AI using Ollama

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages