Skip to content
Juilyn Celsia Fan 樊汭琳 edited this page Jul 1, 2025 · 4 revisions

AI Text Editor

AI Text Editor is a cross-platform, Python-powered desktop app built with PyQt6. It combines all the essentials of a modern text editor with powerful AI-driven writing assistance and seamless GitHub integration.


📖 Table of Contents


Introduction

Welcome to the AI Text Editor!
Harness the power of AI to improve your writing, translate, summarize, or autocorrect text—right inside your favorite desktop editor. Built on PyQt6, with an intuitive ribbon interface, tabbed editing, and first-class GitHub OAuth support, it’s everything you need to write, edit, and manage projects.


Key Features

Core Editing

  • New/Open/Save files (TXT, all formats)
  • Tabbed interface with closeable tabs
  • Undo/Redo, Find & Replace, Search Word
  • Live word, character & line count in the status bar

Formatting & Layout

  • Bold, Italic, Underline
  • Increase/Decrease font size, text color & highlight
  • Bulleted & numbered lists, indentation, alignment
  • Export as DOCX, TXT; Print support

AI-Powered Writing Tools

(Requires Ollama)

  • Autocorrect selection
  • Improve writing
  • Summarize text
  • Translate selection (choose target language)
  • Custom AI prompt on selected text

GitHub Integration

  • OAuth login via embedded Flask server (auth.py)
  • List your repositories & open files directly from GitHub
  • Save & upload new files back to your repo

Architecture Overview

┌─────────────┐      ┌─────────────┐      ┌──────────────┐
│  auth.py    │─OAUTH│  Flask App  │─HTTPS│ GitHub REST │
└─────────────┘      └─────────────┘      └──────────────┘
       │                     ↓
       │          ┌─────────────────────┐
       └─────────▶│      UI Layer       │
                 │ (ui/ui.py + ui.py)  │
                 │  • Ribbon & Toolbar │
                 │  • Tabbed QTextEdit │
                 │  • Status Bar       │
                 └─────────────────────┘
                                ↓
                 ┌─────────────────────────┐
                 │     ai.py (Ollama)      │
                 │  • PROMPTS templates    │
                 │  • get_ollama_response  │
                 └─────────────────────────┘

For full details see:


Installation

  1. Clone the repo
    git clone https://github.com/<your-org>/Text-Editor.git
    cd Text-Editor
  2. (Optional) Create a virtualenv
    python -m venv venv
    source venv/bin/activate    # macOS/Linux  
    venv\Scripts\Activate.ps1   # Windows PowerShell
  3. Install dependencies
    pip install -r requirements.txt
  4. Configure OAuth
    Copy env.example.env and set:
    GITHUB_CLIENT_ID=…
    GITHUB_CLIENT_SECRET=…
    OAUTH_REDIRECT_URI=http://127.0.0.1:5000/callback
    
  5. Install Ollama (for AI features)
    Follow instructions at https://github.com/jmorganca/ollama.

Getting Started

  1. Launch the app:
    python main.py
  2. Use File ▶ New/Open/Save to manage local files.
  3. Flip on AI ▶ Enable AI Tools to unlock AI actions.
  4. For GitHub, go to Projects ▶ Login, complete OAuth, then browse your repos.

Usage

Right-click selected text (with AI enabled) for:

Improve Writing ▶ Summarize ▶ Translate ▶ Custom Prompt

Use the Ribbon toolbar for formatting, export, and print.


Extending the Editor

  • Add new AI prompts in ai.pyPROMPTS
  • Customize the ribbon in ui/tools/toolbar.py
  • Hook deeper into OAuth in auth.py

More in Architecture Overview.


Contributing

  1. Fork & branch (feature/…)
  2. Code & tests
  3. PR → main
  4. Pass lint & formatting

See CONTRIBUTING.md.


License

Licensed under the MIT License.


Contact

Built by SchBenedikt · GitHub Repo
Questions? Open an Issue.

Happy writing! 🚀

Clone this wiki locally