The ChatFake object used in CLI tests never gets a `conversation`
attribute defined. This resulted in multiple tests failing since the
`save_conversation` function accessed the `name` attribute via
`current_chat.conversation.name`. This was resolved by adding a `name`
property to the `Chat` class, which can be easily faked in tests.
Additionally, formatting was fixed.
This commit adds the additional CLI command `load`, which accepts the
path to a previously saved conversation from which to load previous
messages. The previous cost and token counts are not loaded as theses
are deemed functions of the chat session rathr than the conversation
and are stored with conversation purely for future reference.
At the end of each sesssion the conversation is stored to a directory
(defaulting to `.history` in the currrent working directory) as a JSON
object. Note, the session must be ended by sending the quit message (/q)
for the conversation to be saved. Ctrl+C will not work.
This commit enables the user to provide one or more text files as
context for their chat session. These will be provided as system
messages to OpenAI's API, one message per file.
Implements a basic CLI using Typer, Rich, and Prompt Toolkit. I couldn't
work out how to propoerly mock/fake the Rich console or the prompt
session from Prompt Toolkit, so I created dummy functions to work around
them and just test the basic application flow rather than user inputs
and outputs to the terminal.