fix(voice): browser speech recognition on Android no longer repeats phrases
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m40s
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m40s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
32bb92ecf8
commit
8c2bfe2cee
7 files changed
+63
-8
No files matched your search
+10
-1
@@ -6,6 +6,14 @@ Das Format folgt [Keep a Changelog](https://keepachangelog.com/de/1.1.0/), die V
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.22.2] - 2026-10-31
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Spracheingabe über den Browser (ohne Whisper-Server): In Chrome auf Android wurde ein Satz mehrfach übernommen („TestTestTestTest 1 2 3“ statt „Test 1 2 3“), weil Android jeden Zwischenstand als eigenes Ergebnis liefert. Fortsetzungen ersetzen jetzt den vorherigen Stand.
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- `AGENTS.md` mit Regeln für Coding-Agenten (Sprache, Prüfen, Release-Ablauf über die CI) und ein Plan für Registrierung mit Freigabe/E-Mail-Endungen und Anmeldung per OpenID Connect (`Doku/plans/`).
|
||||||
|
|
||||||
## [0.22.1] - 2026-10-31
|
## [0.22.1] - 2026-10-31
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
@@ -465,7 +473,8 @@ Das Format folgt [Keep a Changelog](https://keepachangelog.com/de/1.1.0/), die V
|
|||||||
- Geteilte Listen (Einkaufs-, Pack- und Checklisten) mit `#Kategorie`-Gruppierung, Mengenangaben und Echtzeit-Abhaken.
|
- Geteilte Listen (Einkaufs-, Pack- und Checklisten) mit `#Kategorie`-Gruppierung, Mengenangaben und Echtzeit-Abhaken.
|
||||||
- Benutzer-, Gruppen- und Admin-Verwaltung (Ersteinrichtungs-Assistent, Einladungscodes, Profilbilder, persönliche API-Keys & Webhook-Ingest `/api/v1/webhooks/ingest`, JSON-Datenexport) sowie CSS-Theme-Engine mit 4 Themes (`Dark`, `Light`, `High Contrast`, `Soft`) und PWA-Unterstützung.
|
- Benutzer-, Gruppen- und Admin-Verwaltung (Ersteinrichtungs-Assistent, Einladungscodes, Profilbilder, persönliche API-Keys & Webhook-Ingest `/api/v1/webhooks/ingest`, JSON-Datenexport) sowie CSS-Theme-Engine mit 4 Themes (`Dark`, `Light`, `High Contrast`, `Soft`) und PWA-Unterstützung.
|
||||||
|
|
||||||
[Unreleased]: https://git.dsit.me/sandrodach/MindSift/compare/v0.22.1...dev
|
[Unreleased]: https://git.dsit.me/sandrodach/MindSift/compare/v0.22.2...dev
|
||||||
|
[0.22.2]: https://git.dsit.me/sandrodach/MindSift/compare/v0.22.1...v0.22.2
|
||||||
[0.22.1]: https://git.dsit.me/sandrodach/MindSift/compare/v0.22.0...v0.22.1
|
[0.22.1]: https://git.dsit.me/sandrodach/MindSift/compare/v0.22.0...v0.22.1
|
||||||
[0.22.0]: https://git.dsit.me/sandrodach/MindSift/compare/v0.21.0...v0.22.0
|
[0.22.0]: https://git.dsit.me/sandrodach/MindSift/compare/v0.21.0...v0.22.0
|
||||||
[0.21.0]: https://git.dsit.me/sandrodach/MindSift/compare/v0.20.0...v0.21.0
|
[0.21.0]: https://git.dsit.me/sandrodach/MindSift/compare/v0.20.0...v0.21.0
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
[](#)
|
[](#)
|
||||||
[](#-schnellstart)
|
[](#-schnellstart)
|
||||||
[](#-deine-daten-gehören-dir)
|
[](#-deine-daten-gehören-dir)
|
||||||
[](CHANGELOG.md)
|
[](CHANGELOG.md)
|
||||||
|
|
||||||
**MindSift** ist eine selbst gehostete Schaltstelle für spontane Gedanken, Aufgaben mit Kanban-Board, hierarchische Outliner-Notizen, die mehrere Personen gleichzeitig bearbeiten können, und gemeinsame Listen. Alles läuft als ein einzelner Container mit eingebetteter SQLite-Datenbank, auf deinem eigenen Server.
|
**MindSift** ist eine selbst gehostete Schaltstelle für spontane Gedanken, Aufgaben mit Kanban-Board, hierarchische Outliner-Notizen, die mehrere Personen gleichzeitig bearbeiten können, und gemeinsame Listen. Alles läuft als ein einzelner Container mit eingebetteter SQLite-Datenbank, auf deinem eigenen Server.
|
||||||
|
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "mindsift-frontend",
|
"name": "mindsift-frontend",
|
||||||
"version": "0.22.1",
|
"version": "0.22.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mindsift-frontend",
|
"name": "mindsift-frontend",
|
||||||
"version": "0.22.1",
|
"version": "0.22.2",
|
||||||
"license": "Unlicense",
|
"license": "Unlicense",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fontsource-variable/inter": "5.3.0",
|
"@fontsource-variable/inter": "5.3.0",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "mindsift-frontend",
|
"name": "mindsift-frontend",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.22.1",
|
"version": "0.22.2",
|
||||||
"license": "Unlicense",
|
"license": "Unlicense",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
|
import { joinSpeechResults } from '../voice';
|
||||||
|
|
||||||
|
describe('joinSpeechResults (browser speech recognition)', () => {
|
||||||
|
it('Android: growing interim states of one phrase count once', () => {
|
||||||
|
expect(joinSpeechResults(['Test', 'Test', 'Test', 'Test', 'Test', 'Test 1 2 3'])).toBe('Test 1 2 3');
|
||||||
|
expect(joinSpeechResults(['Test', 'Test 1', 'Test 1 2', 'Test 1 2 3'])).toBe('Test 1 2 3');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('desktop: consecutive pieces are joined', () => {
|
||||||
|
expect(joinSpeechResults(['Milch kaufen', ' und Brot'])).toBe('Milch kaufen und Brot');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Android: a new phrase after a finished one is appended', () => {
|
||||||
|
expect(joinSpeechResults(['Milch', 'Milch kaufen', ' und Brot', ' und Brot holen'])).toBe('Milch kaufen und Brot holen');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('ignores empty results and earlier shorter states', () => {
|
||||||
|
expect(joinSpeechResults(['', 'Test 1 2', 'Test 1', ''])).toBe('Test 1 2');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { api } from './api';
|
import { api } from './api';
|
||||||
import { browserRecognition, currentVoiceConfig, EffectiveVoiceMode, loadVoiceConfig, VoiceRecorder } from './voice';
|
import { browserRecognition, currentVoiceConfig, EffectiveVoiceMode, joinSpeechResults, loadVoiceConfig, VoiceRecorder } from './voice';
|
||||||
|
|
||||||
export type VoiceState = 'idle' | 'listening' | 'transcribing';
|
export type VoiceState = 'idle' | 'listening' | 'transcribing';
|
||||||
|
|
||||||
@@ -234,8 +234,9 @@ export function useVoiceInput({ onText, onError, continuous = false, live = fals
|
|||||||
recognition.interimResults = true;
|
recognition.interimResults = true;
|
||||||
recognition.continuous = continuous || live;
|
recognition.continuous = continuous || live;
|
||||||
recognition.onresult = (event: any) => {
|
recognition.onresult = (event: any) => {
|
||||||
let sessionText = '';
|
const parts: string[] = [];
|
||||||
for (let i = 0; i < event.results.length; i++) sessionText += event.results[i][0].transcript;
|
for (let i = 0; i < event.results.length; i++) parts.push(event.results[i][0].transcript);
|
||||||
|
const sessionText = joinSpeechResults(parts);
|
||||||
if (live && baseTranscriptRef.current) {
|
if (live && baseTranscriptRef.current) {
|
||||||
const base = baseTranscriptRef.current.trimEnd();
|
const base = baseTranscriptRef.current.trimEnd();
|
||||||
const next = sessionText.trimStart();
|
const next = sessionText.trimStart();
|
||||||
|
|||||||
@@ -186,3 +186,27 @@ export class VoiceRecorder {
|
|||||||
this.analyser = null;
|
this.analyser = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Text of one speech recognition session from its results. Desktop browsers deliver consecutive
|
||||||
|
* pieces ("Test 1 2 3", " und weiter"); Chrome on Android also keeps the growing interim states of
|
||||||
|
* the same phrase as results of their own ("Test", "Test", "Test 1 2 3"). A result that only
|
||||||
|
* continues the one before it therefore replaces it instead of being appended.
|
||||||
|
*/
|
||||||
|
export function joinSpeechResults(transcripts: string[]): string {
|
||||||
|
const norm = (s: string) => s.trim().toLowerCase();
|
||||||
|
let text = '';
|
||||||
|
let last = '';
|
||||||
|
for (const t of transcripts) {
|
||||||
|
if (!t) continue;
|
||||||
|
if (last && norm(t).startsWith(norm(last))) {
|
||||||
|
text = text.slice(0, text.length - last.length) + t; // grown version of the same phrase
|
||||||
|
} else if (last && norm(last).startsWith(norm(t))) {
|
||||||
|
continue; // an earlier, shorter state of it
|
||||||
|
} else {
|
||||||
|
text += t;
|
||||||
|
}
|
||||||
|
last = t;
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
Reference in new issue
Block a user