OllamaInterface/OllamaWidget.py

changeset 12
cf507e6f12d7
parent 11
3641ea6b55d5
child 13
3fd49d7004b2
diff -r 3641ea6b55d5 -r cf507e6f12d7 OllamaInterface/OllamaWidget.py
--- a/OllamaInterface/OllamaWidget.py	Tue Aug 27 14:06:50 2024 +0200
+++ b/OllamaInterface/OllamaWidget.py	Wed Aug 28 18:20:33 2024 +0200
@@ -81,7 +81,7 @@
         self.historyScrollWidget.setLayout(self.__chatHistoryLayout)
         self.__chatHistoryLayout.addStretch(1)
 
-        self.mainSplitter.setSizes([200, 2000])
+        self.mainSplitter.setSizes([200, 2000, 100])
 
         self.newChatButton.setEnabled(False)
         self.__handleServerStateChanged(False)
@@ -99,7 +99,6 @@
         self.__initOllamaMenu()
 
         self.sendButton.clicked.connect(self.__sendMessage)
-        self.messageEdit.returnPressed.connect(self.__sendMessage)
 
         self.__loadHistory()
         self.__updateMessageEditState()
@@ -518,20 +517,17 @@
         button.
         """
         chatActive = bool(self.chatStackWidget.count())
-        hasText = bool(self.messageEdit.text())
+        hasText = bool(self.messageEdit.toPlainText())
 
         self.messageEdit.setEnabled(chatActive)
         self.sendButton.setEnabled(chatActive and hasText)
 
-    @pyqtSlot(str)
-    def on_messageEdit_textChanged(self, msg):
+    @pyqtSlot()
+    def on_messageEdit_textChanged(self):
         """
         Private slot to handle a change of the entered message.
-
-        @param msg text of the message line edit
-        @type str
         """
-        self.sendButton.setEnabled(bool(msg))
+        self.sendButton.setEnabled(bool(self.messageEdit.toPlainText()))
 
     @pyqtSlot()
     def __sendMessage(self):
@@ -541,7 +537,7 @@
 
         This sends the message with context (i.e. the history of the current chat).
         """
-        msg = self.messageEdit.text()
+        msg = self.messageEdit.toPlainText()
         if not msg:
             # empty message => ignore
             return

eric ide

mercurial