Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

## [Unreleased]

### Dictation and agents

- **Bring your own LLM for refinement and personalities.** Settings → Captures → Refinement gains a *Custom LLM endpoint (advanced)* section: point it at any server that speaks OpenAI's `/v1/chat/completions` (llama.cpp, vLLM, LM Studio, LocalAI, Ollama's OpenAI shim, OpenRouter, or OpenAI itself) with a model name and an optional API key, and dictation refinement and personality compose/rewrite go there instead of the bundled Qwen3. Leave the endpoint blank and nothing changes. The key is write-only: the settings API reports only whether one is stored. The dictation readiness checklist treats a configured endpoint as ready, the Models page keeps managing the on-device Qwen regardless, and a failing endpoint surfaces as a clear error naming the URL and status. — @ext-sakamoro ([#947](https://github.com/jamiepine/voicebox/pull/947))

## [0.6.0] - 2026-10-04

**The stability release.** 0.5 made Voicebox a dictation and agent-voice studio; 0.6 makes it hold up. Sixty-plus contributor pull requests landed since 0.5 and most of them fix something that used to go wrong in daily use: MLX crashed with `There is no Stream(gpu, 1) in current thread` when a model was loaded on one thread and used on another, memory grew with every generation and never came back on unload, a fully-cached model retried HuggingFace five times per file before it would load offline, the Docker image could not write its own data volume, dictation refused to arm without an LLM it was never going to call, and the backend test suite would not even collect. All of that is fixed. The headline features ride on top: native AMD ROCm on Windows and in Docker, five new interface languages, and Chatterbox multilingual running on Apple Silicon through MLX.
Expand Down
142 changes: 140 additions & 2 deletions app/src/components/ServerTab/CapturesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
import { Input } from '@/components/ui/input';
import {
Select,
SelectContent,
Expand Down Expand Up @@ -140,10 +141,60 @@ export function CapturesPage() {
const hotkeyEnabled = settings?.hotkey_enabled ?? false;
const pushToTalkKeys = settings?.chord_push_to_talk_keys ?? defaultChordKeys('push');
const toggleToTalkKeys = settings?.chord_toggle_to_talk_keys ?? defaultChordKeys('toggle');
const customLlmEndpointSaved = settings?.custom_llm_endpoint ?? '';
const customLlmModelSaved = settings?.custom_llm_model ?? '';
// The server no longer returns the API key value; it reports whether one
// is stored via ``custom_llm_api_key_configured``. Anything sitting in
// React state below is a freshly-typed key that hasn't been sent yet.
const customLlmApiKeyConfigured = Boolean(settings?.custom_llm_api_key_configured);
const customLlmActive = Boolean(customLlmEndpointSaved && customLlmModelSaved);

const [chordEditor, setChordEditor] = useState<'push' | 'toggle' | null>(null);
const [opening, setOpening] = useState(false);
const [capturesPath, setCapturesPath] = useState<string | null>(null);
// Drafts persist to the server on blur so we don't fire a PUT + optimistic
// re-render on every keystroke while the user types out a URL or token.
const [customLlmEndpointDraft, setCustomLlmEndpointDraft] = useState(customLlmEndpointSaved);
const [customLlmModelDraft, setCustomLlmModelDraft] = useState(customLlmModelSaved);
// Write-only field: the input is blank on load even when a key is stored,
// and clears itself after a successful save so the raw value never lingers
// in React state where a browser cache or dev-tools inspection could grab it.
const [customLlmApiKeyDraft, setCustomLlmApiKeyDraft] = useState('');

useEffect(() => {
setCustomLlmEndpointDraft(customLlmEndpointSaved);
}, [customLlmEndpointSaved]);
useEffect(() => {
setCustomLlmModelDraft(customLlmModelSaved);
}, [customLlmModelSaved]);

const commitCustomLlmEndpoint = useCallback(() => {
const next = customLlmEndpointDraft.trim();
if (next !== customLlmEndpointSaved) {
update({ custom_llm_endpoint: next || null });
Comment thread
capy-ai-staging[bot] marked this conversation as resolved.
Resolved
}
}, [customLlmEndpointDraft, customLlmEndpointSaved, update]);
const commitCustomLlmModel = useCallback(() => {
const next = customLlmModelDraft.trim();
if (next !== customLlmModelSaved) {
update({ custom_llm_model: next || null });
}
}, [customLlmModelDraft, customLlmModelSaved, update]);
const commitCustomLlmApiKey = useCallback(() => {
const trimmed = customLlmApiKeyDraft.trim();
if (!trimmed) return;
// Send the trimmed value — surrounding whitespace in a bearer token
// makes the remote reject it with 401, which surfaces as a confusing
// "auth failed" toast when the raw pasted key is fine. Then wipe the
// draft so nothing else in the tree can read it back; the server flag
// flips to `configured=true` on the next settings query.
update({ custom_llm_api_key: trimmed });
setCustomLlmApiKeyDraft('');
}, [customLlmApiKeyDraft, update]);
const clearCustomLlmApiKey = useCallback(() => {
setCustomLlmApiKeyDraft('');
update({ custom_llm_api_key: null });
}, [update]);

useEffect(() => {
fetch(`${serverUrl}/health/filesystem`)
Expand Down Expand Up @@ -453,6 +504,87 @@ export function CapturesPage() {
/>
}
/>

<SettingRow
title={t('settings.captures.refinement.customEndpoint.title')}
description={t('settings.captures.refinement.customEndpoint.description')}
>
<div className="space-y-2 max-w-lg">
<label htmlFor="customLlmEndpoint" className="block text-xs font-medium text-muted-foreground">
{t('settings.captures.refinement.customEndpoint.endpointLabel')}
</label>
<Input
id="customLlmEndpoint"
type="url"
placeholder={t('settings.captures.refinement.customEndpoint.endpointPlaceholder')}
value={customLlmEndpointDraft}
onChange={(e) => setCustomLlmEndpointDraft(e.target.value)}
onBlur={commitCustomLlmEndpoint}
autoComplete="off"
spellCheck={false}
aria-label={t('settings.captures.refinement.customEndpoint.endpointLabel')}
/>
<label htmlFor="customLlmModel" className="block text-xs font-medium text-muted-foreground pt-1">
{t('settings.captures.refinement.customEndpoint.modelLabel')}
</label>
<Input
id="customLlmModel"
type="text"
placeholder={t('settings.captures.refinement.customEndpoint.modelPlaceholder')}
value={customLlmModelDraft}
onChange={(e) => setCustomLlmModelDraft(e.target.value)}
onBlur={commitCustomLlmModel}
disabled={!customLlmEndpointDraft}
autoComplete="off"
spellCheck={false}
aria-label={t('settings.captures.refinement.customEndpoint.modelLabel')}
/>
<label htmlFor="customLlmApiKey" className="block text-xs font-medium text-muted-foreground pt-1">
{t('settings.captures.refinement.customEndpoint.apiKeyLabel')}
{customLlmApiKeyConfigured ? (
<span className="ml-2 text-[10px] uppercase tracking-wide text-emerald-600">
{t('settings.captures.refinement.customEndpoint.apiKeyConfigured')}
</span>
) : null}
</label>
<div className="flex gap-2">
<Input
id="customLlmApiKey"
type="password"
placeholder={
customLlmApiKeyConfigured
? t('settings.captures.refinement.customEndpoint.apiKeyPlaceholderReplace')
: t('settings.captures.refinement.customEndpoint.apiKeyPlaceholder')
}
value={customLlmApiKeyDraft}
onChange={(e) => setCustomLlmApiKeyDraft(e.target.value)}
onBlur={commitCustomLlmApiKey}
disabled={!customLlmEndpointDraft}
autoComplete="new-password"
spellCheck={false}
aria-label={t('settings.captures.refinement.customEndpoint.apiKeyLabel')}
className="flex-1"
/>
{customLlmApiKeyConfigured && (
<button
type="button"
onClick={clearCustomLlmApiKey}
className="text-xs text-muted-foreground hover:text-destructive px-2 py-1 border border-border rounded-md"
aria-label={t('settings.captures.refinement.customEndpoint.apiKeyClear')}
>
{t('settings.captures.refinement.customEndpoint.apiKeyClear')}
</button>
)}
</div>
<p className="text-xs text-muted-foreground">
{customLlmActive
? t('settings.captures.refinement.customEndpoint.statusRemote', {
endpoint: customLlmEndpointSaved,
})
: t('settings.captures.refinement.customEndpoint.statusBuiltin')}
</p>
</div>
</SettingRow>
</SettingSection>

<SettingSection
Expand Down Expand Up @@ -549,8 +681,14 @@ export function CapturesPage() {
<li className="flex gap-2.5">
<Lock className="h-4 w-4 shrink-0 mt-0.5 text-accent" />
<span className="leading-relaxed">
<span className="text-foreground font-medium">{t('settings.captures.sidebar.local.title')}</span>{' '}
{t('settings.captures.sidebar.local.body')}
<span className="text-foreground font-medium">
{customLlmActive
? t('settings.captures.sidebar.remote.title')
: t('settings.captures.sidebar.local.title')}
</span>{' '}
{customLlmActive
? t('settings.captures.sidebar.remote.body', { endpoint: customLlmEndpointSaved })
: t('settings.captures.sidebar.local.body')}
</span>
</li>
<li className="flex gap-2.5">
Expand Down
19 changes: 19 additions & 0 deletions app/src/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,21 @@
"preserveTechnical": {
"title": "Preserve technical terms",
"description": "Keep code identifiers, command names, and acronyms exactly as spoken. Turn on when you dictate into a code prompt."
},
"customEndpoint": {
"title": "Custom LLM endpoint (advanced)",
"description": "Delegate refinement and personality rewrites to any OpenAI-compatible server — llama.cpp, vLLM, LM Studio, LocalAI, Ollama's shim, or the OpenAI API itself. Leave blank to use the built-in Qwen3.",
"endpointLabel": "Endpoint URL",
"endpointPlaceholder": "http://localhost:8090/v1",
"modelLabel": "Model name",
"modelPlaceholder": "Model name (e.g. qwen3-4b)",
"apiKeyLabel": "API key",
"apiKeyPlaceholder": "API key (optional)",
"apiKeyPlaceholderReplace": "Enter a new key to replace the stored one",
"apiKeyConfigured": "Stored",
"apiKeyClear": "Clear",
"statusBuiltin": "Using the built-in Qwen3 model selected above.",
"statusRemote": "Sending every refinement and personality rewrite to {{endpoint}}."
}
},
"playback": {
Expand Down Expand Up @@ -1020,6 +1035,10 @@
"title": "Fully local.",
"body": "Whisper and the refinement LLM run on your hardware. No cloud, no accounts, your voice never leaves the machine."
},
"remote": {
"title": "Refinement runs remotely.",
"body": "Whisper still transcribes on your hardware, but refined transcripts and personality rewrites are sent to {{endpoint}}. Voice audio itself never leaves the machine."
},
"playAs": {
"title": "Play as any voice.",
"body": "Transcripts can be read back in any profile you've cloned."
Expand Down
19 changes: 19 additions & 0 deletions app/src/i18n/locales/ja/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,21 @@
"preserveTechnical": {
"title": "専門用語を保持",
"description": "コードの識別子、コマンド名、頭字語を発話どおりに保持します。コード入力欄にディクテーションするときに有効にしてください。"
},
"customEndpoint": {
"title": "カスタム LLM エンドポイント (上級)",
"description": "リファインとパーソナリティの書き換えを、任意の OpenAI 互換サーバー (llama.cpp、vLLM、LM Studio、LocalAI、Ollama の互換 API、OpenAI API 自体など) に委譲します。空欄のままなら内蔵の Qwen3 を使います。",
"endpointLabel": "エンドポイント URL",
"endpointPlaceholder": "http://localhost:8090/v1",
"modelLabel": "モデル名",
"modelPlaceholder": "モデル名 (例: qwen3-4b)",
"apiKeyLabel": "API キー",
"apiKeyPlaceholder": "API キー (任意)",
"apiKeyPlaceholderReplace": "上書きする新しいキーを入力",
"apiKeyConfigured": "保存済",
"apiKeyClear": "クリア",
"statusBuiltin": "上で選んだ内蔵 Qwen3 モデルを使用しています",
"statusRemote": "リファインとパーソナリティの書き換えを {{endpoint}} に送信しています"
}
},
"playback": {
Expand Down Expand Up @@ -1015,6 +1030,10 @@
"title": "完全にローカル。",
"body": "Whisper と整形用 LLM はあなたのハードウェア上で動作します。クラウドもアカウントも不要で、声がマシンの外に出ることはありません。"
},
"remote": {
"title": "整形処理はリモート実行中。",
"body": "Whisper はハードウェア上で書き起こしを続けますが、整形された文字起こしとパーソナリティ書き換えは {{endpoint}} に送られます。音声そのものはマシンから出ません。"
},
"playAs": {
"title": "どのボイスでも再生。",
"body": "クローンしたどのプロファイルでも文字起こしを読み上げできます。"
Expand Down
27 changes: 24 additions & 3 deletions app/src/lib/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,30 @@ export interface CaptureSettings {
chord_push_to_talk_keys: string[];
/** keytap key names. Toggle adds Space to the platform-specific PTT chord. */
chord_toggle_to_talk_keys: string[];
}

export type CaptureSettingsUpdate = Partial<CaptureSettings>;
/**
* Optional OpenAI-compatible endpoint that overrides the built-in Qwen3
* LLM for refinement / personality rewriting. When set, backend calls hit
* `POST {custom_llm_endpoint}/chat/completions` with the model named by
* ``custom_llm_model``; leaving it null keeps the on-device Qwen path.
*/
custom_llm_endpoint: string | null;
custom_llm_model: string | null;
/**
* Whether a custom LLM API key is currently stored on the server. The raw
* key value never rides the response — this flag replaces it — so the
* settings UI can show a "Configured" indicator without letting the
* frontend rehydrate the secret into state or leak it to a browser cache.
* Writes still go through ``CaptureSettingsUpdate.custom_llm_api_key``.
*/
custom_llm_api_key_configured: boolean;
}

export type CaptureSettingsUpdate = Partial<
Omit<CaptureSettings, 'custom_llm_api_key_configured'>
> & {
/** Write-only: setting this to a non-empty string stores it, ``null`` clears it. */
custom_llm_api_key?: string | null;
};

/**
* One row in the dictation readiness checklist. ``model_name`` is the
Expand Down
4 changes: 3 additions & 1 deletion app/src/lib/hooks/useSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export function useCaptureSettings() {
if (
patch.stt_model !== undefined ||
patch.llm_model !== undefined ||
patch.auto_refine !== undefined
patch.auto_refine !== undefined ||
patch.custom_llm_endpoint !== undefined ||
patch.custom_llm_model !== undefined
) {
queryClient.invalidateQueries({ queryKey: ['capture-readiness'] });
}
Expand Down
14 changes: 14 additions & 0 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,20 @@ async def _run_startup(application: FastAPI) -> None:
finally:
db.close()

# Seed the LLM backend dispatch from the persisted capture settings so
# the very first refinement / personality call after startup honours a
# user-configured custom OpenAI-compatible endpoint without needing a
# settings-write to flip the module state first.
db = next(get_db())
try:
from .services.settings import bootstrap_llm_backend_config

bootstrap_llm_backend_config(db)
except Exception as e:
logger.warning("Could not bootstrap custom LLM config: %s", e)
finally:
db.close()

backend_type = get_backend_type()
logger.info("Backend: %s", backend_type.upper())
logger.info("GPU: %s", _get_gpu_status())
Expand Down
Loading
Loading