Skip to content

wmeddie/konnyaku

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Konnyaku 🍒

A lightweight, privacy-focused Japanese-English translation desktop application powered by local AI. Built with Tauri, React, and the LiquidAI LFM2-350M-ENJP-MT model running entirely on your device.

License Platform Rust Node

Looks

image

Features

  • πŸ” 100% Private: All translations happen locally on your device
  • πŸš€ Fast: GPU-accelerated inference using Metal (macOS) or CUDA (NVIDIA)
  • 🎯 Accurate: Powered by LiquidAI's specialized Japanese-English model
  • πŸ’» Native Performance: Built with Rust and Tauri for minimal resource usage
  • 🎨 Modern UI: Clean, responsive interface built with React
  • πŸ“– No Internet Required: Works completely offline after initial model download

Prerequisites

Before building Konnyaku, ensure you have the following installed:

Installing pnpm

npm install -g pnpm

Quick Start

1. Clone the Repository

git clone https://github.com/yourusername/konnyaku.git
cd konnyaku

2. Install Dependencies

# Install frontend dependencies
pnpm install

# The Rust dependencies will be installed automatically when building

3. Development Mode

Run the app in development mode with hot-reload:

pnpm tauri dev

The app will:

  1. Start the Vite dev server for the frontend
  2. Compile the Rust backend
  3. Open the application window
  4. Automatically download the AI model on first run (~200MB)

4. Production Build

Create an optimized production build:

pnpm tauri build

The built application will be in src-tauri/target/release/bundle/.

Usage

  1. Launch the app - The model will download automatically on first run
  2. Select translation direction - Click the language selector to switch between EN→JA and JA→EN
  3. Enter text - Type or paste text in the input field (max 5000 characters)
  4. Translate - Click the translate button or press Cmd/Ctrl+Enter
  5. Copy result - Click the copy button to copy the translation to clipboard

Project Structure

konnyaku/
β”œβ”€β”€ src/                    # React frontend
β”‚   β”œβ”€β”€ components/         # UI components
β”‚   β”œβ”€β”€ hooks/             # Custom React hooks
β”‚   └── App.jsx            # Main app component
β”œβ”€β”€ src-tauri/             # Rust backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ lib.rs         # Tauri commands
β”‚   β”‚   β”œβ”€β”€ main.rs        # App entry point
β”‚   β”‚   └── translation.rs # LLM inference logic
β”‚   └── Cargo.toml         # Rust dependencies
β”œβ”€β”€ public/                # Static assets
└── package.json          # Node dependencies

Technical Details

Model

  • Model: LiquidAI/LFM2-350M-ENJP-MT-GGUF
  • Size: ~200MB (4-bit quantized)
  • Format: GGUF (llama.cpp compatible)
  • Specialization: Japanese-English translation
  • Context: 4096 tokens

Backend Implementation

The backend uses the llama-cpp-2 crate for model inference:

  • GPU Acceleration: Metal on macOS, CUDA on NVIDIA GPUs
  • Memory Efficient: Model loaded once and kept in memory
  • Thread Safe: Arc for concurrent access
  • Chat Templates: Uses model's embedded template for proper formatting

Frontend Stack

  • Framework: React 18
  • Build Tool: Vite
  • Styling: CSS with modern features
  • State Management: React hooks
  • API: Tauri commands via IPC

Contributing

We welcome contributions! Here's how to get started:

Development Workflow

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Make your changes
  4. Test thoroughly: Ensure translations work in both directions
  5. Commit with descriptive messages: Follow conventional commits
  6. Push and create a PR

Code Style

  • Rust: Follow standard Rust conventions (use cargo fmt and cargo clippy)
  • JavaScript/React: ESLint configuration included
  • CSS: BEM naming convention for components

Testing

# Run Rust tests
cd src-tauri
cargo test

# Run frontend tests (if available)
pnpm test

Areas for Contribution

  • Add support for more language pairs
  • Implement translation history
  • Add dark mode support
  • Optimize model loading time
  • Add batch translation support
  • Implement translation confidence scores
  • Add support for document translation
  • Create automated tests
  • Improve error handling and user feedback

Troubleshooting

Model Download Issues

If the model download fails:

  1. Check your internet connection
  2. The model will be downloaded to:
    • macOS: ~/Library/Caches/konnyaku/models/
    • Linux: ~/.cache/konnyaku/models/
    • Windows: %LOCALAPPDATA%\konnyaku\cache\models\
  3. You can manually download from: HuggingFace
  4. Place the LFM2-350M-ENJP-MT-Q4_K_M.gguf file in the cache directory

Build Errors

  • Rust errors: Ensure you have the latest Rust toolchain: rustup update
  • Node errors: Clear node_modules and reinstall: rm -rf node_modules && pnpm install
  • Tauri errors: Check platform-specific prerequisites

Performance Issues

  • The first translation after app start may be slower (model loading)
  • Ensure GPU acceleration is enabled (check console output)
  • Close other resource-intensive applications

Architecture Decisions

See the docs/ directory for architecture decision records (ADRs) documenting key design choices.

License

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

Acknowledgments

  • LiquidAI for the LFM2-350M-ENJP-MT model
  • llama.cpp for the inference engine
  • Tauri for the application framework
  • The Rust and React communities

Support


Built with ❀️ for the Japanese learning community

About

A tauri-based translator app that utilizes local models for translation.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors