feat: add local LLM chat with WebLLM and PPQ.ai support

Implements browser-based AI chat functionality:

- WebLLM provider for local inference via WebGPU
  - Downloads and caches models in IndexedDB
  - Runs inference in web worker to keep UI responsive
  - Curated list of recommended models (SmolLM2, Llama 3.2, Phi 3.5, etc.)

- PPQ.ai provider for cloud-based inference
  - OpenAI-compatible API with Lightning payments
  - Dynamic model list fetching with caching

- Provider manager for coordinating multiple providers
  - Dexie tables for persisting provider instances and conversations
  - Model list caching with 1-hour TTL

- AIViewer component with sidebar pattern
  - Conversation history in resizable sidebar (mobile: sheet)
  - Model selector for WebLLM with download progress
  - Streaming chat responses
  - Auto-generated conversation titles

- New `ai` command to launch the interface

https://claude.ai/code/session_01HqtD9R33oqfB14Gu1V5wHC
This commit is contained in:
Claude
2026-01-30 21:53:48 +00:00
parent 0a5c80bc9c
commit 7d12b960e3
14 changed files with 2132 additions and 1 deletions

View File

@@ -19,6 +19,7 @@
},
"dependencies": {
"@fiatjaf/git-natural-api": "npm:@jsr/fiatjaf__git-natural-api@^0.2.3",
"@mlc-ai/web-llm": "^0.2.80",
"@radix-ui/react-accordion": "^1.2.12",
"@radix-ui/react-avatar": "^1.1.11",
"@radix-ui/react-checkbox": "^1.3.3",