Services/ChatLog.cscsharp

Documentation

Lilith.RazorWebGui (Version 2)

ASP.NET Core Razor Pages web UI for Lilith Version 2. Mirrors LilithConsole chat, commands, and logging.

  • Model: LILITH_MODEL (default gemma4)
  • Commands: exit, /new, /history, /history <n>, /voice <name> (when TTS is enabled)
dotnet run --project Lilith.RazorWebGui.csproj

Browse http://localhost:5000 (see Properties/launchSettings.json).

using Agent.Core.Logging;namespace Lilith.RazorWebGui.Services;internal static class ChatLog{    internal static void Append(List<ChatLine> lines, object lockObj, LogEntry entry)    {        string text = entry.Description;        if (string.IsNullOrEmpty(text))        {            return;        }        string css = entry.Color switch        {            LogColors.Green => "user",            LogColors.Yellow => "assistant",            LogColors.Cyan => "system",            LogColors.Orange => "warn",            LogColors.Gray => "meta",            _ => "log",        };        lock (lockObj)        {            if (entry.Type == LogType.Progress && lines.Count > 0 && lines[^1].CssClass == "progress")            {                lines[^1] = new ChatLine(entry.Sender, text, "progress");            }            else            {                lines.Add(new ChatLine(entry.Sender, text, css));            }        }    }}