fix: filter terminal UI chrome (shortcuts, prompts, keybindings) from TTS
Deploy Dashboard / deploy (push) Successful in 59s

This commit is contained in:
Gan, Jimmy
2026-02-26 16:40:34 +08:00
parent 4772417464
commit afe97889e2
+2 -1
View File
@@ -3,6 +3,7 @@ const LANG_LABELS = ["EN", "普", "粤"];
const TALK_MODES = ["auto", "tap", "hold"];
const MODE_LABELS = { auto: "Auto", tap: "Tap", hold: "Hold" };
const NOISE = /^[\s│┃┆┇┊┋─━┄┅┈┉═╌╍╔╗╚╝╠╣╦╩╬├┤┬┴┼╭╮╯╰░▒▓█▌▐▀▄⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏◐◑◒◓⣾⣽⣻⢿⡿⣟⣯⣷⠁⠂⠄⡀⢀⠠⠐⠈\-–—_=+*#~<>/.\\|,;:!?(){}\[\]]+$/;
const SKIP = /shortcuts|\/help|\/exit|press esc|ctrl[+-]|⌘|⎋||^\$\s|^root@|^claude|^jimmy|^\[.*\]$/i;
const MODE_COMMANDS = {
"hold mode": "hold", "tap mode": "tap", "auto mode": "auto",
"按住模式": "hold", "点击模式": "tap", "自动模式": "auto",
@@ -202,7 +203,7 @@ export class VoiceSession {
const row = buf.getLine(y);
if (!row) continue;
const text = row.translateToString(true).trim();
if (text.length >= 4 && !NOISE.test(text)) lines.push(text);
if (text.length >= 4 && !NOISE.test(text) && !SKIP.test(text)) lines.push(text);
}
this._lastLine = curLine;
if (lines.length) this._speak(lines.join(". "));