feat: Introduce a /reset command to clear the chat session and token tracking, and update documentation.
This commit is contained in:
21
Commands/ResetCommand.cs
Normal file
21
Commands/ResetCommand.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Microsoft.Extensions.AI;
|
||||
using Spectre.Console;
|
||||
using AnchorCli.OpenRouter;
|
||||
|
||||
namespace AnchorCli.Commands;
|
||||
|
||||
internal class ResetCommand(ChatSession session, TokenTracker tokenTracker) : ICommand
|
||||
{
|
||||
public string Name => "reset";
|
||||
public string Description => "Reset the chat session (clear history and token count)";
|
||||
|
||||
public Task ExecuteAsync(string[] args, CancellationToken ct)
|
||||
{
|
||||
session.Reset();
|
||||
tokenTracker.Reset();
|
||||
AnsiConsole.MarkupLine("[green]Chat session reset.[/]");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user