Version History
—————————
2024-09-25 - v0.3.0: Adjusted default storage file
2024-09-25 - v0.2.0: Added simple localization
2024-09-25 - v0.1.6: Initial version
Initialize localization data
Set all texts
Initialize storage file
Only allow eight most recent entries from history.
To achieve this, the history array is iterated reversed.
Now, revert the reverseHistory again, to get the correct order
Prepare messages array (which will be sent to OpenAI) with system message and content of history
User speech input
Add user prompt to history and messages array
Create initial dictionary to build an OpenAI request payload
Concat messages array by comma
Create a JSON object
Set messages JSON object to request payload dictionary
Send request to OpenAI. Request body payload must be the last modified dictionary (not the initial PayloadDictInit).
Store full response as lastResponse in storage file. The save command must use the last modified dictionary (not the initial StorageFileDict).
Extract single answer from OpenAI response
Store plain answer to lastAnswer in storage file. The save command must use the last modified dictionary (not the initial StorageFileDict).
Sanitize answer and add it to the history array
Create a JSON object of the history array
Store history to storage file. The save command must use the last modified dictionary (not the initial StorageFileDict).
Respond to user