--- a/OllamaInterface/OllamaChatWidget.py Thu Sep 12 15:41:58 2024 +0200 +++ b/OllamaInterface/OllamaChatWidget.py Mon Sep 16 19:05:50 2024 +0200 @@ -37,9 +37,7 @@ self.__hid = hid - self.headerLabel.setText( - self.tr("<b>{0} - {1}</b>", "title, model name").format(title, model) - ) + self.__setHeader(title, model) self.__messagesLayout = QVBoxLayout() if parent is None: @@ -49,6 +47,19 @@ self.__messagesLayout.setAlignment(Qt.AlignmentFlag.AlignTop) self.chatMessagesWidget.setLayout(self.__messagesLayout) + def __setHeader(self, title, model): + """ + Private method to set the header label. + + @param title chat title + @type str + @param model model of the chat + @type str + """ + self.headerLabel.setText( + self.tr("<b>{0} - {1}</b>", "title, model name").format(title, model) + ) + def addMessage(self, role, message, scrollToBottom=True): """ Public method to add a new message. @@ -93,8 +104,8 @@ """ Public method to get the history ID of this chat. - @return DESCRIPTION - @rtype TYPE + @return history ID of the chat + @rtype str """ return self.__hid @@ -121,6 +132,20 @@ scrollbar = self.chatMessagesScrollArea.verticalScrollBar() scrollbar.setValue(0) + @pyqtSlot(str, str, str) + def chatParametersChanged(self, _hid, title, model): + """ + Public slot to handle a change of the chat parameters. + + @param _hid history ID (unused) + @type str + @param title new chat title + @type str + @param model new chat model + @type str + """ + self.__setHeader(title, model) + class OllamaChatDialog(QDialog): """