Chat: Add -n/--count to show previous messages #1248
+365
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Primary Feature
Add a new option to the
chat
sub-command, allowing users to view the prior prompt/responses of a resumed conversation.How to Use
When calling the
chat
sub-command, simply add-n,--count
(like you would for thelogs
subcommand). Likelogs
, it will default to the last 3 messages of the conversationAdditional Features
Count Control
You can retrieve any number of messages, or ALL of the messages using
0
(like-n/--count
forlogs
)Safety
Calling
chat
with-n/--count
without-c,--continue,--cid,--conversation
will simply start a new chat (since, logically, there is no history)llm chat -n 99 # 99 problems but this command ain't one
Bug Fix
While formatting the output of this option, I realized that there was a bug in how
_BaseResponse
entities were created from DB rows - thedatetime_utc
wasn't being loaded into_start_utcnow
, and the format wasn't matching the rest of the llm output. I fixed it, and included a test in my suite to validate the formatting.