← All source files

V13 / 7879e8b5740b

Lilith.Personality.cs

Lilith/Agent/Lilith.Personality.cs

Unchanged from the preceding version
CS
using Lilith.Core.Commands;
using Lilith.Core.Personality;

namespace Lilith.Agent;

public partial class Lilith
{
    public string? PersonalityFile { get; set; }
    public PersonalityProfile Personality => Client.Personality!.Current;
    partial void RegisterPersonalityCommands(ChatCommandRegistry commands) => PersonalityCommands.Register(commands, () => Client);
    private async Task SpeakReplyAsync(string reply, CancellationToken ct = default)
    {
        if (_tts is null) return;
        if (Client.Personality is { } profile && _tts.VoiceId != profile.Current.Voice)
            await _tts.SetVoiceAsync(profile.Current.Voice, ct);
        await _tts.SpeakAsync(reply, ct);
    }
}