https://github.com/menonsoftware/konexion
A modern web application for AI model inference and chat interactions
https://github.com/menonsoftware/konexion
ai fastapi groq-api javascript ollama-api python3 svelte sveltekit
Last synced: 2 months ago
JSON representation
A modern web application for AI model inference and chat interactions
- Host: GitHub
- URL: https://github.com/menonsoftware/konexion
- Owner: menonsoftware
- License: mit
- Created: 2025-09-07T12:33:27.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-09-07T13:43:55.000Z (10 months ago)
- Last Synced: 2025-09-07T15:24:49.398Z (10 months ago)
- Topics: ai, fastapi, groq-api, javascript, ollama-api, python3, svelte, sveltekit
- Language: Svelte
- Homepage:
- Size: 136 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Konexion
A modern web application for AI model inference and chat interactions, providing a unified interface for both cloud-based and local AI models.
## Overview
Konexion is a full-stack web application that enables seamless interaction with multiple AI providers through an intuitive chat interface. The project consists of two main components:
- **Backend (FastAPI)**: Provides API endpoints and WebSocket connections for AI model inference
- **Frontend (SvelteKit)**: Modern, responsive web interface for chat interactions
## Features
### π€ Multi-Provider AI Support
- **Groq**: Cloud-based AI inference with high-performance models
- **Ollama**: Local AI model hosting and inference
- Support for multiple models simultaneously
### π¬ Real-time Chat Interface
- WebSocket-based streaming responses
- Modern, responsive UI built with SvelteKit and Tailwind CSS
- Dark/light mode support
- Keyboard shortcuts for improved productivity
### π§ Developer-Friendly
- Type-safe configuration management
- Environment-based setup
- Comprehensive error handling
- Hot-reload development mode
### π Production-Ready
- CORS configuration for secure deployments
- Configurable logging
- Docker support (optional)
- Scalable architecture
## Architecture
```
βββββββββββββββββββ WebSocket/HTTP βββββββββββββββββββ
β β βββββββββββββββββββΊ β β
β SvelteKit β β FastAPI β
β Frontend β β Backend β
β β β β
βββββββββββββββββββ βββββββββββββββββββ
β
β HTTP/API
βΌ
βββββββββββββββββββ
β AI Providers β
β β
β βββββββ βββββββββ
β βGroq β βOllamaββ
β βββββββ βββββββββ
βββββββββββββββββββ
```
## Quick Start
### Prerequisites
- **Node.js**: 18+ (for frontend)
- **Python**: 3.12+ (for backend)
- **UV**: Python package manager
- **pnpm/npm**: Node.js package manager
### 1. Clone the Repository
```bash
git clone
cd source
```
### 2. Backend Setup
```bash
cd konexion_backend
# Install UV if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create virtual environment and install dependencies
uv venv --python 3.12
source .venv/bin/activate
uv sync
# Configure environment
cp example.env .env
# Edit .env with your configuration
# Start the backend
uv run main.py
```
### 3. Frontend Setup
```bash
cd ../konexion_frontend
# Install dependencies
npm install
# or
pnpm install
# Start development server
npm run dev
# or
pnpm dev
```
### 4. Access the Application
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
## Project Structure
```
source/
βββ konexion_backend/ # FastAPI backend application
β βββ main.py # Application entry point
| βββ vision.py # Complete vision processing module
β βββ config.py # Configuration management
β βββ pyproject.toml # Python dependencies
β βββ ai_models/ # AI provider implementations
β β βββ groq.py # Groq integration
β β βββ ollama.py # Ollama integration
β βββ models/ # Data models and schemas
β
βββ konexion_frontend/ # SvelteKit frontend application
β βββ src/
β β βββ routes/ # SvelteKit routes
β β βββ lib/ # Shared components and utilities
β β β βββ components/ # Svelte components
β β β βββ api.js # API client
β β β βββ websocket.js # WebSocket management
β β β βββ stores.js # Svelte stores
β β βββ app.html # HTML template
β βββ package.json # Node.js dependencies
β βββ vite.config.js # Vite configuration
β
βββ README.md # This file
```
## Configuration
### Backend Configuration
The backend uses environment variables for configuration. See `konexion_backend/example.env` for all available options:
- **AI Provider Keys**: Configure API keys for Groq and URLs for Ollama
- **Server Settings**: Host, port, CORS origins
- **Development**: Debug mode, auto-reload, logging levels
### Frontend Configuration
The frontend automatically connects to the backend API. Configuration can be adjusted in:
- `vite.config.js`: Vite and build settings
- `svelte.config.js`: SvelteKit configuration
- `tailwind.config.js`: Tailwind CSS customization
## Development
### Backend Development
```bash
cd konexion_backend
# Activate virtual environment
source .venv/bin/activate
# Run with auto-reload
uv run main.py
# Run tests (if available)
# uv run pytest
```
### Frontend Development
```bash
cd konexion_frontend
# Start development server with hot-reload
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Lint and format
npm run lint
npm run format
```
### Adding New AI Providers
1. Create a new module in `konexion_backend/ai_models/`
2. Implement the required interface methods
3. Add configuration variables in `config.py`
4. Register the provider in `main.py`
5. Update frontend to handle the new provider
## Deployment
### Production Build
```bash
# Backend
cd konexion_backend
uv sync --no-dev
# Frontend
cd konexion_frontend
npm run build
```
### Pre-commit hooks
# Daily development (lenient)
make pre-commit
# Production/CI (strict)
make pre-commit-strict
# Format code
make format
# Manual linting
make lint
### Environment Variables
Ensure all required environment variables are set in production:
- AI provider API keys
- Server configuration
- CORS origins for your domain
## Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Make your changes
4. Test thoroughly
5. Commit your changes (`git commit -m 'Add amazing feature'`)
6. Push to the branch (`git push origin feature/amazing-feature`)
7. Open a Pull Request
### Development Guidelines
- Follow Python PEP 8 for backend code
- Use Prettier for frontend code formatting
- Write meaningful commit messages
- Add tests for new features
- Update documentation as needed
## Troubleshooting
### Common Issues
1. **Backend not starting**: Check Python version and environment variables
2. **Frontend connection errors**: Ensure backend is running on correct port
3. **AI model errors**: Verify API keys and service URLs
4. **CORS errors**: Add frontend URL to backend CORS origins
### Getting Help
- Check the individual README files in each component folder
- Review the API documentation at `/docs` endpoint
- Check application logs for error details
## Roadmap
- [ ] Image and attachment support - WIP
- [ ] User authentication and sessions
- [ ] Chat history persistence
- [ ] Multi-user support
- [ ] Docker containerization
- [ ] Additional AI provider integrations
## License
MIT License
Copyright (c) 2025 Konexion Project
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.