Fix pinned skill prompt submission race (#3841)
This commit is contained in:
parent
fb9e023381
commit
cd41de8043
1 changed files with 7 additions and 4 deletions
|
|
@ -339,10 +339,13 @@ function _submitComposedMessage(text) {
|
||||||
const msgInput = document.getElementById('message');
|
const msgInput = document.getElementById('message');
|
||||||
const form = document.getElementById('chat-form');
|
const form = document.getElementById('chat-form');
|
||||||
if (!msgInput || !form) return false;
|
if (!msgInput || !form) return false;
|
||||||
msgInput.value = text;
|
// The slash handler and app-level form debounce must both release before
|
||||||
msgInput.dispatchEvent(new Event('input', { bubbles: true }));
|
// sending the pinned prompt, otherwise the follow-up submit is dropped.
|
||||||
if (typeof form.requestSubmit === 'function') form.requestSubmit();
|
setTimeout(() => {
|
||||||
else form.dispatchEvent(new Event('submit', { cancelable: true, bubbles: true }));
|
msgInput.value = text;
|
||||||
|
msgInput.dispatchEvent(new Event('input', { bubbles: true }));
|
||||||
|
form.dispatchEvent(new Event('submit', { cancelable: true, bubbles: true }));
|
||||||
|
}, 350);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue