feat: enable UTF-8 encoding for console, and fix tool log formatting
This commit is contained in:
@@ -9,6 +9,9 @@ using AnchorCli.Commands;
|
||||
using AnchorCli.OpenRouter;
|
||||
using Spectre.Console;
|
||||
|
||||
Console.InputEncoding = System.Text.Encoding.UTF8;
|
||||
Console.OutputEncoding = System.Text.Encoding.UTF8;
|
||||
|
||||
// ── Setup subcommand ─────────────────────────────────────────────────────
|
||||
if (args.Length > 0 && args[0].Equals("setup", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -81,12 +84,12 @@ infoTable.AddRow("[grey]Version[/]", $"[magenta]{version}[/]");
|
||||
|
||||
if (modelInfo?.Pricing != null && tokenTracker != null)
|
||||
|
||||
{
|
||||
{
|
||||
var inM = tokenTracker.InputPrice * 1_000_000m;
|
||||
var outM = tokenTracker.OutputPrice * 1_000_000m;
|
||||
infoTable.AddRow("[grey]Pricing[/]",
|
||||
$"[yellow]${inM:F2}[/][dim]/M in[/] [yellow]${outM:F2}[/][dim]/M out[/]");
|
||||
}
|
||||
}
|
||||
if (modelInfo != null)
|
||||
{
|
||||
infoTable.AddRow("[grey]Context[/]",
|
||||
@@ -116,7 +119,7 @@ void ToolLog(string message)
|
||||
lock (consoleLock)
|
||||
{
|
||||
Console.Write("\r" + new string(' ', 40) + "\r");
|
||||
AnsiConsole.MarkupLine($"[dim grey] ● {Markup.Escape(message)}[/]");
|
||||
AnsiConsole.MarkupLine($"[dim grey]{Markup.Escape(message)}[/]");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user