Add stop button
This commit is contained in:
@@ -19,6 +19,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const promptInput = document.getElementById('promptInput');
|
||||
const modelSelect = document.getElementById('modelSelect');
|
||||
const sendButton = document.getElementById('sendButton');
|
||||
const stopButton = document.getElementById('stopButton');
|
||||
const modelSelectionContainer = document.getElementById('modelSelectionContainer');
|
||||
|
||||
if (chatForm && promptInput && modelSelect) {
|
||||
@@ -32,6 +33,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
sendButton.disabled = true;
|
||||
promptInput.disabled = true;
|
||||
stopButton.disabled = false;
|
||||
|
||||
displayMessage(userInput, 'user');
|
||||
|
||||
@@ -49,10 +51,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
displayMessage(`Error: ${error.message}`, 'assistant');
|
||||
} finally {
|
||||
typingIndicator.remove();
|
||||
|
||||
sendButton.disabled = false;
|
||||
promptInput.disabled = false;
|
||||
promptInput.focus();
|
||||
stopButton.disabled = true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -60,6 +62,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('stopButton').addEventListener('click', () => {
|
||||
window.electronAPI.abortPrompt();
|
||||
document.getElementById('stopButton').disabled = true;
|
||||
});
|
||||
|
||||
function displayTypingIndicator() {
|
||||
const chatHistory = document.getElementById('chatHistory');
|
||||
const typingIndicator = document.createElement('div');
|
||||
|
||||
Reference in New Issue
Block a user