Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Assistant for LibreOffice

A Python-based LibreOffice extension (.oxt) that integrates local and cloud-based Large Language Models (LLMs) directly into LibreOffice Writer.

It provides an interactive, native-looking interface for text generation and document editing without freezing the LibreOffice UI.


Features

  • Multiple Providers Supported:
    • 🤖 Ollama (Local): Run offline models like llama3, mistral, or phi3.
    • 💻 LM Studio (Local / OpenAI-compatible): Run any local GGUF models with OpenAI-standard chat completion.
    • 🌐 Google Gemini: Access advanced cloud intelligence via Gemini APIs.
    • ☁️ Anthropic Claude: Access Claude models via the Anthropic Messages API.
  • Asynchronous Design: API calls run on background threads, keeping the LibreOffice interface fully responsive while generating.
  • Text Generation: Prompt the model to write new content and insert it at the cursor position.
  • Context-Aware Rewrite: Select text in Writer to improve writing, fix grammar, adjust tone (casual/professional), summarize, or run custom prompts (e.g., translation).
  • Dynamic Configuration UI: A custom settings menu that enables/disables API fields dynamically based on the selected provider.
  • Zero External Dependencies: Implemented using Python's standard urllib library, ensuring it runs on any standard LibreOffice installation.

Installation

1. Prerequisites (Linux Only)

On Linux (Ubuntu, Debian, Mint), ensure Python-UNO support is installed:

sudo apt install libreoffice-script-provider-python

(Windows and macOS bundle Python automatically with LibreOffice; no action is required.)

2. Install the Extension

Download the ai_assistant.oxt file from this repository and install it:

  • Via GUI:
    1. Open LibreOffice Writer.
    2. Go to ToolsExtension Manager....
    3. Click Add, select ai_assistant.oxt, and click Open.
    4. Restart LibreOffice.
  • Via CLI:
    unopkg add ai_assistant.oxt

Usage

For detailed setup instructions and usage walkthroughs, see the AI Assistant Installation & Usage Guide (PDF) included in this repository.

Configuration

  1. Go to AI AssistantSettings....
  2. Select your provider, model name, and keys/endpoints.
  3. Save settings.

Generating Text

  1. Click AI AssistantGenerate Text....
  2. Enter a prompt and click Generate.

Editing Selection

  1. Highlight any text in your document.
  2. Click AI AssistantRewrite Selection....
  3. Select an action (e.g., "Fix Grammar" or "Make Professional") and click Rewrite.

Development

To modify the extension code or rebuild it:

  1. Edit the files inside the extension/ directory.
  2. Run the build script to package and auto-register it in your local LibreOffice:
    ./build.sh

License

This project is licensed under the MIT License.

About

An add-in for LibreOffice that supports AI text generation and formatting help for Writer. API calls to Claude, Gemini, LM Studio and Ollama are supported currently.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages