SimpleChat:MCUI: Delay enabling user-input to avoid race

Re-enable user-input, only after response to a user query has been
updated to the chat-div. This ensures that if user tries to switch
chat session, it wont be allowed till chat-request-response flow is
done.
This commit is contained in:
HanishKVC 2024-05-21 16:48:32 +05:30
parent 928cc36427
commit d57274b2a3

View file

@ -265,8 +265,6 @@ class MultiChatUI {
body: theBody,
});
this.elInUser.value = "";
this.elInUser.disabled = false;
let respBody = await resp.json();
console.debug(`DBUG:MCUI:${chatId}:HandleUserSubmit:RespBody:${JSON.stringify(respBody)}`);
let assistantMsg;
@ -288,6 +286,8 @@ class MultiChatUI {
if ((apiEP == ApiEP.Completion) && (gbCompletionFreshChatAlways)) {
chat.xchat.length = 0;
}
this.elInUser.value = "";
this.elInUser.disabled = false;
this.elInUser.focus();
}