Skip to content

About

A code that will help you write a story

Resources

Stars

1 star

Watchers

0 watching

Forks

 
 

Latest commit

 

History

40 Commits

Folders and files

Repository files navigation

AI Writer 🖋️

logo

A sleek desktop application for AI-assisted writing powered by llama.cpp and built with PyQt5. Let your local LLM continue your stories, articles, or documents seamlessly.

Python PyQt5 llama.cpp License


✨ Features

  • 🤖 AI Text Completion - Continue your writing with local LLM models via llama.cpp
  • 🎨 Light/Dark Theme - Toggle between beautiful light and dark modes
  • 🌡️ Temperature Control - Adjust creativity vs. focus (0.0 - 2.0)
  • 📊 Token Limit - Control response length (10 - 2000 tokens)
  • 📝 Model Selection - Choose from all your installed llama.cpp models
  • 💾 Multiple Export Formats - Save as .txt or .docx (Word)
  • 🖥️ Modern UI - Clean, responsive interface with sidebar controls

📋 Requirements

System Requirements

  • Python 3.8+
  • llama.cpp server running locally (with OpenAI-compatible API enabled)
  • Operating System: Windows, macOS, or Linux

Python Dependencies

PyQt5>=5.15.0
requests>=2.28.0
python-docx>=0.8.11  # Optional, for .docx support

🚀 Installation

1. Install llama.cpp

First, ensure llama.cpp is installed and the server is running with the OpenAI-compatible API:

Windows/macOS/Linux:

# Clone and build llama.cpp
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
make

# Start the server with OpenAI API enabled (default port 8080)
./server -m models/your-model.gguf --host 0.0.0.0 --port 8080

Or download pre-built binaries from the releases page.

2. Clone the Repository

git clone [https://github.com/yourusername/ai-writer.git](https://github.com/Laszlobeer/AI-Writer.git)
cd ai-writer

3. Create Virtual Environment (Recommended)

python -m venv venv

# Windows
venv\Scripts\activate

# macOS/Linux
source venv/bin/activate

4. Install Dependencies

pip install -r requirements.txt

Or install manually:

pip install PyQt5 requests python-docx

🎯 Usage

Starting the Application

python ai writer.py

Basic Workflow

  1. Select a Model - Click the model dropdown and choose an installed Ollama model
  2. Write Your Text - Start typing in the editor
  3. Click Generate - Press the ✨ Generate button or use keyboard shortcut
  4. Save Your Work - Export as .txt or .docx

Controls

Control Description
🌙/☀️ Toggle Light/Dark theme
🔄 Refresh available models
✨ Generate Trigger AI completion
📄 Save .txt Export as text file
📕 Save .docx Export as Word document
🌡️ Temperature Adjust creativity (left=focused, right=creative)
📊 Token Limit Set maximum response length

⚙️ Configuration

Default Settings

Setting Default Value Description
Temperature 0.7 Balance between creativity and coherence
Token Limit 2000 Maximum tokens in AI response
llama.cpp URL http://localhost:8080 Local llama.cpp server endpoint

Customizing Settings

You can modify default values in the source code (ai writer.py):

# In ai writer.py
LLAMA_CPP_URL = "http://localhost:8080"
DEFAULT_TOKEN_LIMIT = 140
DEFAULT_TEMPERATURE = 0.7

Temperature Guide

  • 0.0 - 0.5 🎯 Focused, deterministic output
  • 0.5 - 1.0 ⚖️ Balanced creativity and coherence
  • 1.0 - 2.0 🎨 Highly creative, unpredictable output

🖼️ Screenshots

Light Mode

Light Mode

Dark Mode

Dark Mode


🔧 Troubleshooting

llama.cpp Connection Error

Cannot connect to llama.cpp. Is the server running?

Solution: Ensure llama.cpp server is running:

./server -m models/your-model.gguf --host 0.0.0.0 --port 8080

No Models Found

No models available

Solution: Ensure your GGUF model file is loaded by the server. The server will list available models at the /v1/models endpoint.

python-docx Not Available

install python-docx for .docx

Solution: Install the package:

pip install python-docx

📄 License

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


🙏 Acknowledgments


About

A code that will help you write a story

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages