--- a/OllamaInterface/OllamaWidget.py Thu Sep 12 15:41:58 2024 +0200 +++ b/OllamaInterface/OllamaWidget.py Mon Sep 16 19:05:50 2024 +0200 @@ -230,6 +230,19 @@ for index in range(self.__chatHistoryLayout.count() - 1): self.__chatHistoryLayout.itemAt(index).widget().checkModelAvailable(names) + def getSelectableModels(self): + """ + Public method to get a list of models to select from. + + @return list of models to select from + @rtype list of str + """ + return [ + self.modelComboBox.itemText(ind) + for ind in range(self.modelComboBox.count()) + if self.modelComboBox.itemText(ind) + ] + ############################################################################ ## Methods handling signals from the chat history widgets. ############################################################################ @@ -249,7 +262,9 @@ @return reference to the created history widget @rtype OllamaHistoryWidget """ - history = OllamaHistoryWidget(title=title, model=model, jsonStr=jsonStr) + history = OllamaHistoryWidget( + title=title, model=model, mainWidget=self, jsonStr=jsonStr + ) self.__chatHistoryLayout.insertWidget( self.__chatHistoryLayout.count() - 1, history ) @@ -490,6 +505,7 @@ chatWidget = OllamaChatWidget(hid=hid, title=title, model=model) index = self.chatStackWidget.addWidget(chatWidget) self.chatStackWidget.setCurrentIndex(index) + historyWidget.parametersChanged.connect(chatWidget.chatParametersChanged) self.__updateMessageEditState() self.messageEdit.setFocus(Qt.FocusReason.OtherFocusReason) @@ -515,6 +531,7 @@ ) index = self.chatStackWidget.addWidget(chatWidget) self.chatStackWidget.setCurrentIndex(index) + historyWidget.parametersChanged.connect(chatWidget.chatParametersChanged) for message in historyWidget.getMessages(): chatWidget.addMessage(role=message["role"], message=message["content"]) else: