# Repository Briefing: 5235aa-web/Pebble_companionchat
> Source: https://repoforai.com/repo/5235aa-web/Pebble_companionchat (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/5235aa-web/Pebble_companionchat
- **Category**: Chat UI & AI Apps (聊天界面与 AI 应用)
- **Primary Language**: Python
- **License**: Apache-2.0
- **Engineering Health**: A (77/100 · Maintenance 35/35 · Adoption 2/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v1.0.6 (2026-12-01) — https://github.com/5235aa-web/Pebble_companionchat/releases
- **Review Snapshot**: 2026-12-04
- **Deployment / Stack Signals**: Self-Hosted, Local AI, API
- **Momentum**: 105 ★ total (+0 24h / +1 7d) · 1 forks
- **Topics**: `ai`, `aichat`, `aichatbot`, `aicompanion`, `airoleplay`, `asr`, `chat`, `llama`, `llama-cpp`, `sillytavern`, `tauri`, `tts`
- **When to Use**: Best for: Character-chat users who want local conversation history, portable cards and branches, and integrated group scenes, voice, and image generation with a choice of local or hosted engines. Skip if: Your workflow depends on specific SillyTavern extensions, native-only provider APIs without a gateway, or a managed multi-user service rather than a locally operated workspace.

## Overview
```text
### Architecture & Core Mechanics
Pebble separates the Vue 3, Pinia, and Vite UI in `frontendV2` from a Python service at `backend.main:app`. FastAPI runs under Uvicorn, WebSockets provide an RPC channel, and SQLite persists conversations, character cards, and extracted memories locally. The Python service can be packaged with PyInstaller, while Tauri 2 provides the desktop shell for the same frontend used in the browser.

Integrations are primarily service connections: `httpx` handles outbound HTTP, and remote chat requests use bearer authentication against OpenAI-compatible `/chat/completions`. Text handling is model-aware: `tiktoken` covers OpenAI vocabularies, while Hugging Face `tokenizers` can read a `tokenizer.json` supplied alongside a local model. Voice follows a separate ASR → LLM → TTS cascade, so choosing a chat model does not lock the user into one speech engine.

### Key Capabilities & Differentiators
Character chat supports streaming replies, alternate response swipes, separate branches, and manual token-aware context compaction. Pebble imports SillyTavern PNG and JSON cards, CHARX, and RisuAI `.risum` packages, and can import SillyTavern JSONL into new branches. Group rooms support up to three companions, with `@` speaker cues, multi-turn Relay, and room-scoped memories. Script Mode adds per-scene turn budgets, rewind, and retained summary cards.

Local model options include Ollama, LM Studio, and llama.cpp with GGUF and `mmproj` for vision. The streaming voice pipeline offers Silero VAD barge-in and supports audio.cpp engines, including Qwen3-ASR for recognition and OmniVoice for synthesis. Picture Studio accepts custom ComfyUI workflow JSON and also supports hosted image services. Images, documents, and sampled video frames can be attached to chats; video speech transcription is opt-in.

### Trade-offs & Limitations
Pebble is a strong fit when a move from SillyTavern is driven by integrated voice calls, group staging, or picture generation. Card and JSONL support lowers the migration cost, but it does not establish compatibility with extensions or custom workflows. SQLite and BM25 avoid running a separate database service, vector store, or embedding model. The retrieval trade-off is lexical matching: paraphrased memories may be harder to recover than with semantic search.

Local storage and local inference are separate choices. Remote chat, speech, or image providers can reduce workstation load, but requests to them may carry conversation content or media and incur usage charges. Local inference avoids sending those requests to a provider, but capacity depends on the chosen weights, context size, and concurrent speech or image tasks. The OpenAI-compatible chat interface reduces integration work at the cost of excluding native-only provider APIs unless a compatible gateway is available.

### Hardware & Deployment Guide
The Windows installer needs no separate Python or Node.js installation. It bundles audio.cpp but not `llama-server.exe`: to have Pebble launch a GGUF model directly, install a suitable llama.cpp build and configure its path in Backstage. Source web runs require Python 3.10+, Node.js 18+, and npm. The manual development setup runs Uvicorn on port 8002 and Vite on 5176; bind the backend to loopback for local-only use rather than copying the `0.0.0.0` example. Building a Tauri installer requires Rust. Optional See-through portrait decomposition has its own PyTorch environment and model weights.

Writable state defaults to `~/.pebblecompanion`, including `companions.db`, uploads, configuration, and voice clips. `PEBBLE_DATA_ROOT` and `PEBBLE_MODELS_ROOT` let operators separate writable state from model storage. For offline use, configure local engines and obtain their runtime files and weights in advance. Release v1.0.6 improves FFmpeg duration probing and timeout recovery, adds timestamped storyboard grids and 10-minute transcription chunks, and cleans up attachment files once they are no longer referenced.
```

## Key Capabilities
```text
- Model routing: Connect llama.cpp, Ollama, or LM Studio locally, or use a remote endpoint exposing OpenAI-compatible `/chat/completions`.
- Conversation portability: Import SillyTavern JSONL into separate branches with swipes and variables preserved; export to JSONL, HTML, Markdown, or Pebble JSON.
- Group direction: Stage up to three companions with `@` speaker cues, multi-turn Relay, room-scoped memories, and a separate narration mode.
- Voice pipeline: Replace ASR and TTS independently around the streaming LLM, with Silero VAD for barge-in and audio.cpp for local speech.
- Memory retrieval: Rank extracted memories with BM25, without an embedding service or vector store, and count tokens with provider-aware tokenizers.
- Video attachments: v1.0.6 packs timestamped frames into 2×2, 3×3, or 4×4 grids and retries with a compact grid when image or payload limits are hit.
```

## Quick Start / Clone
```bash
# Core backend dependencies
pip install -r requirements.txt

# Frontend dependencies
cd frontendV2
npm install
```
