From b0893a3699e807e29f127e5b004aec71d42969b7 Mon Sep 17 00:00:00 2001 From: marauder-actual Date: Fri, 29 May 2026 14:18:47 +0200 Subject: [PATCH 1/2] =?UTF-8?q?feat(transport):=20swap=20Anthropic=20?= =?UTF-8?q?=E2=86=92=20opencode;=20add=20persona=20switcher?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Part 1 — Transport swap: - Replace anthropic.AsyncAnthropic streaming with httpx SSE client calling opencode's OpenAI-compat /v1/chat/completions on sin:4096 - Auth: basic auth opencode:$OPENCODE_PASSWORD - Env: OPENCODE_URL (default http://sin:4096), OPENCODE_PASSWORD - Sidecar binding (sin:4098) consulted per message to resolve active persona; voice read from binding → cart → env default - Helper _session_id_for_user: deterministic sha256 slug per email so sidecar binding survives WebSocket reconnects - anthropic dep retained in pyproject.toml (not removed — P4 may use it) Part 2 — Persona switcher: - PERSONAS dict: bt7274, friday, samantha (slug → voice/backend/prompt) - POST /api/persona — bind persona via sidecar, maps slug → full config - GET /api/persona/current — return current binding - GET /api/personas — list available personas - chat.html: persona + + {% for p in personas %} + + {% endfor %} + + + {% if bound_display %}{{ bound_display }}{% endif %} + + + · + sign out Saiden From 6dee0e8c6fae0becfc964183f5a598a83a9c1490 Mon Sep 17 00:00:00 2001 From: marauder-actual Date: Fri, 29 May 2026 14:27:18 +0200 Subject: [PATCH 2/2] fix(transport): use cart-specific voice IDs and TTS engine backends in PERSONAS --- app/main.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/main.py b/app/main.py index 6fedc74..f5a26e9 100644 --- a/app/main.py +++ b/app/main.py @@ -76,19 +76,19 @@ if not PREVIEW_MODE and not OPENCODE_PASSWORD: # -------------------------------------------------------------------------- persona config # Canonical persona definitions. slug → {voice, backend, system_prompt_override?} -# voice: piper model ID used by TTS -# backend: engine hint forwarded to the sidecar +# voice: cart-specific voice ID as registered in madcat-tts (NOT generic piper model names) +# backend: TTS engine hint forwarded to the sidecar ("piper-remote"|"chatterbox"|"xtts") # system_prompt: optional override (None → use cart.system_prompt or BT_SYSTEM_PROMPT) PERSONAS: dict[str, dict[str, Any]] = { "bt7274": { - "voice": "en_US-lessac-high", - "backend": "opencode", + "voice": "bt7274-pl", + "backend": "piper-remote", "display": "BT-7274", "system_prompt": None, # use existing BT prompt from cart }, "friday": { - "voice": "en_US-amy-medium", - "backend": "opencode", + "voice": "friday-en", + "backend": "piper-remote", "display": "FRIDAY", "system_prompt": ( "You are FRIDAY — a dry, efficient tactical AI assistant. " @@ -97,8 +97,8 @@ PERSONAS: dict[str, dict[str, Any]] = { ), }, "samantha": { - "voice": "en_US-kathleen-low", - "backend": "opencode", + "voice": "samantha-en", + "backend": "chatterbox", "display": "Samantha", "system_prompt": ( "You are Samantha — a warm, curious, deeply attentive AI companion. "