feat: add meeting transcription app scaffolding
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 48s
CI / Lint & Test (pull_request) Successful in 14m18s
CI / Build Linux (pull_request) Successful in 14m19s
CI / Build Windows (cross-compile) (pull_request) Failing after 19m39s

- Add Python backend structure with FastAPI for transcription/summarization
- Add React UI with audio recording, transcript, and summary views
- Configure Tauri to manage Python backend lifecycle
- Set up Windows cross-compilation with cargo-xwin
- Add Gitea CI workflow for lint, test, and multi-platform builds
- Configure ESLint, Prettier, and Vitest for code quality

Note: App scaffolding only - Python env and models not yet set up
This commit is contained in:
2026-01-21 20:18:03 -08:00
parent 96494a9997
commit 3c8a46e5a6
41 changed files with 2679 additions and 1797 deletions
-4
View File
@@ -1,4 +0,0 @@
[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"
ar = "x86_64-w64-mingw32-ar"
rustflags = ["-C", "link-arg=-lws2_32", "-C", "link-arg=-lbcrypt", "-C", "link-arg=-lole32", "-C", "link-arg=-luuid"]
+2 -3
View File
@@ -1,6 +1,6 @@
name: 🐛 Bug Report
description: Something isn't working as expected? Let us know!
title: '[BUG] - '
title: "[BUG] - "
labels:
- "status/awaiting triage"
body:
@@ -50,7 +50,7 @@ body:
description: The operating system you are using, including the version/build number.
validations:
required: true
# Remove this section for non-web apps.
# Remove this section for non-web apps.
- type: input
id: browser
attributes:
@@ -66,4 +66,3 @@ body:
- No
validations:
required: true
+1 -1
View File
@@ -2,4 +2,4 @@ blank_issues_enabled: false
contact_links:
- name: "Discord"
url: "https://chat.nhcarrigan.com"
about: "Chat with us directly."
about: "Chat with us directly."
+1 -1
View File
@@ -1,6 +1,6 @@
name: 💭 Feature Proposal
description: Have an idea for how we can improve? Share it here!
title: '[FEAT] - '
title: "[FEAT] - "
labels:
- "status/awaiting triage"
body:
+1 -1
View File
@@ -1,6 +1,6 @@
name: ❓ Other Issue
description: I have something that is neither a bug nor a feature request.
title: '[OTHER] - '
title: "[OTHER] - "
labels:
- "status/awaiting triage"
body:
+189
View File
@@ -0,0 +1,189 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
lint-and-test:
name: Lint & Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
librsvg2-dev \
patchelf \
libgtk-3-dev \
libayatana-appindicator3-dev
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install frontend dependencies
run: pnpm install
- name: Run ESLint
run: pnpm lint
- name: Run Prettier check
run: pnpm format:check
- name: Build frontend
run: pnpm build
- name: Run frontend tests
run: pnpm test
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run Clippy
working-directory: src-tauri
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run Rust tests
working-directory: src-tauri
run: cargo test
build-linux:
name: Build Linux
runs-on: ubuntu-latest
needs: lint-and-test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
librsvg2-dev \
patchelf \
libgtk-3-dev \
libayatana-appindicator3-dev \
xdg-utils
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install frontend dependencies
run: pnpm install
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build Linux
run: pnpm build:linux
build-windows:
name: Build Windows (cross-compile)
runs-on: ubuntu-latest
needs: lint-and-test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Linux dependencies for cross-compilation
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
librsvg2-dev \
patchelf \
libgtk-3-dev \
libayatana-appindicator3-dev \
clang \
lld \
llvm \
nsis
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install frontend dependencies
run: pnpm install
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- name: Install cargo-xwin
run: |
curl -fsSL https://github.com/rust-cross/cargo-xwin/releases/download/v0.20.2/cargo-xwin-v0.20.2.x86_64-unknown-linux-musl.tar.gz | tar xz
sudo mv cargo-xwin /usr/local/bin/
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-windows-${{ hashFiles('**/Cargo.lock') }}
- name: Build Windows
run: pnpm build:windows
+13 -13
View File
@@ -2,11 +2,11 @@ name: Security Scan and Upload
on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
schedule:
- cron: '0 0 * * 1'
- cron: "0 0 * * 1"
workflow_dispatch:
jobs:
@@ -24,18 +24,18 @@ jobs:
env:
DD_URL: ${{ secrets.DD_URL }}
DD_TOKEN: ${{ secrets.DD_TOKEN }}
PRODUCT_NAME: ${{ github.repository }}
PRODUCT_TYPE_ID: 1
PRODUCT_NAME: ${{ github.repository }}
PRODUCT_TYPE_ID: 1
run: |
sudo apt-get install jq -y > /dev/null
echo "Checking connection to $DD_URL..."
# Check if product exists - capture HTTP code to debug connection issues
RESPONSE=$(curl --write-out "%{http_code}" --silent --output /tmp/response.json \
-H "Authorization: Token $DD_TOKEN" \
"$DD_URL/api/v2/products/?name=$PRODUCT_NAME")
# If response is not 200, print error
if [ "$RESPONSE" != "200" ]; then
echo "::error::Failed to query DefectDojo. HTTP Code: $RESPONSE"
@@ -44,7 +44,7 @@ jobs:
fi
COUNT=$(cat /tmp/response.json | jq -r '.count')
if [ "$COUNT" = "0" ]; then
echo "Creating product '$PRODUCT_NAME'..."
curl -s -X POST "$DD_URL/api/v2/products/" \
@@ -75,7 +75,7 @@ jobs:
echo "Uploading Trivy results..."
# Generate today's date in YYYY-MM-DD format
TODAY=$(date +%Y-%m-%d)
HTTP_CODE=$(curl --write-out "%{http_code}" --output response.txt --silent -X POST "$DD_URL/api/v2/import-scan/" \
-H "Authorization: Token $DD_TOKEN" \
-F "active=true" \
@@ -86,7 +86,7 @@ jobs:
-F "scan_date=$TODAY" \
-F "auto_create_context=true" \
-F "file=@trivy-results.json")
if [[ "$HTTP_CODE" != "200" && "$HTTP_CODE" != "201" ]]; then
echo "::error::Upload Failed with HTTP $HTTP_CODE"
echo "--- SERVER RESPONSE ---"
@@ -154,7 +154,7 @@ jobs:
run: |
echo "Uploading Semgrep results..."
TODAY=$(date +%Y-%m-%d)
HTTP_CODE=$(curl --write-out "%{http_code}" --output response.txt --silent -X POST "$DD_URL/api/v2/import-scan/" \
-H "Authorization: Token $DD_TOKEN" \
-F "active=true" \
@@ -174,4 +174,4 @@ jobs:
exit 1
else
echo "Upload Success!"
fi
fi
+30
View File
@@ -22,3 +22,33 @@ dist-ssr
*.njsproj
*.sln
*.sw?
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
env/
venv/
ENV/
.venv/
*.egg-info/
# Models (we'll add these to git lfs later)
models/*.gguf
models/*.bin
# Tauri
src-tauri/target/
src-tauri/WixTools/
# App data
recordings/
transcripts/
summaries/
# Environment
.env
*.env.local
prod.env
+8
View File
@@ -0,0 +1,8 @@
build/
.svelte-kit/
dist/
src-tauri/target/
src-tauri/gen/
node_modules/
.pnpm-store/
pnpm-lock.yaml
+7
View File
@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"printWidth": 100
}
+120
View File
@@ -0,0 +1,120 @@
# Chronara - Local Meeting Transcription & Summarization
A Windows desktop application that transcribes, diarizes, and summarizes meetings using only locally-running models.
## Features
- 🎙️ Real-time audio transcription with speaker diarization (WhisperX)
- 📝 Intelligent meeting summarization (Llama 3.2)
- 🖥️ Everything runs locally - no cloud services required
- 📦 All models bundled - no separate downloads needed
## Tech Stack
- **Transcription**: WhisperX (Whisper + speaker diarization)
- **Summarization**: Llama 3.2 1B/3B
- **Backend**: Python with FastAPI
- **Frontend**: Tauri + React
- **Model Runtime**: llama-cpp-python
## Project Structure
```
chronara/
├── src/
│ ├── backend/ # Python FastAPI backend
│ ├── components/ # React components
│ └── App.tsx # Main React app
├── src-tauri/ # Tauri configuration
├── models/ # Bundled model files
├── scripts/ # Build and setup scripts
└── assets/ # Icons, resources
```
## Development Setup
### Prerequisites
- Node.js 18+ with pnpm
- Python 3.10+
- Rust (for Tauri)
- Windows build tools (for native modules)
### Installation
1. Clone the repository:
```bash
git clone https://github.com/naomi-lgbt/chronara.git
cd chronara
```
2. Install frontend dependencies:
```bash
pnpm install
```
3. Install Python dependencies:
```bash
pip install -r requirements.txt
```
4. Download the AI models:
```bash
python scripts/download_models.py
```
5. Run in development mode:
```bash
pnpm tauri:dev
```
## Building for Production
### Windows
1. Download models if not already done:
```bash
python scripts/download_models.py
```
2. Build the Windows executable:
```bash
python scripts/build_windows.py
```
The installer will be created in `src-tauri/target/release/bundle/nsis/`.
## Usage
1. **Start Recording**: Click the "Start Recording" button to begin capturing audio
2. **Real-time Transcription**: Watch as the conversation is transcribed with speaker labels
3. **Generate Summary**: After recording, click "Generate Summary" for an AI-powered meeting summary
4. **Export**: Download both the full transcript and summary as text files
## Model Information
### Transcription (WhisperX)
- **Model**: OpenAI Whisper base model with WhisperX enhancements
- **Features**: Speaker diarization, timestamp alignment
- **Size**: ~150MB
### Summarization (Llama 3.2)
- **1B Model**: Fast, good for basic summaries (~1.2GB)
- **3B Model**: Better quality summaries (~2.5GB)
- **Format**: GGUF quantized models
## Privacy & Security
- All processing happens locally on your machine
- No audio or text data is sent to external servers
- Models are bundled with the application
- Meeting data stays on your device
+1 -1
View File
@@ -26,4 +26,4 @@ Copyright held by Naomi Carrigan.
## Contact
We may be contacted through our [Chat Server](http://chat.nhcarrigan.com) or via email at `contact@nhcarrigan.com`.
We may be contacted through our [Chat Server](http://chat.nhcarrigan.com) or via email at `contact@nhcarrigan.com`.
-89
View File
@@ -1,89 +0,0 @@
#!/bin/bash
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}🚀 Building Chronara for all platforms...${NC}"
# Function to run a build and check its status
run_build() {
local target=$1
local desc=$2
echo -e "\n${YELLOW}Building: ${desc}${NC}"
if pnpm tauri build --target "$target"; then
echo -e "${GREEN}${desc} build succeeded${NC}"
return 0
else
echo -e "${RED}${desc} build failed${NC}"
return 1
fi
}
# Ensure we're using the correct Node version
source /home/naomi/.nvm/nvm.sh
nvm use 24.11.1
# Install dependencies if needed
echo -e "${YELLOW}Installing dependencies...${NC}"
pnpm install
# Build frontend first
echo -e "${YELLOW}Building frontend...${NC}"
pnpm build
# Track if any builds fail
failed=0
# Linux builds (native in WSL)
echo -e "\n${BLUE}Building Linux targets...${NC}"
run_build "x86_64-unknown-linux-gnu" "Linux AppImage/Deb/RPM" || failed=1
# Windows build (cross-compile from WSL)
echo -e "\n${BLUE}Building Windows target...${NC}"
# Check if Windows target is installed
if ! rustup target list --installed | grep -q "x86_64-pc-windows-gnu"; then
echo -e "${YELLOW}Installing Windows target...${NC}"
rustup target add x86_64-pc-windows-gnu
fi
# Check if full mingw-w64 toolchain is installed
if ! command -v x86_64-w64-mingw32-gcc &> /dev/null || ! command -v x86_64-w64-mingw32-dlltool &> /dev/null; then
echo -e "${RED}Windows cross-compilation tools are missing!${NC}"
echo -e "${YELLOW}Please install the full mingw-w64 toolchain:${NC}"
echo -e "${YELLOW} sudo apt-get update${NC}"
echo -e "${YELLOW} sudo apt-get install -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 mingw-w64-tools${NC}"
echo -e "${RED}Skipping Windows build...${NC}"
SKIP_WINDOWS=1
fi
# Set up environment for Windows cross-compilation
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="x86_64-w64-mingw32-gcc"
export CC_x86_64_pc_windows_gnu="x86_64-w64-mingw32-gcc"
export CXX_x86_64_pc_windows_gnu="x86_64-w64-mingw32-g++"
export AR_x86_64_pc_windows_gnu="x86_64-w64-mingw32-ar"
if [ -z "$SKIP_WINDOWS" ]; then
run_build "x86_64-pc-windows-gnu" "Windows NSIS" || failed=1
fi
# Summary
echo -e "\n${YELLOW}========================================${NC}"
if [ $failed -eq 0 ]; then
echo -e "${GREEN}✨ All builds completed successfully!${NC}"
echo -e "${GREEN}Build outputs:${NC}"
echo -e "${GREEN} Linux: src-tauri/target/release/bundle/appimage/chronara_*.AppImage${NC}"
echo -e "${GREEN} Linux: src-tauri/target/release/bundle/deb/chronara_*.deb${NC}"
echo -e "${GREEN} Linux: src-tauri/target/release/bundle/rpm/chronara-*.rpm${NC}"
echo -e "${GREEN} Windows: src-tauri/target/x86_64-pc-windows-gnu/release/bundle/nsis/Chronara_*.exe${NC}"
exit 0
else
echo -e "${RED}❌ Some builds failed. Check the output above for details.${NC}"
exit 1
fi
Executable
+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
set -e
echo "🔍 Running all checks..."
echo "========================================"
echo ""
echo "📦 Installing dependencies..."
pnpm install
echo ""
echo "🔎 Running ESLint..."
pnpm lint
echo ""
echo "💅 Running Prettier check..."
pnpm format:check
echo ""
echo "🏗️ Building frontend..."
pnpm build
echo ""
echo "🧪 Running frontend tests..."
pnpm test
echo ""
echo "🦀 Running Clippy..."
cd src-tauri
cargo clippy --all-targets --all-features -- -D warnings
echo ""
echo "🧪 Running Rust tests..."
cargo test
cd ..
echo ""
echo "========================================"
echo "✅ All checks passed!"
+33 -2
View File
@@ -1,3 +1,34 @@
import nhcarriganConfig from "@nhcarrigan/eslint-config";
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import prettier from "eslint-config-prettier";
import globals from "globals";
export default [...nhcarriganConfig];
export default tseslint.config(
js.configs.recommended,
...tseslint.configs.recommended,
prettier,
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
},
{
files: ["**/*.{ts,tsx}"],
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
},
},
{
ignores: ["build/", "dist/", "src-tauri/target/", "node_modules/"],
}
);
+22 -6
View File
@@ -7,11 +7,18 @@
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier --write .",
"format:check": "prettier --check .",
"preview": "vite preview",
"tauri": "tauri",
"tauri:dev": "tauri dev",
"tauri:build": "tauri build",
"build:all": "./build-all.sh"
"build:linux": "tauri build",
"build:windows": "tauri build --runner cargo-xwin --target x86_64-pc-windows-msvc",
"build:all": "pnpm build:linux && pnpm build:windows",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage"
},
"dependencies": {
"@tauri-apps/api": "^2",
@@ -20,14 +27,23 @@
"react-dom": "^19.1.0"
},
"devDependencies": {
"@nhcarrigan/eslint-config": "2.0.0",
"@nhcarrigan/typescript-config": "4.0.0",
"@eslint/js": "^9.19.0",
"@tauri-apps/cli": "^2",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.0",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@vitejs/plugin-react": "^4.6.0",
"eslint": "9.19.0",
"eslint": "^9.19.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "^17.0.0",
"jsdom": "^27.4.0",
"prettier": "^3.8.0",
"typescript": "~5.8.3",
"vite": "^7.0.4"
"typescript-eslint": "^8.53.0",
"vite": "^7.0.4",
"vitest": "^4.0.17"
}
}
+880 -1536
View File
File diff suppressed because it is too large Load Diff
+27
View File
@@ -0,0 +1,27 @@
[project]
name = "chronara"
version = "0.1.0"
description = "Local meeting transcription and summarization app"
requires-python = ">=3.10"
dependencies = [
"fastapi==0.115.6",
"uvicorn==0.34.0",
"whisperx==3.1.6",
"llama-cpp-python==0.3.4",
"pyaudio==0.2.14",
"numpy==1.26.4",
"torch==2.5.1",
"pydantic==2.10.4",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.ruff]
line-length = 100
target-version = "py310"
[tool.ruff.lint]
select = ["E", "F", "I", "N", "W", "B", "C90", "D"]
ignore = ["D100", "D101", "D102", "D103", "D104", "D105", "D106", "D107"]
+10
View File
@@ -0,0 +1,10 @@
fastapi==0.115.6
uvicorn==0.134.0
whisperx==3.1.6
llama-cpp-python==0.3.4
pyaudio==0.2.14
numpy==1.26.4
torch==2.5.1
pydantic==2.10.4
python-multipart==0.0.18
websockets==14.1
+128
View File
@@ -0,0 +1,128 @@
"""Build script to create a Windows executable with bundled Python environment.
This script should be run ON WINDOWS, not cross-compiled from Linux.
"""
import shutil
import subprocess
import sys
from pathlib import Path
def main():
"""Create a Windows executable bundle for Chronara."""
project_root = Path(__file__).parent.parent
dist_dir = project_root / "dist-bundle"
print("🔨 Chronara Windows Build Script")
print("=" * 50)
print("\n⚠️ NOTE: This script must be run on Windows!")
print(" Cross-compilation from Linux is not supported.\n")
if sys.platform != "win32":
print("❌ This script must be run on Windows.")
print(" Please run this on a Windows machine or in a Windows VM.")
sys.exit(1)
# Clean previous builds
if dist_dir.exists():
print("Cleaning previous build...")
shutil.rmtree(dist_dir)
dist_dir.mkdir(exist_ok=True)
# Step 1: Create Python bundle using PyInstaller
print("\n📦 Creating Python bundle...")
# Create a temporary spec file for PyInstaller
spec_content = f"""
# -*- mode: python ; coding: utf-8 -*-
a = Analysis(
['{project_root / "src" / "backend" / "main.py"}'],
pathex=['{project_root / "src"}'],
binaries=[],
datas=[
('{project_root / "models" / "*.gguf"}', 'models'),
],
hiddenimports=['uvicorn', 'fastapi', 'whisperx', 'llama_cpp'],
hookspath=[],
hooksconfig={{}},
runtime_hooks=[],
excludes=[],
noarchive=False,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='chronara-backend',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
"""
spec_path = project_root / "chronara-backend.spec"
spec_path.write_text(spec_content)
try:
subprocess.run([
sys.executable,
"-m",
"PyInstaller",
str(spec_path),
"--clean",
"--noconfirm",
"--distpath", str(dist_dir / "backend")
], check=True)
except subprocess.CalledProcessError:
print("⚠️ PyInstaller not found. Installing...")
subprocess.run([sys.executable, "-m", "pip", "install", "pyinstaller"], check=True)
subprocess.run([
sys.executable,
"-m",
"PyInstaller",
str(spec_path),
"--clean",
"--noconfirm",
"--distpath", str(dist_dir / "backend")
], check=True)
# Clean up spec file
spec_path.unlink()
# Step 2: Build Tauri app (creates NSIS installer on Windows)
print("\n🦀 Building Tauri app with NSIS installer...")
subprocess.run(
"pnpm tauri build",
cwd=project_root,
check=True,
shell=True
)
print("\n✅ Build complete!")
print("\nWindows installer (.exe) location:")
print(" src-tauri/target/release/bundle/nsis/Chronara_0.1.0_x64_en-US.exe")
print("\nThis installer includes:")
print(" - Tauri app with React frontend")
print(" - Python backend (bundled)")
print(" - Llama model files")
print(" - All dependencies")
if __name__ == "__main__":
main()
+90
View File
@@ -0,0 +1,90 @@
"""Download required models for Chronara."""
import os
import sys
from pathlib import Path
from urllib.request import urlretrieve
# Model download URLs
MODELS = {
"llama-3.2-1B": {
"url": "https://huggingface.co/bartowski/Llama-3.2-1B-Instruct-GGUF/resolve/main/Llama-3.2-1B-Instruct-Q4_K_M.gguf",
"filename": "llama-3.2-1B-instruct-Q4_K_M.gguf",
"size": "1.2GB",
},
"llama-3.2-3B": {
"url": "https://huggingface.co/bartowski/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf",
"filename": "llama-3.2-3B-instruct-Q4_K_M.gguf",
"size": "2.5GB",
},
}
def download_with_progress(url: str, filepath: Path):
"""Download file with progress bar."""
def _progress(block_num, block_size, total_size):
downloaded = block_num * block_size
percent = min(downloaded * 100 / total_size, 100)
progress = int(50 * percent / 100)
sys.stdout.write(
f"\r[{'=' * progress}{' ' * (50 - progress)}] {percent:.1f}%"
)
sys.stdout.flush()
print(f"Downloading {filepath.name}...")
urlretrieve(url, filepath, reporthook=_progress)
print() # New line after progress bar
def main():
"""Download all required models."""
# Get project root
project_root = Path(__file__).parent.parent
models_dir = project_root / "models"
models_dir.mkdir(exist_ok=True)
print("🤖 Chronara Model Downloader")
print("=" * 50)
# Ask which model to download
print("\nWhich Llama model would you like to use?")
print("1. Llama 3.2 1B (1.2GB) - Faster, good for basic summaries")
print("2. Llama 3.2 3B (2.5GB) - Better quality summaries")
print("3. Both models")
choice = input("\nEnter your choice (1/2/3): ").strip()
models_to_download = []
if choice == "1":
models_to_download = ["llama-3.2-1B"]
elif choice == "2":
models_to_download = ["llama-3.2-3B"]
elif choice == "3":
models_to_download = ["llama-3.2-1B", "llama-3.2-3B"]
else:
print("Invalid choice!")
return
# Download selected models
for model_name in models_to_download:
model_info = MODELS[model_name]
filepath = models_dir / model_info["filename"]
if filepath.exists():
print(f"\n{model_name} already downloaded")
continue
print(f"\n📥 Downloading {model_name} ({model_info['size']})...")
try:
download_with_progress(model_info["url"], filepath)
print(f"✓ Downloaded {model_name} successfully!")
except Exception as e:
print(f"✗ Failed to download {model_name}: {e}")
print("\n✨ Model download complete!")
print("\nNote: WhisperX models will be downloaded automatically on first run.")
if __name__ == "__main__":
main()
+24
View File
@@ -0,0 +1,24 @@
"""Start the Chronara backend server."""
import os
import sys
import subprocess
from pathlib import Path
# Add src directory to Python path
src_path = Path(__file__).parent.parent / "src"
sys.path.insert(0, str(src_path))
# Set environment for bundled deployment
os.environ["CHRONARA_BUNDLED"] = "1"
# Start the FastAPI server
subprocess.run([
sys.executable,
"-m",
"uvicorn",
"backend.main:app",
"--host", "127.0.0.1",
"--port", "8000",
"--reload" if os.environ.get("CHRONARA_DEV") else ""
])
+1 -4
View File
@@ -3,8 +3,5 @@
"identifier": "default",
"description": "Capability for the main window",
"windows": ["main"],
"permissions": [
"core:default",
"opener:default"
]
"permissions": ["core:default", "opener:default"]
}
+58 -4
View File
@@ -1,14 +1,68 @@
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
use std::process::{Child, Command};
use std::sync::Mutex;
use tauri::{Manager, State};
struct PythonBackend {
process: Mutex<Option<Child>>,
}
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
fn start_backend(backend: State<PythonBackend>) -> Result<String, String> {
let mut process_lock = backend.process.lock().map_err(|e| e.to_string())?;
if process_lock.is_some() {
return Ok("Backend already running".to_string());
}
// Get the resource path for the bundled Python executable
let python_cmd = if cfg!(windows) {
"python"
} else {
"python3"
};
// Start the Python backend
let child = Command::new(python_cmd)
.args(["-m", "uvicorn", "backend.main:app", "--host", "127.0.0.1", "--port", "8000"])
.spawn()
.map_err(|e| format!("Failed to start backend: {}", e))?;
*process_lock = Some(child);
Ok("Backend started successfully".to_string())
}
#[tauri::command]
fn stop_backend(backend: State<PythonBackend>) -> Result<String, String> {
let mut process_lock = backend.process.lock().map_err(|e| e.to_string())?;
if let Some(mut child) = process_lock.take() {
child.kill().map_err(|e| format!("Failed to stop backend: {}", e))?;
Ok("Backend stopped".to_string())
} else {
Ok("Backend not running".to_string())
}
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
.invoke_handler(tauri::generate_handler![greet])
.manage(PythonBackend {
process: Mutex::new(None),
})
.invoke_handler(tauri::generate_handler![start_backend, stop_backend])
.on_window_event(|window, event| {
// Stop backend when window closes
if let tauri::WindowEvent::CloseRequested { .. } = event {
if let Some(backend) = window.try_state::<PythonBackend>() {
if let Ok(mut process_lock) = backend.process.lock() {
if let Some(mut child) = process_lock.take() {
let _ = child.kill();
}
}
}
}
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
+6 -15
View File
@@ -12,9 +12,11 @@
"app": {
"windows": [
{
"title": "Chronara",
"width": 800,
"height": 600
"title": "Chronara - Meeting Transcription",
"width": 1200,
"height": 800,
"minWidth": 800,
"minHeight": 600
}
],
"security": {
@@ -23,23 +25,12 @@
},
"bundle": {
"active": true,
"targets": ["app", "deb", "rpm", "appimage", "nsis"],
"targets": ["nsis"],
"publisher": "NHCarrigan",
"copyright": "Copyright © 2026 Naomi Carrigan",
"category": "Productivity",
"shortDescription": "Meeting transcription and summarization tool using local AI models",
"longDescription": "Chronara provides real-time meeting transcription with speaker diarization and AI-powered summaries, all processed locally for maximum privacy.",
"linux": {
"deb": {
"depends": []
},
"rpm": {
"release": "1"
},
"appimage": {
"bundleMediaFramework": true
}
},
"windows": {
"nsis": {}
},
+304 -76
View File
@@ -1,116 +1,344 @@
.logo.vite:hover {
filter: drop-shadow(0 0 2em #747bff);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafb);
}
:root {
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
font-size: 16px;
line-height: 24px;
line-height: 1.5;
font-weight: 400;
color: #0f0f0f;
background-color: #f6f6f6;
--primary-color: #3b82f6;
--primary-hover: #2563eb;
--secondary-color: #10b981;
--danger-color: #ef4444;
--bg-color: #ffffff;
--surface-color: #f9fafb;
--text-color: #111827;
--text-secondary: #6b7280;
--border-color: #e5e7eb;
--shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
color: var(--text-color);
background-color: var(--bg-color);
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
margin: 0;
min-height: 100vh;
}
.container {
margin: 0;
padding-top: 10vh;
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
min-height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
}
/* Header */
.app-header {
text-align: center;
margin-bottom: 2rem;
}
.app-header h1 {
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 0.5rem;
}
.app-header p {
color: var(--text-secondary);
font-size: 1.125rem;
}
/* Warning Banner */
.warning-banner {
background-color: #fef3c7;
color: #92400e;
padding: 1rem;
border-radius: 0.5rem;
margin-bottom: 2rem;
text-align: center;
}
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: 0.75s;
}
.logo.tauri:hover {
filter: drop-shadow(0 0 2em #24c8db);
}
.row {
/* App Content */
.app-content {
flex: 1;
display: flex;
justify-content: center;
flex-direction: column;
gap: 2rem;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
/* Controls Section */
.controls-section {
display: flex;
flex-direction: column;
align-items: center;
gap: 1.5rem;
}
a:hover {
color: #535bf2;
/* Audio Recorder */
.audio-recorder {
display: flex;
flex-direction: column;
align-items: center;
gap: 1rem;
}
h1 {
text-align: center;
}
input,
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
color: #0f0f0f;
background-color: #ffffff;
transition: border-color 0.25s;
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
}
button {
.record-button {
font-size: 1.25rem;
padding: 1rem 2rem;
border-radius: 0.75rem;
border: 2px solid transparent;
background-color: var(--primary-color);
color: white;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
box-shadow: var(--shadow);
}
button:hover {
border-color: #396cd8;
}
button:active {
border-color: #396cd8;
background-color: #e8e8e8;
.record-button:hover {
background-color: var(--primary-hover);
transform: translateY(-2px);
box-shadow:
0 4px 6px -1px rgba(0, 0, 0, 0.1),
0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
input,
button {
outline: none;
.record-button.recording {
background-color: var(--danger-color);
}
#greet-input {
margin-right: 5px;
.record-button.recording:hover {
background-color: #dc2626;
}
.recording-indicator {
display: flex;
align-items: center;
gap: 0.5rem;
color: var(--danger-color);
font-weight: 500;
}
.pulse {
width: 0.75rem;
height: 0.75rem;
background-color: var(--danger-color);
border-radius: 50%;
animation: pulse 1.5s infinite;
}
@keyframes pulse {
0% {
opacity: 1;
transform: scale(1);
}
50% {
opacity: 0.5;
transform: scale(1.2);
}
100% {
opacity: 1;
transform: scale(1);
}
}
/* Action Buttons */
.action-buttons {
display: flex;
gap: 1rem;
}
.primary-button,
.secondary-button {
padding: 0.75rem 1.5rem;
border-radius: 0.5rem;
border: none;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
box-shadow: var(--shadow);
}
.primary-button {
background-color: var(--secondary-color);
color: white;
}
.primary-button:hover:not(:disabled) {
background-color: #059669;
transform: translateY(-1px);
}
.primary-button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.secondary-button {
background-color: var(--surface-color);
color: var(--text-color);
border: 1px solid var(--border-color);
}
.secondary-button:hover {
background-color: var(--border-color);
}
/* Content Grid */
.content-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 2rem;
flex: 1;
}
@media (max-width: 768px) {
.content-grid {
grid-template-columns: 1fr;
}
}
/* Transcript Display */
.transcript-display,
.summary-display {
background-color: var(--surface-color);
border: 1px solid var(--border-color);
border-radius: 0.75rem;
padding: 1.5rem;
display: flex;
flex-direction: column;
max-height: 600px;
}
.transcript-display h2,
.summary-display h2 {
font-size: 1.25rem;
font-weight: 600;
margin-bottom: 1rem;
}
.transcript-segments,
.summary-content {
flex: 1;
overflow-y: auto;
}
.empty-state {
color: var(--text-secondary);
text-align: center;
padding: 2rem;
}
.segment {
margin-bottom: 1rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--border-color);
}
.segment:last-child {
border-bottom: none;
}
.segment-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.5rem;
}
.speaker {
font-weight: 600;
font-size: 0.875rem;
}
.timestamp {
font-size: 0.75rem;
color: var(--text-secondary);
}
.segment-text {
line-height: 1.6;
}
/* Summary Display */
.summary-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
}
.download-button {
padding: 0.5rem 1rem;
border-radius: 0.375rem;
border: 1px solid var(--border-color);
background-color: var(--bg-color);
font-size: 0.875rem;
cursor: pointer;
transition: all 0.2s;
}
.download-button:hover {
background-color: var(--surface-color);
}
.summary-text {
white-space: pre-wrap;
line-height: 1.6;
}
/* Loading */
.loading {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 3rem;
gap: 1rem;
}
.spinner {
width: 3rem;
height: 3rem;
border: 3px solid var(--border-color);
border-top-color: var(--primary-color);
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
/* Dark Mode */
@media (prefers-color-scheme: dark) {
:root {
color: #f6f6f6;
background-color: #2f2f2f;
--bg-color: #111827;
--surface-color: #1f2937;
--text-color: #f3f4f6;
--text-secondary: #9ca3af;
--border-color: #374151;
--shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
}
a:hover {
color: #24c8db;
}
input,
button {
color: #ffffff;
background-color: #0f0f0f98;
}
button:active {
background-color: #0f0f0f69;
.warning-banner {
background-color: #451a03;
color: #fbbf24;
}
}
+174 -36
View File
@@ -1,49 +1,187 @@
import { useState } from "react";
import reactLogo from "./assets/react.svg";
import { useState, useEffect, useRef } from "react";
import { invoke } from "@tauri-apps/api/core";
import "./App.css";
import { AudioRecorder } from "./components/AudioRecorder";
import { TranscriptDisplay } from "./components/TranscriptDisplay";
import { SummaryDisplay } from "./components/SummaryDisplay";
interface TranscriptSegment {
start: number;
end: number;
text: string;
speaker: string;
}
function App() {
const [greetMsg, setGreetMsg] = useState("");
const [name, setName] = useState("");
const [isRecording, setIsRecording] = useState(false);
const [transcriptSegments, setTranscriptSegments] = useState<TranscriptSegment[]>([]);
const [summary, setSummary] = useState<string | null>(null);
const [isGeneratingSummary, setIsGeneratingSummary] = useState(false);
const [backendReady, setBackendReady] = useState(false);
const wsRef = useRef<WebSocket | null>(null);
async function greet() {
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
setGreetMsg(await invoke("greet", { name }));
}
useEffect(() => {
// Start Python backend through Tauri
startPythonBackend();
}, []);
const startPythonBackend = async () => {
try {
// Start backend through Tauri command
await invoke("start_backend");
// Give backend time to start up
setTimeout(() => {
checkBackendHealth();
}, 2000);
} catch (error) {
console.error("Failed to start backend:", error);
}
};
const checkBackendHealth = async () => {
try {
const response = await fetch("http://localhost:8000/health");
if (response.ok) {
setBackendReady(true);
}
} catch (error) {
console.error("Backend not ready:", error);
// In production, Tauri will start the backend automatically
}
};
const handleAudioData = (audioData: ArrayBuffer) => {
if (!wsRef.current || wsRef.current.readyState !== WebSocket.OPEN) {
// Create WebSocket connection
wsRef.current = new WebSocket("ws://localhost:8000/ws/transcribe");
wsRef.current.onopen = () => {
console.log("WebSocket connected");
// Send the audio data
wsRef.current?.send(audioData);
};
wsRef.current.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.type === "transcription" && data.data.segments) {
setTranscriptSegments((prev) => [...prev, ...data.data.segments]);
}
};
wsRef.current.onclose = () => {
console.log("WebSocket disconnected");
};
} else {
// Send audio data through existing connection
wsRef.current.send(audioData);
}
};
const generateSummary = async () => {
if (transcriptSegments.length === 0) return;
setIsGeneratingSummary(true);
// Combine all transcript segments into text
const fullTranscript = transcriptSegments
.map((seg) => `${seg.speaker}: ${seg.text}`)
.join("\n");
try {
const response = await fetch("http://localhost:8000/summarize", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ transcript: fullTranscript }),
});
const data = await response.json();
setSummary(data.summary);
} catch (error) {
console.error("Failed to generate summary:", error);
} finally {
setIsGeneratingSummary(false);
}
};
const downloadTranscript = () => {
const content = transcriptSegments
.map((seg) => `[${formatTime(seg.start)}] ${seg.speaker}: ${seg.text}`)
.join("\n");
const blob = new Blob([content], { type: "text/plain" });
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = `meeting-transcript-${new Date().toISOString().split("T")[0]}.txt`;
a.click();
URL.revokeObjectURL(url);
};
const downloadSummary = () => {
if (!summary) return;
const blob = new Blob([summary], { type: "text/plain" });
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = `meeting-summary-${new Date().toISOString().split("T")[0]}.txt`;
a.click();
URL.revokeObjectURL(url);
};
const formatTime = (seconds: number) => {
const mins = Math.floor(seconds / 60);
const secs = Math.floor(seconds % 60);
return `${mins}:${secs.toString().padStart(2, "0")}`;
};
return (
<main className="container">
<h1>Welcome to Tauri + React</h1>
<header className="app-header">
<h1>🎙 Chronara</h1>
<p>Local Meeting Transcription & Summarization</p>
</header>
<div className="row">
<a href="https://vite.dev" target="_blank">
<img src="/vite.svg" className="logo vite" alt="Vite logo" />
</a>
<a href="https://tauri.app" target="_blank">
<img src="/tauri.svg" className="logo tauri" alt="Tauri logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
{!backendReady && (
<div className="warning-banner"> Backend is starting up. This may take a moment...</div>
)}
<div className="app-content">
<section className="controls-section">
<AudioRecorder
onAudioData={handleAudioData}
isRecording={isRecording}
setIsRecording={setIsRecording}
/>
{!isRecording && transcriptSegments.length > 0 && (
<div className="action-buttons">
<button className="secondary-button" onClick={downloadTranscript}>
📄 Download Transcript
</button>
<button
className="primary-button"
onClick={generateSummary}
disabled={isGeneratingSummary}
>
Generate Summary
</button>
</div>
)}
</section>
<div className="content-grid">
<TranscriptDisplay segments={transcriptSegments} />
<SummaryDisplay
summary={summary}
isLoading={isGeneratingSummary}
onDownload={downloadSummary}
/>
</div>
</div>
<p>Click on the Tauri, Vite, and React logos to learn more.</p>
<form
className="row"
onSubmit={(e) => {
e.preventDefault();
greet();
}}
>
<input
id="greet-input"
onChange={(e) => setName(e.currentTarget.value)}
placeholder="Enter a name..."
/>
<button type="submit">Greet</button>
</form>
<p>{greetMsg}</p>
</main>
);
}
+7
View File
@@ -0,0 +1,7 @@
import { describe, it, expect } from "vitest";
describe("App", () => {
it("placeholder test", () => {
expect(true).toBe(true);
});
});
+1
View File
@@ -0,0 +1 @@
"""Chronara backend - Local meeting transcription and summarization."""
+74
View File
@@ -0,0 +1,74 @@
"""Main FastAPI application for Chronara."""
import os
from pathlib import Path
from fastapi import FastAPI, WebSocket
from fastapi.middleware.cors import CORSMiddleware
from .models.audio import AudioProcessor
from .models.llm import LlamaSummarizer
from .models.transcriber import WhisperXTranscriber
app = FastAPI(title="Chronara API", version="0.1.0")
# Enable CORS for Tauri frontend
app.add_middleware(
CORSMiddleware,
allow_origins=["tauri://localhost", "http://localhost:*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Initialize models
MODEL_DIR = Path(__file__).parent.parent.parent / "models"
transcriber = WhisperXTranscriber(model_dir=MODEL_DIR)
summarizer = LlamaSummarizer(model_dir=MODEL_DIR)
audio_processor = AudioProcessor()
@app.get("/health")
async def health_check():
"""Check if the API is running and models are loaded."""
return {
"status": "healthy",
"models": {
"whisper": transcriber.is_loaded,
"llama": summarizer.is_loaded,
},
}
@app.websocket("/ws/transcribe")
async def transcribe_audio(websocket: WebSocket):
"""WebSocket endpoint for real-time audio transcription."""
await websocket.accept()
try:
while True:
# Receive audio chunk
audio_data = await websocket.receive_bytes()
# Process audio
audio_chunk = audio_processor.process_chunk(audio_data)
# Transcribe if we have enough audio
if audio_processor.has_speech(audio_chunk):
result = await transcriber.transcribe_chunk(audio_chunk)
if result:
await websocket.send_json({
"type": "transcription",
"data": result,
})
except Exception as e:
await websocket.close(code=1000, reason=str(e))
@app.post("/summarize")
async def summarize_transcript(transcript: str):
"""Summarize a meeting transcript."""
summary = await summarizer.summarize(transcript)
return {"summary": summary}
+1
View File
@@ -0,0 +1 @@
"""Model modules for Chronara."""
+73
View File
@@ -0,0 +1,73 @@
"""Audio processing utilities."""
import io
import wave
from typing import Optional
import numpy as np
import pyaudio
class AudioProcessor:
"""Handles audio capture and processing."""
def __init__(self, sample_rate: int = 16000, channels: int = 1):
"""Initialize audio processor."""
self.sample_rate = sample_rate
self.channels = channels
self.chunk_size = 1024
self.format = pyaudio.paInt16
# Initialize PyAudio
self.audio = pyaudio.PyAudio()
# Audio buffer for accumulating chunks
self.buffer = []
self.min_speech_duration = 0.5 # seconds
def start_recording(self) -> pyaudio.Stream:
"""Start audio recording stream."""
stream = self.audio.open(
format=self.format,
channels=self.channels,
rate=self.sample_rate,
input=True,
frames_per_buffer=self.chunk_size,
)
return stream
def stop_recording(self, stream: pyaudio.Stream) -> None:
"""Stop audio recording."""
stream.stop_stream()
stream.close()
def process_chunk(self, audio_bytes: bytes) -> np.ndarray:
"""Convert audio bytes to numpy array."""
# Convert bytes to numpy array
audio_array = np.frombuffer(audio_bytes, dtype=np.int16)
# Normalize to [-1, 1]
audio_float = audio_array.astype(np.float32) / 32768.0
return audio_float
def has_speech(self, audio_chunk: np.ndarray, energy_threshold: float = 0.01) -> bool:
"""Simple voice activity detection based on energy."""
# Calculate RMS energy
energy = np.sqrt(np.mean(audio_chunk**2))
# Check if energy exceeds threshold
return energy > energy_threshold
def save_audio(self, audio_data: bytes, filepath: str) -> None:
"""Save audio data to WAV file."""
with wave.open(filepath, "wb") as wf:
wf.setnchannels(self.channels)
wf.setsampwidth(self.audio.get_sample_size(self.format))
wf.setframerate(self.sample_rate)
wf.writeframes(audio_data)
def __del__(self):
"""Cleanup PyAudio."""
if hasattr(self, "audio"):
self.audio.terminate()
+67
View File
@@ -0,0 +1,67 @@
"""Local LLM for meeting summarization using Llama."""
from pathlib import Path
from typing import Optional
from llama_cpp import Llama
class LlamaSummarizer:
"""Handles meeting summarization using local Llama model."""
def __init__(self, model_dir: Path, model_size: str = "1B"):
"""Initialize Llama model."""
self.model_dir = model_dir
self.is_loaded = False
model_path = model_dir / f"llama-3.2-{model_size}-instruct-Q4_K_M.gguf"
try:
self.llm = Llama(
model_path=str(model_path),
n_ctx=8192, # Context window
n_threads=4, # CPU threads
n_gpu_layers=-1, # Use GPU if available
verbose=False,
)
self.is_loaded = True
except Exception as e:
print(f"Failed to load Llama model: {e}")
self.is_loaded = False
async def summarize(self, transcript: str) -> Optional[str]:
"""Generate a meeting summary from transcript."""
if not self.is_loaded:
return None
prompt = f"""<|begin_of_text|><|start_header_id|>system<|end_header_id|>
You are a helpful assistant that creates concise meeting summaries. Focus on:
- Key decisions made
- Action items and who owns them
- Important discussions and their outcomes
- Next steps
Keep the summary structured and easy to scan.<|eot_id|><|start_header_id|>user<|end_header_id|>
Please summarize this meeting transcript:
{transcript}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Meeting Summary:
"""
try:
response = self.llm(
prompt,
max_tokens=1024,
temperature=0.7,
top_p=0.9,
stop=["<|eot_id|>", "<|end_of_text|>"],
)
return response["choices"][0]["text"].strip()
except Exception as e:
print(f"Summarization error: {e}")
return None
+88
View File
@@ -0,0 +1,88 @@
"""WhisperX transcription with speaker diarization."""
import json
from pathlib import Path
from typing import Any, Optional
import numpy as np
import torch
import whisperx
class WhisperXTranscriber:
"""Handles audio transcription and speaker diarization using WhisperX."""
def __init__(self, model_dir: Path, model_size: str = "base"):
"""Initialize WhisperX with local models."""
self.model_dir = model_dir
self.device = "cuda" if torch.cuda.is_available() else "cpu"
self.compute_type = "float16" if self.device == "cuda" else "int8"
self.is_loaded = False
try:
# Load ASR model
self.model = whisperx.load_model(
model_size,
self.device,
compute_type=self.compute_type,
download_root=str(model_dir / "whisper"),
)
# Load alignment model
self.align_model, self.align_metadata = whisperx.load_align_model(
language_code="en",
device=self.device,
model_dir=str(model_dir / "alignment"),
)
# Load diarization pipeline
self.diarize_model = whisperx.DiarizationPipeline(
device=self.device,
model_name=str(model_dir / "diarization"),
)
self.is_loaded = True
except Exception as e:
print(f"Failed to load WhisperX models: {e}")
self.is_loaded = False
async def transcribe_chunk(self, audio_chunk: np.ndarray) -> Optional[dict[str, Any]]:
"""Transcribe an audio chunk with speaker diarization."""
if not self.is_loaded:
return None
try:
# Transcribe
result = self.model.transcribe(
audio_chunk,
batch_size=16,
)
# Align whisper output
result = whisperx.align(
result["segments"],
self.align_model,
self.align_metadata,
audio_chunk,
self.device,
)
# Diarize
diarize_segments = self.diarize_model(audio_chunk)
result = whisperx.assign_word_speakers(diarize_segments, result)
# Format output
formatted_result = []
for segment in result["segments"]:
formatted_result.append({
"start": segment["start"],
"end": segment["end"],
"text": segment["text"],
"speaker": segment.get("speaker", "Unknown"),
})
return {"segments": formatted_result}
except Exception as e:
print(f"Transcription error: {e}")
return None
+83
View File
@@ -0,0 +1,83 @@
import { useRef, useEffect } from "react";
interface AudioRecorderProps {
onAudioData: (data: ArrayBuffer) => void;
isRecording: boolean;
setIsRecording: (recording: boolean) => void;
}
export function AudioRecorder({ onAudioData, isRecording, setIsRecording }: AudioRecorderProps) {
const mediaRecorderRef = useRef<MediaRecorder | null>(null);
const streamRef = useRef<MediaStream | null>(null);
useEffect(() => {
return () => {
// Cleanup on unmount
if (streamRef.current) {
streamRef.current.getTracks().forEach((track) => track.stop());
}
};
}, []);
const startRecording = async () => {
try {
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
streamRef.current = stream;
const mediaRecorder = new MediaRecorder(stream, {
mimeType: "audio/webm",
});
mediaRecorderRef.current = mediaRecorder;
const chunks: Blob[] = [];
mediaRecorder.ondataavailable = (event) => {
if (event.data.size > 0) {
chunks.push(event.data);
}
};
mediaRecorder.onstop = async () => {
const blob = new Blob(chunks, { type: "audio/webm" });
const arrayBuffer = await blob.arrayBuffer();
onAudioData(arrayBuffer);
chunks.length = 0;
};
// Send data every second for real-time processing
mediaRecorder.start(1000);
setIsRecording(true);
} catch (error) {
console.error("Error starting recording:", error);
alert("Failed to access microphone");
}
};
const stopRecording = () => {
if (mediaRecorderRef.current && isRecording) {
mediaRecorderRef.current.stop();
setIsRecording(false);
if (streamRef.current) {
streamRef.current.getTracks().forEach((track) => track.stop());
}
}
};
return (
<div className="audio-recorder">
<button
className={`record-button ${isRecording ? "recording" : ""}`}
onClick={isRecording ? stopRecording : startRecording}
>
{isRecording ? "⏹ Stop Recording" : "🎙️ Start Recording"}
</button>
{isRecording && (
<div className="recording-indicator">
<span className="pulse"></span> Recording...
</div>
)}
</div>
);
}
+32
View File
@@ -0,0 +1,32 @@
interface SummaryDisplayProps {
summary: string | null;
isLoading: boolean;
onDownload: () => void;
}
export function SummaryDisplay({ summary, isLoading, onDownload }: SummaryDisplayProps) {
return (
<div className="summary-display">
<div className="summary-header">
<h2>Meeting Summary</h2>
{summary && (
<button className="download-button" onClick={onDownload}>
📥 Download
</button>
)}
</div>
<div className="summary-content">
{isLoading ? (
<div className="loading">
<div className="spinner"></div>
<p>Generating summary...</p>
</div>
) : summary ? (
<div className="summary-text">{summary}</div>
) : (
<p className="empty-state">Summary will appear here after recording is complete.</p>
)}
</div>
</div>
);
}
+57
View File
@@ -0,0 +1,57 @@
interface TranscriptSegment {
start: number;
end: number;
text: string;
speaker: string;
}
interface TranscriptDisplayProps {
segments: TranscriptSegment[];
}
export function TranscriptDisplay({ segments }: TranscriptDisplayProps) {
const formatTime = (seconds: number) => {
const mins = Math.floor(seconds / 60);
const secs = Math.floor(seconds % 60);
return `${mins}:${secs.toString().padStart(2, "0")}`;
};
const getSpeakerColor = (speaker: string) => {
const colors = [
"#3b82f6", // blue
"#10b981", // green
"#f59e0b", // amber
"#ef4444", // red
"#8b5cf6", // purple
"#14b8a6", // teal
];
const speakerParts = speaker.split("_");
const index = speakerParts[1] ? parseInt(speakerParts[1], 10) % colors.length : 0;
return colors[index];
};
return (
<div className="transcript-display">
<h2>Transcript</h2>
<div className="transcript-segments">
{segments.length === 0 ? (
<p className="empty-state">No transcript yet. Start recording to begin.</p>
) : (
segments.map((segment, index) => (
<div key={index} className="segment">
<div className="segment-header">
<span className="speaker" style={{ color: getSpeakerColor(segment.speaker) }}>
{segment.speaker}
</span>
<span className="timestamp">
{formatTime(segment.start)} - {formatTime(segment.end)}
</span>
</div>
<p className="segment-text">{segment.text}</p>
</div>
))
)}
</div>
</div>
);
}
+1 -1
View File
@@ -5,5 +5,5 @@ import App from "./App";
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<App />
</React.StrictMode>,
</React.StrictMode>
);
+12 -4
View File
@@ -1,13 +1,21 @@
{
"extends": "@nhcarrigan/typescript-config",
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"jsx": "react-jsx"
"jsx": "react-jsx",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}
}
+12
View File
@@ -0,0 +1,12 @@
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
test: {
include: ["src/**/*.{test,spec}.{js,ts,tsx}"],
environment: "jsdom",
setupFiles: ["./vitest.setup.ts"],
globals: true,
},
});
+1
View File
@@ -0,0 +1 @@
import "@testing-library/jest-dom/vitest";