V16 / 6df58cd3ed86
PersonalityCommands.cs
Lilith/Core/Personality/PersonalityCommands.cs
Unchanged from the preceding versionCS
using System.Text.Json;
using Lilith.Core.Commands;
using Lilith.Core.Providers;
namespace Lilith.Core.Personality;
public static class PersonalityCommands
{
public static void Register(ChatCommandRegistry commands, ProviderClient provider) => Register(commands, () => provider);
public static void Register(ChatCommandRegistry commands, Func<ProviderClient> provider)
{
commands.Register("profile", "Show current assistant name, sex, voice and personality.", c =>
{ c.RequireNoArguments(); return JsonSerializer.Serialize(provider().Personality?.Current); });
commands.Register("name", "Show or change the assistant name: /name Atlas.", c =>
c.Arguments.Length == 0 ? provider().Personality?.Current.Name : JsonSerializer.Serialize(provider().ChangePersonality(new(Name: c.Arguments))));
commands.Register("sex", "Show or change female|male|other; automatically selects a matching voice.", c =>
c.Arguments.Length == 0 ? provider().Personality?.Current.Sex : JsonSerializer.Serialize(provider().ChangePersonality(new(Sex: c.Arguments.ToLowerInvariant()))));
commands.Register("voice", "Show or change voice: /voice new|default|<voice-id>.", c =>
c.Arguments.Length == 0 ? provider().Personality?.Current.Voice : JsonSerializer.Serialize(provider().ChangePersonality(new(Voice: c.Arguments))));
commands.Register("voices", "List all installed voices, sex, language and the default.", c =>
{ c.RequireNoArguments(); return JsonSerializer.Serialize(PersonalityCatalog.Voices(provider().Personality?.Default.Voice ?? "af_heart")); });
commands.Register("personality", "Show or change default|pirate|space_captain|butler|storyteller.", c =>
c.Arguments.Length == 0 ? provider().Personality?.Current.Personality : JsonSerializer.Serialize(provider().ChangePersonality(new(Personality: c.Arguments.ToLowerInvariant()))));
commands.Register("personalities", "List the five personality styles.", c =>
{ c.RequireNoArguments(); return JsonSerializer.Serialize(PersonalityCatalog.Styles); });
}
}