Skip to content

Linux Port: Mistral AI + ChromaDB + xdotool (merge into separate branch, not main)#4

Open
RahulPatnaik wants to merge 1 commit intoTabbyAIKeyboard:mainfrom
RahulPatnaik:linux-port
Open

Linux Port: Mistral AI + ChromaDB + xdotool (merge into separate branch, not main)#4
RahulPatnaik wants to merge 1 commit intoTabbyAIKeyboard:mainfrom
RahulPatnaik:linux-port

Conversation

@RahulPatnaik
Copy link

Please merge this into a separate branch (e.g. linux or linux-port) rather than main to avoid any mixups with the Windows version.

Summary

Complete Linux port of Tabby. Replaces all Windows-only dependencies with Linux-native alternatives and switches from OpenAI to Mistral AI as the sole provider.
Tested on Ubuntu 24.04 LTS.

Changes

Electron Main Process

  • Replaced node-window-manager (Win32 API) and @nut-tree-fork/nut-js (Windows keyboard sim) with xdotool via execFileSync in text-handler.ts
  • Made uiohook-napi a soft dependency with try/catch import in keystroke-listener.ts so it degrades gracefully on Wayland
  • Fixed tray icon to use .png on Linux instead of .ico (Windows-only format) in tray/index.ts
  • Disabled setContentProtection(true) on Linux across all window files (causes black/invisible windows on Wayland compositors)
  • Changed transcribe shortcut from Ctrl+Alt+T to Ctrl+Alt+R to avoid conflict with Ubuntu terminal shortcut
  • Added --enable-features=WebRTCPipeWireCapturer flag for Wayland screen capture support
  • Fixed dev startup race condition: replaced tsup --watch + nodemon with custom scripts/electron-dev.js that manages exactly one Electron process with debounced
    restarts (fixes duplicate taskbar icons and EPIPE errors)
  • Added run-s electron:build before watchers so build/main.js exists before Electron launches

Frontend (Mistral-only)

  • Rewrote frontend/src/lib/ai/models.ts: removed all GPT, Gemini, Groq, Cerebras, LMStudio models. Now contains only Mistral Small, Mistral Large, Codestral, and
    Pixtral Large
  • Rewrote frontend/src/lib/ai/provider.ts: removed OpenAI, Google, Groq, Cerebras, LMStudio SDKs. Uses only @ai-sdk/mistral
  • Added @ai-sdk/mistral to frontend dependencies
  • Default model changed from gpt-4.1-mini to mistral-small-latest

Next.js Backend

  • Added Mistral provider to nextjs-backend/src/lib/ai/provider.ts with 4 models
  • Added Mistral models to nextjs-backend/src/lib/ai/models.ts with env-based default selection
  • Replaced Windows-only system prompt (PowerShell, MCP desktop tools) with Linux-appropriate prompt in chat/route.ts
  • Fixed signup route to use admin.createUser() with email_confirm: true for local dev (no Resend email dependency)
  • Updated frontend signup component to auto-sign-in after account creation

Memory Backend

  • Rewrote backend/main.py: replaced mem0 with ChromaDB + Mistral AI
  • ChromaDB uses PersistentClient at ~/.tabby/chromadb (data survives restarts)
  • Mistral Small for fact extraction, Mistral Embed for vector embeddings
  • Removed unused dependencies from pyproject.toml: mem0ai, zep-python, vecs

Cleanup

  • Removed 15 temporary documentation/setup files from project root
  • Removed backend/main_mem0_backup.py and zep-docker-compose.yml
  • Test suite reads Supabase keys from env/runtime instead of hardcoding

Test Results

65 tests, 63 passed, 0 failed, 2 skipped (skipped tests require Groq/OpenAI keys which are intentionally not configured).

Sections tested: Supabase auth, memory CRUD, all 4 Mistral models, streaming chat, inline suggestions, title generation, grammar completion, interview ghost suggest,
memory integration (AI tool calls to ChromaDB), edge cases (validation, unicode, concurrency, large payloads), ChromaDB persistence.

How to Run

# Install xdotool
sudo apt install xdotool

# Terminal 1: Supabase
npx supabase start

# Terminal 2: Memory backend
cd backend && uv run uvicorn main:app --reload --port 8000

# Terminal 3: Next.js backend
cd nextjs-backend && pnpm dev

# Terminal 4: Electron app
cd frontend && pnpm dev

Requires: xdotool, Docker (for Supabase), Node 20+, Python 3.12+, uv, pnpm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant