fix: filter terminal UI chrome (shortcuts, prompts, keybindings) from TTS
Deploy Dashboard / deploy (push) Successful in 59s
Deploy Dashboard / deploy (push) Successful in 59s
This commit is contained in:
@@ -3,6 +3,7 @@ const LANG_LABELS = ["EN", "普", "粤"];
|
|||||||
const TALK_MODES = ["auto", "tap", "hold"];
|
const TALK_MODES = ["auto", "tap", "hold"];
|
||||||
const MODE_LABELS = { auto: "Auto", tap: "Tap", hold: "Hold" };
|
const MODE_LABELS = { auto: "Auto", tap: "Tap", hold: "Hold" };
|
||||||
const NOISE = /^[\s│┃┆┇┊┋─━┄┅┈┉═╌╍╔╗╚╝╠╣╦╩╬├┤┬┴┼╭╮╯╰░▒▓█▌▐▀▄⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏◐◑◒◓⣾⣽⣻⢿⡿⣟⣯⣷⠁⠂⠄⡀⢀⠠⠐⠈\-–—_=+*#~<>/.\\|,;:!?(){}\[\]]+$/;
|
const NOISE = /^[\s│┃┆┇┊┋─━┄┅┈┉═╌╍╔╗╚╝╠╣╦╩╬├┤┬┴┼╭╮╯╰░▒▓█▌▐▀▄⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏◐◑◒◓⣾⣽⣻⢿⡿⣟⣯⣷⠁⠂⠄⡀⢀⠠⠐⠈\-–—_=+*#~<>/.\\|,;:!?(){}\[\]]+$/;
|
||||||
|
const SKIP = /shortcuts|\/help|\/exit|press esc|ctrl[+-]|⌘|⎋|❯|^\$\s|^root@|^claude|^jimmy|^\[.*\]$/i;
|
||||||
const MODE_COMMANDS = {
|
const MODE_COMMANDS = {
|
||||||
"hold mode": "hold", "tap mode": "tap", "auto mode": "auto",
|
"hold mode": "hold", "tap mode": "tap", "auto mode": "auto",
|
||||||
"按住模式": "hold", "点击模式": "tap", "自动模式": "auto",
|
"按住模式": "hold", "点击模式": "tap", "自动模式": "auto",
|
||||||
@@ -202,7 +203,7 @@ export class VoiceSession {
|
|||||||
const row = buf.getLine(y);
|
const row = buf.getLine(y);
|
||||||
if (!row) continue;
|
if (!row) continue;
|
||||||
const text = row.translateToString(true).trim();
|
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;
|
this._lastLine = curLine;
|
||||||
if (lines.length) this._speak(lines.join(". "));
|
if (lines.length) this._speak(lines.join(". "));
|
||||||
|
|||||||
Reference in New Issue
Block a user