AiR

AiR

AI with Rust.

Stars: 118

Visit
 screenshot

AiR is an AI tool built entirely in Rust that delivers blazing speed and efficiency. It features accurate translation and seamless text rewriting to supercharge productivity. AiR is designed to assist non-native speakers by automatically fixing errors and polishing language to sound like a native speaker. The tool is under heavy development with more features on the horizon.

README:

AiR

AI with Rust |

License Checks Release GitHub tag (latest by date) GitHub last commit

Built entirely in Rust, AiR delivers blazing speed and efficiency!

AiR boasts two main features: accurate translation and seamless text rewriting, designed to supercharge your productivity.

AiR is a great assistant for non-native speakers, automatically fixing errors and polishing language to sound like a native speaker.

More awesome features are on the horizon!

English中文

AiR

Feature Highlights

UIs

Rewrite Directly

rewrite-directly

Translate Directly

translate-directly

Status

  • OS
    • [x] macOS
    • [x] Windows
    • [ ] Unix
      • [x] Main features.
      • [ ] Certain window features, such as Hide on Lost Focus and Stick to Top, are not available on Unix.
  • Features
    • [x] Dark/Light Theme
    • [x] Rewrite
    • [x] Rewrite Directly
    • [x] Translate
    • [x] Translate Directly
    • [ ] Refactor Code (Coming Soon)
    • [ ] OCR (Planed)
    • [ ] TTS (Planed)

Usage

Installation

Build from Source

# Clone the repository.
git clone https://github.com/hack-ink/air
cd air

# To install Rust on macOS and Unix, run the following command.
#
# To install Rust on Windows, download and run the installer from `https://rustup.rs`.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable

# Install the necessary dependencies. (Unix only)
# Using Ubuntu as an example, this really depends on your distribution.
sudo apt-get update
sudo apt-get install libasound2-dev libxdo-dev

# Build the project, and the binary will be available at `target/release/air`.
cargo build --release

# If you are a macOS user and want to have a `AiR.app`, run the following command.
# Install `cargo-bundle` to pack the binary into an app.
cargo install cargo-bundle
# Pack the app, and the it will be available at `target/release/bundle/osx/AiR.app`.
cargo bundle --release

Download Pre-built Binary

  • GitHub Releases
    • Download the latest pre-built binary from here.
  • Homebrew
    • Planed

Configuration

API Key

Please configure the API key the first time you run AiR!

  1. Open AiR.
  2. Navigate to the "Setting" panel.
  3. Click the "AI" section.
  4. Fill in the "API Key" field.

Open a Mac app from an unidentified developer (macOS only)

When you open AiR for the first time, you'll see the following message:

"AiR" cannot be opened because the developer cannot be verified.

Since I'm not an identified developer, you need to allow AiR to run on your Mac.

Buy me a coffee so I can get an Apple Developer Certificate. 😄

  1. Open "System Preferences" -> "Privacy & Security".
  2. Scroll down to the '"AiR" was blocked from use because it is not from an identified developer.' section.
  3. Click "Open Anyway".

Relate resources:

Gain System Accessibility Permission (macOS only)

To control the keyboard and use the system clipboard for reading and writing data, AiR must obtain system accessibility permissions.

  1. Open "System Settings" -> "Privacy & Security" -> "Accessibility".
  2. Click the "+" button and add the "AiR.app" or "air" binary.

Setting

You can configure the settings by navigating to the "Settings" panel.

  • General
    • Font Size
    • Hide on Lost Focus: Hide AiR when it loses focus.
    • Stick to Top: Keep AiR on top of other windows.
  • AI
    • API Base: The base URL of the AI API. It's crucial to ensure you don't forget the v1 part. (e.g., https://api.openai.com/v1).
    • API Key
    • Model
    • Model Name: Available only if the model is set to Custom.
    • Temperature: The unpredictability of AI.
    • Rewrite Prompt: The extra prompt to be attached to the default.
    • Translate Prompt: The extra prompt to be attached to the default.
  • Hotkey
    • Rewrite
    • Rewrite Directly
    • Translate
    • Translate Directly
  • Development
    • Log Level

AiR is currently under heavy development, and not all settings are always available in the user interface.

However, all settings can always be found in the settings file.

The location of the settings file varies depending on the OS.

  • ~/Library/Application\ Support/AiR/setting.toml (macOS)
  • C:\Users\<username>\AppData\Roaming\hack.ink\AiR\setting.toml (Windows)
  • ~/.config/AiR/setting.toml (Unix)

Interaction

  • Type the text in the input area and press META+ENTER on macOS or CTRL+ENTER on other OS to trigger the corresponding function.
  • You can also select text and use hotkeys to directly apply the corresponding function to the selected text.

Update

An automatic update feature is under development.

For now, you can manually update AiR by repeating the installation steps.

Re-gain System Accessibility Permission (macOS only)

Sometimes, you might need to regain system accessibility permission after updating AiR. However, in most cases, this step is unnecessary.

  1. Follow the "Gain System Accessibility Permission" section to locate the "AiR.app" or "air" binary.
  2. Click the "-" button to remove the existing permission, then click the "+" button to re-add it.

Development

Architecture

graph TD
    A[AiR]
    A --> B[Components]
    A --> C[OS]
    A --> D[Services]
    A --> E[State]
    A --> F[UI]
    B --> B1[Data Structures]
    C --> C1[macOS/Unix/Windows]
    D --> D1[Background Processes]
    E --> E1[Synchronization]
    F --> F1[Interaction]

Built upon egui, a fast and cross-platform GUI toolkit written in pure Rust.

  • Components
    • Provides the basic data structures and functions used by other parts of the program.
    • Component should be static, don't include any mutable state.
  • OS
    • Provides wrapped APIs to interact with the OS.
    • Differences between OS should be addressed here and presented in a summarized, abstract manner.
  • Services
    • Provides background tasks ability to run independently of the UI.
    • Service has one or more requirements for a cache component to conserve system resources, perform frequent checks or updates, and handle time-sensitive tasks.
    • Service related to UI settings should provide a hot reload function so that when a setting is changed on UI, the changes are applied immediately.
    • Service should include an abort function to stop the service, and it should be called when exiting the program. to prevent it from stalling.
  • State
    • Provides mutability that can be synchronized and shared throughout the entire program.
    • State should be Arc<parking_lot::Mutex/RwLock<_>> or Arc<std::sync::atomic::Atomic*>.
  • UI
    • Provides the interaction ability of other parts for users.

Support Me

If you find this project helpful and would like to support its development, you can buy me a coffee!

Your support is greatly appreciated and motivates me to keep improving this project.

  • Fiat
  • Crypto
    • Bitcoin
      • bc1pedlrf67ss52md29qqkzr2avma6ghyrt4jx9ecp9457qsl75x247sqcp43c
    • Ethereum
      • 0x3e25247CfF03F99a7D83b28F207112234feE73a6
    • Polkadot
      • 156HGo9setPcU2qhFMVWLkcmtCEGySLwNqa3DaEiYSWtte4Y

Thank you for your support!

Appreciation

We would like to extend our heartfelt gratitude to the following projects and contributors:

  • egui for providing the foundation for our GUI.
  • The Rust community for their continuous support and development of the Rust ecosystem.

Additional Acknowledgements

License

Licensed under GPL-3.0.

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for AiR

Similar Open Source Tools

For similar tasks

For similar jobs