Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A chatbot made with Rust, using Dioxus as a fullstack framework and Kalosm as a model interface.

License

Notifications You must be signed in to change notification settings

develatter/rusty_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– Rusty Bot

Rust WebAssembly License

A modern AI chatbot built entirely in Rust with RAG capabilities

Features โ€ข Installation โ€ข Usage โ€ข Development


๐ŸŽฏ About

Rusty Bot is an open-source AI chatbot application that demonstrates the power of Rust in building modern web applications. This project serves as both a functional chatbot and an educational resource, showcasing how to integrate large language models with semantic search capabilities using a full-stack Rust approach.

Academic Context: This project is part of the Final Degree Project by Alejandro Lรณpez Martรญnez, a student in the 2nd year of Multiplatform Application Development in Almerรญa, Spain.

โœจ Features

๐Ÿง  AI-Powered Conversations

  • Integration with language models via Kalosm
  • Real-time streaming responses for better user experience
  • Conversation history management with reset functionality

๐Ÿ” Semantic Search & RAG

  • Document embedding using BERT models
  • Context-aware responses through Retrieval-Augmented Generation (RAG)
  • Vector database powered by SurrealDB for semantic search

๐ŸŽจ Modern Web Interface

  • Responsive design built with Dioxus framework
  • Real-time streaming text display
  • Markdown support with syntax highlighting
  • Dark theme optimized for extended use

๐Ÿ›  Full-Stack Rust Architecture

  • Use of Dioxus as full-stack framework.
  • Type-safe communication between client and server
  • Zero JavaScript dependencies (except for styling with TailwindCSS)

Core Components

  • Frontend: Dioxus-based reactive UI compiled to WebAssembly
  • Backend: Axum server with Dioxus server functions
  • LLM Engine: Kalosm integration with Qwen 2.5 7B model
  • Vector Database: SurrealDB with embedding-based semantic search
  • Context System: Markdown-based document ingestion with RAG

๐Ÿš€ Installation

Prerequisites

Ensure you have the following installed on your system:

1. Rust Toolchain

# Install Rust using rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Follow the on-screen instructions and restart your terminal
# Verify installation
rustc --version
cargo --version

2. Dioxus CLI

# Install Dioxus CLI for development
cargo install dioxus-cli

# Verify installation
dx --version

3. System Requirements

  • RAM: At least 8GB (16GB recommended for LLM operations)
  • Storage: ~10GB free space for model downloads
  • OS: Linux, macOS, or Windows with WSL2

๐Ÿ”ง Setup

  1. Clone the Repository

    git clone https://github.com/your-username/rusty_bot.git
    cd rusty_bot
  2. Create Context Directory (if it doesn't exist)

    mkdir -p context
  3. Add Your Documents (Optional)

    Place your Markdown files in the context/ directory. These will be used for RAG-based responses.

๐ŸŽฎ Usage

dx serve --platform web --release

๐Ÿ’ฌ Using the Chatbot

  1. Initialize: The application will automatically download and initialize the language model on first run (this may take several minutes)

  2. Chat: Type your message in the text area and press Enter or click Send

  3. Context Toggle: Enable the "Context" toggle to use RAG-based responses with your documents

  4. Reset: Click the reset button (โ†ป) in the top-left to start a new conversation

๐Ÿ›  Development

Project Structure

rusty_bot/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ components/          # UI components
โ”‚   โ”‚   โ”œโ”€โ”€ conversation.rs  # Main chat interface
โ”‚   โ”‚   โ””โ”€โ”€ message.rs       # Individual message rendering
โ”‚   โ”œโ”€โ”€ model/               # Data models
โ”‚   โ”‚   โ”œโ”€โ”€ chat.rs          # Chat message structures
โ”‚   โ”‚   โ””โ”€โ”€ document.rs      # Document result structures
โ”‚   โ”œโ”€โ”€ server/              # Server-side modules
โ”‚   โ”‚   โ”œโ”€โ”€ llm.rs           # Language model integration
โ”‚   โ”‚   โ”œโ”€โ”€ embedding.rs     # Text embedding functionality
โ”‚   โ”‚   โ””โ”€โ”€ database_impl.rs # Database operations
โ”‚   โ”œโ”€โ”€ server_functions/    # Dioxus server functions
โ”‚   โ””โ”€โ”€ main.rs              # Application entry point
โ”œโ”€โ”€ context/                 # Knowledge base documents
โ”œโ”€โ”€ assets/                  # Static assets
โ””โ”€โ”€ Cargo.toml              # Project dependencies

Adding New Features

  1. Server Functions: Add new server functions in src/server_functions/
  2. UI Components: Create new components in src/components/
  3. Models: Define data structures in src/model/
  4. Context: Add knowledge base documents to context/

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

๐Ÿ“„ License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Kalosm - For providing excellent Rust LLM integration
  • Dioxus - For the amazing full-stack Rust framework
  • SurrealDB - For the powerful multi-model database
  • The Rust community for creating such amazing tools and libraries

Made with โค๏ธ and ๐Ÿฆ€ by Alejandro Lรณpez Martรญnez (develatter)

About

A chatbot made with Rust, using Dioxus as a fullstack framework and Kalosm as a model interface.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published