fix(voice): browser speech recognition on Android no longer repeats phrases
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:
sandrodachandClaude Opus 5.5 committed 2026-10-31 13:16:04 +01:00
1 parent 32bb92ecf8
commit 8c2bfe2cee
7 files changed
+63 -8

No files matched your search

+10 -1
View File
@@ -6,6 +6,14 @@ Das Format folgt [Keep a Changelog](https://keepachangelog.com/de/1.1.0/), die V
## [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
### 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.
- 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.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
+1 -1
View File
@@ -6,7 +6,7 @@
[![Self-Hosted](https://img.shields.io/badge/100%25-Self--Hosted-2563eb?style=flat-square)](#)
[![Docker](https://img.shields.io/badge/Deployment-Single%20Container-2496ed?style=flat-square&logo=docker&logoColor=white)](#-schnellstart)
[![SQLite](https://img.shields.io/badge/Daten-SQLite-003b57?style=flat-square&logo=sqlite&logoColor=white)](#-deine-daten-gehören-dir)
[![Version](https://img.shields.io/badge/Version-v0.22.1-16a34a?style=flat-square)](CHANGELOG.md)
[![Version](https://img.shields.io/badge/Version-v0.22.2-16a34a?style=flat-square)](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.
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "mindsift-frontend",
"version": "0.22.1",
"version": "0.22.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mindsift-frontend",
"version": "0.22.1",
"version": "0.22.2",
"license": "Unlicense",
"dependencies": {
"@fontsource-variable/inter": "5.3.0",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "mindsift-frontend",
"private": true,
"version": "0.22.1",
"version": "0.22.2",
"license": "Unlicense",
"type": "module",
"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');
});
});
+4 -3
View File
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useRef, useState } from 'react';
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';
@@ -234,8 +234,9 @@ export function useVoiceInput({ onText, onError, continuous = false, live = fals
recognition.interimResults = true;
recognition.continuous = continuous || live;
recognition.onresult = (event: any) => {
let sessionText = '';
for (let i = 0; i < event.results.length; i++) sessionText += event.results[i][0].transcript;
const parts: string[] = [];
for (let i = 0; i < event.results.length; i++) parts.push(event.results[i][0].transcript);
const sessionText = joinSpeechResults(parts);
if (live && baseTranscriptRef.current) {
const base = baseTranscriptRef.current.trimEnd();
const next = sessionText.trimStart();
+24
View File
@@ -186,3 +186,27 @@ export class VoiceRecorder {
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;
}