Don't send empty dots and spaces
This commit is contained in:
parent
6250645fa4
commit
3689775efc
@ -132,8 +132,13 @@ class STTButton extends HTMLElement {
|
|||||||
text += '.';
|
text += '.';
|
||||||
}
|
}
|
||||||
this._finalTranscript += text + ' ';
|
this._finalTranscript += text + ' ';
|
||||||
this._updateTextarea(this._finalTranscript.trim());
|
const finalText = this._finalTranscript.trim();
|
||||||
this._finalize();
|
if (this._hasContent(finalText)) {
|
||||||
|
this._updateTextarea(finalText);
|
||||||
|
this._finalize();
|
||||||
|
} else {
|
||||||
|
this._clearTextarea();
|
||||||
|
}
|
||||||
this._finalTranscript = '';
|
this._finalTranscript = '';
|
||||||
this._interimTranscript = '';
|
this._interimTranscript = '';
|
||||||
} else {
|
} else {
|
||||||
@ -182,9 +187,13 @@ class STTButton extends HTMLElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_hasContent(text) {
|
||||||
|
return text.replace(/[\s.]+/g, '').length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
_finalize() {
|
_finalize() {
|
||||||
const chatInput = this._getChatInput();
|
const chatInput = this._getChatInput();
|
||||||
if (chatInput) {
|
if (chatInput && this._hasContent(chatInput.value)) {
|
||||||
chatInput.finalizeMessage();
|
chatInput.finalizeMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -277,8 +286,13 @@ class STTButton extends HTMLElement {
|
|||||||
}
|
}
|
||||||
this._finalTranscript += text + ' ';
|
this._finalTranscript += text + ' ';
|
||||||
}
|
}
|
||||||
this._updateTextarea(this._finalTranscript.trim());
|
const finalText = this._finalTranscript.trim();
|
||||||
this._finalize();
|
if (this._hasContent(finalText)) {
|
||||||
|
this._updateTextarea(finalText);
|
||||||
|
this._finalize();
|
||||||
|
} else {
|
||||||
|
this._clearTextarea();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this._stop();
|
this._stop();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user