-
-
Notifications
You must be signed in to change notification settings - Fork 37
Bible Chat with ChatGPT API
This wiki page describes how to use menu plugin "Bible Chat" in UniqueBible.app
Developer: Eliran Wong
Bible Chat is a Qt-based graphical user interface that uses OpenAI ChatGPT API to generate chat conversations about the bible.
This plugin is a Qt-based graphical user interface that uses OpenAI ChatGPT API to generate chat conversations.
Users need to register an OpenAI account and generate a API key first at: https://platform.openai.com/account/api-keys
Read pricing at: https://openai.com/pricing
ChatGPT web version is available at: https://chat.openai.com/chat
"ChatGPT-GUI" uses the same model, but with enhanced features not available at ChatGPT web version.
With "ChatGPT-GUI", users can:
-
include latest internet search results in ChatGPT responses
-
enter multiline-message
-
predefine context for chat conversations. With "ChatGPT-GUI", users can specify a context for conversations. For example, enter "about the bible" as the chat context in "Chat Settings", to get ChatGPT responses related to the bible.
-
adjust temperature [What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.]
-
adjust number of choices in ChatGPT responses [How many chat completion choices to generate for each input message.]
-
adjust font size for text display
-
use python plugins, to automate tasks, add predefined context, or to process ChatGPT responses before they are displayed
-
edit, print and save conversations
-
save conversations for offline use
-
search history, based on title or content
-
perform search and replace on chat content
-
oranize chat history into different separate database files
-
enter message with voice-typing
-
use OpenAI image model to generate images
-
support system tray
-
choose to use regular expression for search and replace
- Launch "Bible Chat" from plugins menu
- Click "Settings" to enter your own OpenAI API key
- Enter your message in message entry field and press Enter key, to start a conversation
The Bible Chat Window is separated into left and right areas, by a movable splitter. Users can move the splitter to either end to hide one of them.
On the Left, from top to bottom:
-
search entry and button for title - enter text here to search for a title, that contains the entered text, in saved record. You may either press the button or press the "Enter" key after text entry.
-
search entry and button for content - enter text here to search for a content, that contains the entered text, in saved record. You may either press the button or press the "Enter" key after text entry.
-
record list - list of saved records or search results. Select a record to update the content view on the right.
-
"Remove" & "Clear All" buttons - remove selected record or remove all records. Confirmation is required before you proceed the deletion.
-
"Help" button - open this wiki page
On the right, from top to bottom:
-
message input - users enter a message here to begin or continue a conversation. The voice checkbox toggle voice-typing. The send button sends the message. Alternately, users can press the "Enter" key after text entry. When a message is sent, a progress bar is displayed to indicate that the message is being processed.
-
+ / - button - toggle multiline user input for message entry
-
Chat or Image - this determines whether the message to sent to generate a chat response or an image.
-
Content view - display conversation content
-
Search and Replace - update content with search and replace
-
Control interface:
-
Settings - open "Settings" dialog, where you can enter OpenAI API key, orgnisation ID, conversation context, text-to-speech language. In UniqueBible.app the conversation context is set to "about the bible" by default. you may modify the context to get the conversations more focused on a particular context.
-
Temperature - according to OpenAI documentation, temperature means "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic."
-
Choices - according to OpenAI documentation, choices means "How many chat completion choices to generate for each input message."
-
Audio checkbox - toggles audio plackback when a new response is loaded. Users can select default language in "Settings"
-
Editable checkbox - toggles to edit the content view or make it read-only
-
"New" - open a new conversation
-
"Save" saves edited conversation. Each conservation is automatically saved when a new response is loaded. Users may edit and updated the content with this button.
Application menu:
-
New Database - create a new database file
-
Open Database - open an existing database file
-
Save Database as - duplicate the currently opened database a different file
-
New Chat - create a new chat
-
Save Chat - save chat content
-
Print Chat - print chat content
-
Configure - open settings dialog
-
Toggle Dark Theme - toggle between dark and light theme
-
Toggle System Tray - toggle system tray; restart the application is required
-
Exit - Exit the application
How to edit a record's title?
Edit the first line of a record to change its title.
Where are database files stored?
Chat database file is stored in folder "chats" by default. The default file is named as "default.chat"
What is the format of the database files?
We use ".chat" as extension for database files to work with the GUI. They are all standard sqlite files.
Can I change the context to make the conversation context to focus on a particular area in bible study?
Yes. Click the "Settings" button to edit the chat context. Change the default "about the bible" to something you want to focus, e.g. "about the new testament in the bible". Press "OK" to close the "Settings" dialog. Click "New" to start a new conversation.
How to use python plugins to process ChatGPT responses before they are displayed?
Create a python file and save it in folder "plugins".
For example, print response on console in addition to displayint it on GUI:
import config
def printOnConsole(text):
print(text) return text
config.chatGPTTransformers.append(printOnConsole)
You may even modify the content before it is displayed on the GUI.
In the python file, append the method that transform the response to config.chatGPTTransformers
For example, change all characters to upper cases:
import config
def convertToUpperCases(text):
return text.upper()
config.chatGPTTransformers.append(convertToUpperCases)
For example, ChatGPT is weak to produce responses in traditional Chinese. The following plugin convert all simplified Chinese into traditional Chinese characters:
import config
from opencc import OpenCC
def convertToTraditionalChinese(text):
cc = OpenCC('s2t')
return cc.convert(text)
config.chatGPTTransformers.append(convertToTraditionalChinese)
How to use plugins to customize input suggestion?
You can customize input suggestions by modifying 'config.inputSuggestions' with use of plugins.
For example:
- Save a python file, e.g. inputSuggestions.py, in folder "plugins".
- Add content, for example:
import config
config.inputSuggestions = config.inputSuggestions + ["Write a summary", "Write an outline", "Write a letter"]
How to use plugins to customize predefined contexts?
You can customize predefined contexts by modifying 'config.predefinedContexts' with use of plugins.
For example:
- Save a python file, e.g. predefinedContexts.py, in folder "plugins".
- Add content, for example:
import config
config.predefinedContexts["Introduction"] = """Write a introduction pertaining to the following content."""
config.predefinedContexts["Summary"] = """Write a summary pertaining to the following content."""