Skip to content

mrichman/ivanhoe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Ivanhoe

A feature-rich Rust GUI application that provides a ChatGPT-like interface using Amazon Bedrock with Claude 3.5 Sonnet.

Features

Chat Management

  • Multiple chat sessions - Create and switch between different conversations using tabs
  • Persistent conversations - Each tab maintains its own message history and file attachments
  • Loading indicators - Visual feedback while waiting for Claude's responses
  • Auto-scroll - Automatically scrolls to show new messages
  • Copy functionality - Copy Claude's responses or code blocks to clipboard

File Support

  • Drag and drop files - Simply drag files into the window to attach them
  • File picker button - Click the πŸ“Ž button to browse and select files
  • Multiple file types - Support for text files, images (PNG, JPG, JPEG), and documents
  • File management - Clear attached files with one click
  • Smart file handling - Automatic content extraction and appropriate formatting

User Interface

  • Tabbed interface - Multiple chat sessions with easy switching and "+" button for new tabs
  • Adjustable font size - Slider control (10px - 24px) for better readability
  • Markdown rendering - Proper formatting for Claude's responses with syntax highlighting
  • Code block support - Specially formatted code blocks with copy buttons
  • Tooltips - Helpful descriptions for all interactive controls
  • Status bar - Shows AWS profile, model info, and real-time token usage
  • Professional branding - Proper title case in application menus and title bar
  • Version display - Application version shown in title bar

Token Tracking

  • Real-time monitoring - Track input and output tokens for each request
  • Usage display - See total token consumption in the status bar
  • Cost awareness - Monitor API usage for billing estimates
  • Cumulative tracking - Tokens tracked across all chat sessions

Code Quality

  • Modular architecture - Clean separation of concerns across multiple modules
  • Clippy compliance - Passes all Rust clippy pedantic checks
  • Type safety - Full Rust type system benefits with error handling
  • Maintainable codebase - Well-organized structure for future development

Prerequisites

Rust Installation

  1. Install Rust (if not already installed):

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    source ~/.cargo/env
  2. Verify installation:

    rustc --version
    cargo --version
  3. Update Rust (if already installed):

    rustup update

System Dependencies

  • macOS: No additional dependencies required

  • Linux: Install development packages:

    # Ubuntu/Debian
    sudo apt-get install build-essential libxcb1-dev libxrandr-dev libxss-dev libxcursor-dev libxcomposite-dev libasound2-dev libxi-dev libgl1-mesa-dev
    
    # Fedora/RHEL
    sudo dnf install gcc-c++ libxcb-devel libXrandr-devel libXss-devel libXcursor-devel libXcomposite-devel alsa-lib-devel libXi-devel mesa-libGL-devel

Setup

  1. Configure AWS credentials:

    aws configure
  2. Ensure Bedrock access:

    • You need access to Claude 3.5 Sonnet in Amazon Bedrock
    • US East 1 (us-east-1) region is recommended
  3. Build and run:

    cargo run

Usage

Basic Chat

  • Type messages in the input field at the bottom
  • Press Enter or click Send to submit
  • Claude's responses appear with markdown formatting and syntax highlighting
  • Use the πŸ“‹ button to copy responses or code blocks to clipboard

File Attachments

  • Drag & Drop: Drag files directly into the window
  • File Picker: Click the πŸ“Ž button to browse for files
  • Supported formats: Text files, images (PNG/JPG/JPEG), PDFs, Office documents
  • Management: Use Clear files to remove all attachments
  • Smart processing: Images show size info, documents show type descriptions

Multiple Chats

  • Click + to create a new chat session
  • Click on tab names to switch between conversations
  • Each tab has independent message history and file attachments
  • Token usage is tracked across all sessions

Customization

  • Font Size: Use the slider in the top panel to adjust text size (10px-24px)
  • Token Monitoring: View real-time usage statistics in the status bar
  • Tooltips: Hover over any control for helpful descriptions

Development

Building

make build          # Build the project
make run            # Run the application
make release        # Build optimized release version

Code Quality Targets

make check          # Check code without building
make clippy         # Run clippy linter (fails on warnings)
make fmt            # Format code
make test           # Run tests
make qa             # Run all quality checks

Quality Assurance

make clippy && make run    # Only run if clippy passes

Docker Support

make docker-build   # Build Docker image
make docker-run     # Run in container (Linux with X11)
make docker-clean   # Remove Docker image

Note: Docker GUI support requires X11 (Linux) or XQuartz (macOS).

Architecture

Module Structure

src/
β”œβ”€β”€ main.rs           # Application entry point
β”œβ”€β”€ app.rs           # Main application logic and coordination
β”œβ”€β”€ chat/            # Chat session management
β”œβ”€β”€ bedrock/         # AWS Bedrock API integration
β”œβ”€β”€ ui/              # User interface components
└── utils/           # Utility functions (files, clipboard)

Technical Details

  • Framework: Built with egui/eframe for cross-platform GUI
  • AWS Integration: Uses AWS SDK for Bedrock API calls
  • Model: Claude 3.5 Sonnet (us.anthropic.claude-3-5-sonnet-20241022-v2:0)
  • File Processing: Automatic content extraction and formatting
  • Async Architecture: Non-blocking UI with tokio runtime
  • Memory Management: Efficient handling of large conversations and files

Requirements

  • Rust 1.70+
  • AWS credentials configured
  • Amazon Bedrock access with Claude 3.5 Sonnet permissions

About

Cedric the Saxon is a proud Saxon noble and the father of the title character, Wilfred of Ivanhoe, in Sir Walter Scott's novel Ivanhoe.

Resources

License

Contributing

Stars

Watchers

Forks

Contributors