diff --git a/gpt4all-chat/qml/ChatView.qml b/gpt4all-chat/qml/ChatView.qml index 75080981..fc5188a9 100644 --- a/gpt4all-chat/qml/ChatView.qml +++ b/gpt4all-chat/qml/ChatView.qml @@ -1367,7 +1367,7 @@ Rectangle { property bool isHovered: { return conversationTrayButton.isHovered || resetContextButton.hovered || copyChatButton.hovered || - regenerateButton.hovered || stopButton.hovered + regenerateButton.hovered } state: conversationTrayContent.isHovered ? "expanded" : "collapsed" @@ -1479,23 +1479,6 @@ Rectangle { ToolTip.visible: regenerateButton.hovered ToolTip.text: qsTr("Redo last chat response") } - MyToolButton { - id: stopButton - Layout.preferredWidth: 40 - Layout.preferredHeight: 40 - source: "qrc:/gpt4all/icons/stop_generating.svg" - imageWidth: 20 - imageHeight: 20 - visible: currentChat.responseInProgress - onClicked: { - var index = Math.max(0, chatModel.count - 1); - var listElement = chatModel.get(index); - listElement.stopped = true - currentChat.stopGenerating() - } - ToolTip.visible: stopButton.hovered - ToolTip.text: qsTr("Stop the current response generation") - } } } @@ -1646,7 +1629,7 @@ Rectangle { } } function sendMessage() { - if (textInput.text === "") + if (textInput.text === "" || currentChat.responseInProgress || currentChat.isRecalc) return currentChat.stopGenerating() @@ -1704,20 +1687,73 @@ Rectangle { } } + + MyToolButton { + id: stopButton + backgroundColor: theme.conversationInputButtonBackground + backgroundColorHovered: theme.conversationInputButtonBackgroundHovered + anchors.right: textInputView.right + anchors.verticalCenter: textInputView.verticalCenter + anchors.rightMargin: 15 + visible: currentChat.responseInProgress && !currentChat.isServer + + background: Item { + anchors.fill: parent + Image { + id: stopImage + anchors.centerIn: parent + visible: false + fillMode: Image.PreserveAspectFit + mipmap: true + sourceSize.width: theme.fontSizeLargest + sourceSize.height: theme.fontSizeLargest + source: "qrc:/gpt4all/icons/stop_generating.svg" + } + Rectangle { + anchors.centerIn: stopImage + width: theme.fontSizeLargest + 8 + height: theme.fontSizeLargest + 8 + color: theme.viewBackground + border.pixelAligned: false + border.color: theme.controlBorder + border.width: 1 + radius: width / 2 + } + ColorOverlay { + anchors.fill: stopImage + source: stopImage + color: stopButton.hovered ? stopButton.backgroundColorHovered : stopButton.backgroundColor + } + } + + Accessible.name: qsTr("Stop generating") + Accessible.description: qsTr("Stop the current response generation") + ToolTip.visible: stopButton.hovered + ToolTip.text: Accessible.description + + onClicked: { + var index = Math.max(0, chatModel.count - 1); + var listElement = chatModel.get(index); + listElement.stopped = true + currentChat.stopGenerating() + } + } + MyToolButton { id: sendButton - backgroundColor: theme.sendButtonBackground - backgroundColorHovered: theme.sendButtonBackgroundHovered + backgroundColor: theme.conversationInputButtonBackground + backgroundColorHovered: theme.conversationInputButtonBackgroundHovered anchors.right: textInputView.right anchors.verticalCenter: textInputView.verticalCenter anchors.rightMargin: 15 imageWidth: theme.fontSizeLargest imageHeight: theme.fontSizeLargest - visible: !currentChat.isServer && ModelList.selectableModels.count !== 0 - enabled: !currentChat.responseInProgress + visible: !currentChat.responseInProgress && !currentChat.isServer && ModelList.selectableModels.count !== 0 source: "qrc:/gpt4all/icons/send_message.svg" Accessible.name: qsTr("Send message") Accessible.description: qsTr("Sends the message/prompt contained in textfield to the model") + ToolTip.visible: sendButton.hovered + ToolTip.text: Accessible.description onClicked: { textInput.sendMessage() diff --git a/gpt4all-chat/qml/Theme.qml b/gpt4all-chat/qml/Theme.qml index de6eac0c..70191cc6 100644 --- a/gpt4all-chat/qml/Theme.qml +++ b/gpt4all-chat/qml/Theme.qml @@ -517,7 +517,7 @@ QtObject { } } - property color sendButtonBackground: { + property color conversationInputButtonBackground: { switch (MySettings.chatTheme) { case "LegacyDark": return accentColor @@ -528,7 +528,7 @@ QtObject { } } - property color sendButtonBackgroundHovered: { + property color conversationInputButtonBackgroundHovered: { switch (MySettings.chatTheme) { case "LegacyDark": return blue0