diff --git a/UniqueBibleAppVersion.txt b/UniqueBibleAppVersion.txt index 9f9af530d..4ca8639df 100755 --- a/UniqueBibleAppVersion.txt +++ b/UniqueBibleAppVersion.txt @@ -1 +1 @@ -34.98 +34.99 diff --git a/latest_changes.txt b/latest_changes.txt index 5b32698a7..c3e29ce1b 100755 --- a/latest_changes.txt +++ b/latest_changes.txt @@ -1,3 +1,10 @@ +Changes in 34.99: +Improved plugin "Bible Chat" +* Moved the predefined context selection out of settings to the main window so can quickly change and view the current context +* Added tool tip to context selection to see what it will do +* Added the context selection to the title to see what was run +* Fixed prayer predefined context + Changes in 34.98: Improved terminal mode * added options to integrate internet searches into ChatGPT responses: "always", "auto", "none" diff --git a/patches.txt b/patches.txt index 9fdd53109..a3fe0de6b 100755 --- a/patches.txt +++ b/patches.txt @@ -1358,7 +1358,6 @@ (34.82, "file", "gui/MaterialMainWindow.py") (34.82, "file", "util/VlcUtil.py") (34.85, "file", "db/AGBTSData.py") -(34.85, "file", "plugins/chatGPT/000_UBA.py") (34.86, "file", "util/TextCommandParser.py") (34.87, "file", "util/AGBsubheadings.py") (34.87, "file", "db/BiblesSqlite.py") @@ -1387,8 +1386,9 @@ (34.97, "file", "util/ConfigUtil.py") (34.98, "file", "gui/Worker.py") (34.98, "file", "plugins/chatGPT/integrate google searches.py") -(34.98, "file", "plugins/menu/Bible Chat.py") (34.98, "file", "util/LocalCliHandler.py") -(34.98, "file", "latest_changes.txt") -(34.98, "file", "UniqueBibleAppVersion.txt") -(34.98, "file", "patches.txt") +(34.99, "file", "plugins/chatGPT/000_UBA.py") +(34.99, "file", "plugins/menu/Bible Chat.py") +(34.99, "file", "latest_changes.txt") +(34.99, "file", "UniqueBibleAppVersion.txt") +(34.99, "file", "patches.txt") diff --git a/plugins/chatGPT/000_UBA.py b/plugins/chatGPT/000_UBA.py index ab88a613b..c514abf77 100644 --- a/plugins/chatGPT/000_UBA.py +++ b/plugins/chatGPT/000_UBA.py @@ -4,9 +4,11 @@ config.predefinedContexts["Word Meaning"] = """What is the meaning of the following word or words?""" config.predefinedContexts["Meaning in the Bible"] = """What is the meaning of the following content in reference to the Bible?""" -config.predefinedContexts["Write a Summary"] = """Write a summary on the following content.""" +config.predefinedContexts["Write a Summary"] = """Write a summary on the following content in reference to the Bible.""" config.predefinedContexts["Write a Sermon"] = """Write a sermon on the following content in reference to the Bible.""" -config.predefinedContexts["Write a Prayer"] = """Write a summary on the following content in reference to the Bible.""" +config.predefinedContexts["Write a Prayer"] = """Write a prayer on the following content in reference to the Bible.""" +config.predefinedContexts["Write a Short Prayer"] = """Write a prayer on the following content in reference to the Bible. +Keep the prayer short and do not make it longer than a paragraph.""" config.predefinedContexts["Key Words"] = """Identify key words in the following content. Elaborate on their importance in comprehending the context and the bible as a whole. I want your elaboration to be comprehensive and informative. diff --git a/plugins/menu/Bible Chat.py b/plugins/menu/Bible Chat.py index dc13857b1..a91bafd5d 100644 --- a/plugins/menu/Bible Chat.py +++ b/plugins/menu/Bible Chat.py @@ -115,18 +115,6 @@ def __init__(self, parent=None): self.applyContextIn = QComboBox() self.applyContextIn.addItems([firstInputOnly, allInputs]) self.applyContextIn.setCurrentIndex(1 if config.chatGPTApiContextInAllInputs else 0) - self.predefinedContextBox = QComboBox() - initialIndex = 0 - index = 0 - for key, value in config.predefinedContexts.items(): - self.predefinedContextBox.addItem(key) - self.predefinedContextBox.setItemData(self.predefinedContextBox.count()-1, value, role=Qt.ToolTipRole) - if key == config.chatGPTApiPredefinedContext: - initialIndex = index - index += 1 - self.predefinedContextBox.currentIndexChanged.connect(self.predefinedContextBoxChanged) - self.predefinedContextBox.setCurrentIndex(initialIndex) - # set availability of self.contextEdit in case there is no index changed self.contextEdit.setDisabled(True) if not initialIndex == 1 else self.contextEdit.setEnabled(True) """self.languageBox = QComboBox() initialIndex = 0 @@ -147,7 +135,6 @@ def __init__(self, parent=None): chatAfterFunctionCalled = config.thisTranslation["chatAfterFunctionCalled"] runPythonScriptGlobally = config.thisTranslation["runPythonScriptGlobally"] autoScroll = config.thisTranslation["autoScroll"] - predefinedContext = config.thisTranslation["predefinedContext"] context = config.thisTranslation["chatContext"] applyContext = config.thisTranslation["applyContext"] latestOnlineSearchResults = config.thisTranslation["latestOnlineSearchResults"] @@ -161,7 +148,6 @@ def __init__(self, parent=None): layout.addRow(f"Max Token [{required}]:", self.maxTokenEdit) layout.addRow(f"Function Calling [{optional}]:", self.functionCallingBox) layout.addRow(f"{chatAfterFunctionCalled} [{optional}]:", self.chatAfterFunctionCalledCheckBox) - layout.addRow(f"{predefinedContext} [{optional}]:", self.predefinedContextBox) layout.addRow(f"{context} [{optional}]:", self.contextEdit) layout.addRow(f"{applyContext} [{optional}]:", self.applyContextIn) layout.addRow(f"{latestOnlineSearchResults} [{optional}]:", self.loadingInternetSearchesBox) @@ -187,13 +173,6 @@ def org(self): def contextInAllInputs(self): return True if self.applyContextIn.currentIndex() == 1 else False - def predefinedContextBoxChanged(self, index): - self.contextEdit.setDisabled(True) if not index == 1 else self.contextEdit.setEnabled(True) - - def predefinedContext(self): - return self.predefinedContextBox.currentText() - #return self.predefinedContextBox.currentData(Qt.ToolTipRole) - def apiModel(self): #return "gpt-3.5-turbo" return self.apiModelBox.currentText() @@ -485,6 +464,23 @@ def setupUI(self): promptLayout.addWidget(self.sendButton) promptLayout.addWidget(self.apiModels) layout000Rt.addLayout(promptLayout) + + self.predefinedContextBox = QComboBox() + initialIndex = 0 + index = 0 + for key, value in config.predefinedContexts.items(): + self.predefinedContextBox.addItem(key) + self.predefinedContextBox.setItemData(self.predefinedContextBox.count()-1, value, role=Qt.ToolTipRole) + if key == config.chatGPTApiPredefinedContext: + initialIndex = index + index += 1 + self.predefinedContextBox.currentIndexChanged.connect(self.predefinedContextBoxChanged) + self.predefinedContextBox.setCurrentIndex(initialIndex) + + predefinedSelectionLayout = QHBoxLayout() + predefinedSelectionLayout.addWidget(self.predefinedContextBox) + layout000Rt.addLayout(predefinedSelectionLayout) + layout000Rt.addWidget(self.contentView) layout000Rt.addWidget(self.progressBar) self.progressBar.hide() @@ -573,6 +569,12 @@ def setupUI(self): self.updateSearchToolTips() + def predefinedContextBoxChanged(self, index): + self.setUserInputFocus() + config.chatGPTApiPredefinedContext = self.predefinedContextBox.currentText() + desc = config.predefinedContexts[self.predefinedContextBox.currentText()] + self.predefinedContextBox.setToolTip(desc) + def setFontSize(self, index=None): if index is not None: config.chatGPTFontSize = index + 1 @@ -836,6 +838,8 @@ def searchData(self): def bibleChatAction(self, context=""): if context: config.chatGPTApiPredefinedContext = context + index = list(config.predefinedContexts).index(context) + self.predefinedContextBox.setCurrentIndex(index) currentSelectedText = self.contentView.textCursor().selectedText().strip() if currentSelectedText: self.newData() @@ -995,6 +999,8 @@ def getMessages(self, userInput): return messages def print(self, text): + if not config.chatGPTApiPredefinedContext == "[none]": + text += " (" + config.chatGPTApiPredefinedContext + ")" self.contentView.appendPlainText(f"\n{text}" if self.contentView.toPlainText() else text) self.contentView.setPlainText(re.sub("\n\n[\n]+?([^\n])", r"\n\n\1", self.contentView.toPlainText()))