Skip to content

jennethydyrova/lexi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lexi - Simple AI Clipboard Assistant

A simple Electron application that helps rewrite your clipboard content in different styles (polite, formal, short) using Ollama and Llama2. This is a toy project for learning and experimentation.

Features

  • Global Shortcut: Press Cmd+Shift+A (Mac) or Ctrl+Shift+A (Windows/Linux) to capture clipboard content
  • AI Rewriting: Automatically processes text using Ollama with Llama2 model
  • Multiple Styles: Get suggestions in polite, formal, and short formats
  • One-Click Replacement: Click any suggestion to replace your clipboard content
  • System Tray: Runs in the background with system tray integration

Prerequisites

  • Node.js (v16 or higher)
  • Python (v3.8 or higher)
  • Poetry (Python dependency manager)
  • Ollama with Llama2 model

Installation

1. Install Ollama and Llama2

# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh

# Pull Llama2 model
ollama pull llama2

2. Clone and Setup

# Clone the repository
git clone
cd lexi

# Install Electron dependencies
cd electron
npm install

# Install Python dependencies
cd ../backend
poetry install

Running the Application

1. Start the Backend Server

cd backend
poetry run fastapi run src/main.py

The FastAPI server will start on http://localhost:8000

2. Start the Electron App

cd electron
npm run dev

Usage

  1. Copy any text to your clipboard
  2. Press the global shortcut Cmd+Shift+A (Mac) or Ctrl+Shift+A (Windows/Linux)
  3. Wait for AI processing - the app will show "Loading..." while processing
  4. Choose your preferred style:
    • Polite: Rewritten in a polite, courteous manner
    • Formal: Rewritten in a formal, professional tone
    • Short: Rewritten in a concise, brief format
  5. Click any button to replace your clipboard with the chosen version

Development

Project Structure

lexi/
├── electron/                 # Electron frontend
│   ├── src/
│   │   ├── main/            # Main process
│   │   ├── preload/         # Preload scripts
│   │   └── renderer/        # React frontend
│   └── package.json
├── backend/                 # FastAPI backend
│   ├── src/
│   │   └── main.py         # FastAPI application
│   └── pyproject.toml      # Poetry dependencies
└── README.md

Building for Production

# Build Electron app
cd electron
npm run build

# The built app will be in the dist/ folder

Troubleshooting

Common Issues

  1. "API Available: ❌" in Debug Info

    • The preload script isn't loading properly
    • Check the terminal for preload script errors
    • Restart the Electron app
  2. "No module named 'ollama'"

    • Make sure Ollama is installed: ollama --version
    • Ensure you're in the correct Poetry environment: poetry shell
  3. Global shortcut not working

    • Check if the shortcut is registered in the terminal
    • Try restarting the app
    • On some systems, you may need to grant accessibility permissions
  4. FastAPI connection errors

    • Ensure the backend server is running on port 8000
    • Check the Content Security Policy in src/renderer/index.html

Debug Mode

Enable debug logging by checking the browser console (F12) in the Electron window for detailed error messages.

About

Lexi - Simple AI Clipboard Assistant

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published