Commit Graph

7 Commits

Author SHA1 Message Date
Paul Harrison 618423c0e8 Fix test bug introduced with conversation naming
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.
2023-09-14 21:37:57 +01:00
Paul Harrison 68fc11c450 Name conversation
Closes #4
2023-09-14 18:02:45 +01:00
Paul Harrison f5c7c40cc8 Load previous conversation
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.
2023-09-14 08:17:08 +02:00
Paul Harrison 8c17d4165a Store conversation history on session end
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.
2023-08-24 18:22:15 +01:00
Paul Harrison 1670383fee Display running cost in USD after each response 2023-08-24 15:23:32 +01:00
Paul Harrison 2cd623e960 Optionally provide context files to chat session
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.
2023-08-23 09:35:33 +01:00
Paul Harrison 7cbde55aac Implement basic command line interface
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.
2023-08-22 10:02:02 +01:00