How farshed/sage works
Project Type and Purpose
• Sage is a full-stack self-hosted application that leverages state‐of‐the‐art open-source speech processing models.
• It supports speech-to-text (using Whisper) and text-to-speech (via Kokoro modules) for conversing with large language models.
• The project supports multiple LLM providers (Ollama, OpenAI, Anthropic, and more) with configuration provided via a .env file.
• It can run either as a Docker container or natively, with separate pipelines in Rust (Kokoro and Whisper components) and JavaScript/TypeScript (the application server and frontend UI).
Analysis of the File Structure
• At the top level, files like index.ts, package.json, tsconfig.json, and public/ indicate a JavaScript/TypeScript application that serves a web interface.
• The public directory hosts assets for the browser (e.g., ui.html, wav-worker.js), representing the frontend.
• The Kokoro directory contains Rust code (with Cargo files and a src folder) divided into submodules:
– src/onn: Likely dealing with ONNX-based speech processing/model inference.
– src/tts: Modules for text-to-speech components (tokenization, normalization, phonemizer, vocab, etc.).
– src/utils: Utility functions (file I/O and WAV processing) supporting Kokoro’s functionalities.
• The Whisper directory is another Rust project (with its own Cargo files) designated for speech-to-text conversion.
• Dockerfile and other deployment scripts (setup-unix.sh, setup-win.bat) indicate built-in support for containerization and native deployments.