Compare commits
2 commits
186403c2d5
...
bc673e7c24
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc673e7c24 | ||
|
|
b8040f6cd3 |
6 changed files with 83 additions and 16 deletions
36
README.md
36
README.md
|
|
@ -49,18 +49,30 @@ Groq may block direct requests from some networks. Point the script at your own
|
|||
|
||||
1. Deploy an nginx reverse proxy that forwards to `api.groq.com`:
|
||||
```nginx
|
||||
location /groq/ {
|
||||
proxy_pass https://api.groq.com/;
|
||||
location / {
|
||||
proxy_pass https://api.groq.com:443;
|
||||
proxy_set_header Host api.groq.com;
|
||||
}
|
||||
```
|
||||
2. Tampermonkey menu → **Set STT Endpoint** → paste `https://your-domain.com/groq/openai/v1/audio/transcriptions`
|
||||
2. Tampermonkey menu → **Set STT Endpoint** → paste `https://your-domain.com/openai/v1/audio/transcriptions`
|
||||
3. Requests now go through your proxy. The userscript metadata uses `@connect *`, so any domain is allowed.
|
||||
|
||||
A path prefix is not needed if the domain is dedicated to Groq. The `/groq` variant stays valid for multi-proxy domains — `location /groq/` with a trailing slash strips the prefix.
|
||||
|
||||
### 🌡️ Temperature
|
||||
|
||||
Whisper may hallucinate on silence/noise. **Set Temperature** (default `0` = deterministic, range `0`–`1`) reduces hallucinations.
|
||||
|
||||
### 🌐 Wrong Language (English instead of Russian)
|
||||
|
||||
If the model returns English text for Russian audio, clear the Whisper Prompt:
|
||||
|
||||
1. Open Tampermonkey/Violentmonkey menu → **Set Whisper Prompt**
|
||||
2. Leave the field empty (delete all text)
|
||||
3. Confirm
|
||||
|
||||
The prompt biases the model toward the prompt's language. An English prompt with Russian audio causes the model to output English. The prompt should match the audio language (or be empty for auto-detect).
|
||||
|
||||
---
|
||||
|
||||
## 🇷🇺 Русский
|
||||
|
|
@ -101,18 +113,30 @@ Groq может блокировать прямые запросы из неко
|
|||
|
||||
1. Разверни nginx reverse proxy, который форвардит на `api.groq.com`:
|
||||
```nginx
|
||||
location /groq/ {
|
||||
proxy_pass https://api.groq.com/;
|
||||
location / {
|
||||
proxy_pass https://api.groq.com:443;
|
||||
proxy_set_header Host api.groq.com;
|
||||
}
|
||||
```
|
||||
2. Меню Tampermonkey → **Set STT Endpoint** → вставь `https://your-domain.com/groq/openai/v1/audio/transcriptions`
|
||||
2. Меню Tampermonkey → **Set STT Endpoint** → вставь `https://your-domain.com/openai/v1/audio/transcriptions`
|
||||
3. Запросы пойдут через твой прокси. Метаблок юзерскрипта использует `@connect *`, поэтому разрешён любой домен.
|
||||
|
||||
Префикс пути не нужен, если домен выделен только под Groq. `/groq`-вариант остаётся валидным для мульти-прокси доменов — `location /groq/` с trailing slash срезает префикс.
|
||||
|
||||
### 🌡️ Temperature
|
||||
|
||||
Whisper может галлюцинировать на тишине/шуме. **Set Temperature** (по умолчанию `0` = детерминированный вывод, диапазон `0`–`1`) снижает галлюцинации.
|
||||
|
||||
### 🌐 Неправильный язык (английский вместо русского)
|
||||
|
||||
Если модель возвращает английский текст для русской речи, очистите Whisper Prompt:
|
||||
|
||||
1. Откройте меню Tampermonkey/Violentmonkey → **Set Whisper Prompt**
|
||||
2. Оставьте поле пустым (удалите весь текст)
|
||||
3. Подтвердите
|
||||
|
||||
Промпт смещает модель к языку промпта. Английский промпт с русским аудио заставляет модель выводить английский. Промпт должен совпадать с языком аудио (или быть пустым для автоопределения).
|
||||
|
||||
---
|
||||
|
||||
## 💬 Support and contacts / Поддержка и контакты
|
||||
|
|
|
|||
48
docs/decisions/0007-pr-46-empty-whisper-prompt.md
Normal file
48
docs/decisions/0007-pr-46-empty-whisper-prompt.md
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# ADR 0007: Empty whisperPrompt default (PR #46)
|
||||
|
||||
- **Date**: 2026-08-04
|
||||
- **PR**: 46
|
||||
- **Issue**: #46
|
||||
|
||||
## Статус
|
||||
|
||||
Accepted.
|
||||
|
||||
## Контекст
|
||||
|
||||
PR #43 добавил `DEFAULTS.whisperPrompt` — 107-символьный английский список терминов (`opencode, voice, dictation, transcribe, command, terminal, commit, branch, pull, push, merge, issue, prompt`). Целью было biasing-смещение модели в сторону технической терминологии userscript-а.
|
||||
|
||||
Документация Groq для параметра `prompt` (Whisper API) явно указывает: «Use the same language as the language of the audio file». Параметр `prompt` — это не системный промпт, а seed-контекст для декодера: модель стремится продолжить стиль и язык промпта в транскрипции.
|
||||
|
||||
Практический баг: английский промпт + русский аудио = модель уводит транскрипт в английский. Особенно заметно на `whisper-large-v3-turbo` (turbo более чувствителен к prompt biasing). Пользователь подтвердил: `language=ru` + turbo всё равно возвращает английский текст, потому что английский промпт перебивает явный `language` параметр.
|
||||
|
||||
## Решение
|
||||
|
||||
**`DEFAULTS.whisperPrompt = ""` (пустая строка).**
|
||||
|
||||
Поле `whisperPrompt` в `AppConfig` остаётся. Menu command `Set Whisper Prompt` (`registerMenuCommands`) остаётся — пользователи с узкопрофильной терминологией (медицина, право, конкретный стек) могут задать свой промпт на нужном языке. Меняется только default: пустая строка вместо английского biasing-промпта.
|
||||
|
||||
## Последствия
|
||||
|
||||
- `buildFormData` в `src/transcribe.ts` использует falsy-check `if (config.whisperPrompt)` — пустая строка не отправляет поле `prompt` в Groq API вообще. Модель работает в чистом auto-detect режиме без prompt biasing.
|
||||
- Обратная совместимость: существующие юзеры, установившие скрипт в версии 1.0.4 (PR #43) и не менявшие `whisperPrompt` через меню, имеют в `GM_getValue("whisperPrompt")` старое 107-символьное значение — оно сохранится и продолжит отправляться. Новый default применяется только к свежим установкам и к юзерам, очистившим поле через `Set Whisper Prompt`.
|
||||
- README обновлён секцией troubleshooting «Wrong Language» (EN+RU) — инструкция очистить Whisper Prompt через меню.
|
||||
- Версия bumped 1.0.4 → 1.0.5 (vite.config.ts + package.json).
|
||||
|
||||
## Альтернативы
|
||||
|
||||
### 1. Двуязычный промпт (английский + русский термины)
|
||||
- **Плюс**: biasing в обе стороны.
|
||||
- **Минус**: усложнение. Промпт нужно поддерживать при добавлении новых языков (сейчас `language` поддерживает `ru`/`en`/`auto`). При `auto` модель может растеряться от двуязычного промпта. Отвергнуто.
|
||||
|
||||
### 2. Смена модели на turbo по умолчанию
|
||||
- **Плюс**: turbo быстрее.
|
||||
- **Минус**: баг был в промпте, не в модели. `whisper-large-v3` лучше для русского (точность выше, turbo оптимизирован под английский). Смена модели не решила бы проблему английского biasing-а. Отвергнуто.
|
||||
|
||||
## Источники
|
||||
|
||||
- `src/config.ts` — `DEFAULTS.whisperPrompt` до/после
|
||||
- `src/transcribe.ts` — `buildFormData` falsy-check `if (config.whisperPrompt)`
|
||||
- Groq Whisper API docs — `prompt` parameter: «Use the same language as the language of the audio file»
|
||||
- PR #43 — добавление `DEFAULTS.whisperPrompt` (107 символов)
|
||||
- Issue: #46
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "opencode-voice-dictation",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"engines": {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ export const DEFAULTS: AppConfig = {
|
|||
groqApiKey: "",
|
||||
model: "whisper-large-v3",
|
||||
language: "",
|
||||
whisperPrompt:
|
||||
"opencode, voice, dictation, transcribe, command, terminal, commit, branch, pull, push, merge, issue, prompt",
|
||||
whisperPrompt: "",
|
||||
endpoint: "https://api.groq.com/openai/v1/audio/transcriptions",
|
||||
temperature: 0,
|
||||
autoSubmit: false,
|
||||
|
|
|
|||
|
|
@ -26,12 +26,8 @@ describe("DEFAULTS", () => {
|
|||
expect(DEFAULTS.language).toBe("");
|
||||
});
|
||||
|
||||
it("should have non-empty whisperPrompt", () => {
|
||||
expect(DEFAULTS.whisperPrompt.length).toBeGreaterThan(50);
|
||||
});
|
||||
|
||||
it("should have whisperPrompt under 120 characters (terms only, no sentences)", () => {
|
||||
expect(DEFAULTS.whisperPrompt.length).toBeLessThan(120);
|
||||
it("should have empty whisperPrompt by default", () => {
|
||||
expect(DEFAULTS.whisperPrompt).toBe("");
|
||||
});
|
||||
|
||||
it("should have autoSubmit disabled by default", () => {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ export default defineConfig({
|
|||
userscript: {
|
||||
name: "OpenCode Voice Dictation",
|
||||
namespace: "https://github.com/slaid098/opencode-voice-dictation",
|
||||
version: "1.0.4",
|
||||
version: "1.0.5",
|
||||
description:
|
||||
"Voice dictation for OpenCode web using Whisper (Groq API) - works on PC and mobile",
|
||||
author: "slaid098",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue