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.
Linting checks are performed using Ruff, Mypy, and Pydocstyle. Code
formatting is performed using Black and Isort. A Makefile is also added
with linting and formatting commands for convenience.
This commit implements a basic interface to hold a conversation with
OpenAI's GPT models via their API, using OpenAI's Python SDK. In
addition to this interface, the commit incorporates Pydantic for
managing settings via environment variables.