fix: prevent agent debug from blocking chat

This commit is contained in:
2026-07-13 12:27:07 +08:00
parent 2453816364
commit 0864f9305b
4 changed files with 43 additions and 6 deletions

View File

@@ -23,14 +23,23 @@ function resize() {
element.style.overflowY = element.scrollHeight > 108 ? "auto" : "hidden";
}
function send() {
async function send() {
const text = input.value.trim();
if (!text) return;
// Sending has been accepted by the composer. Clear immediately instead of
// keeping the submitted text visible until the entire AI stream finishes.
input.value = "";
await nextTick();
resize();
emit("send", text, async (success) => {
if (!success) return;
input.value = "";
await nextTick();
resize();
// Restore only when the parent rejected/failed the request and the user has
// not entered replacement text in the meantime.
if (!success && !input.value) {
input.value = text;
await nextTick();
resize();
textarea.value?.focus();
}
});
}