33 lines
1.4 KiB
C#
33 lines
1.4 KiB
C#
using Journal.Core.Dtos;
|
|
|
|
namespace Journal.Core.Services;
|
|
|
|
public sealed class DisabledAiService : IAiService
|
|
{
|
|
private readonly string _provider;
|
|
private readonly string _message;
|
|
private readonly bool _healthy;
|
|
|
|
public DisabledAiService(string provider, string message = "AI provider disabled.", bool healthy = true)
|
|
{
|
|
_provider = string.IsNullOrWhiteSpace(provider) ? "none" : provider.Trim();
|
|
_message = string.IsNullOrWhiteSpace(message) ? "AI provider disabled." : message.Trim();
|
|
_healthy = healthy;
|
|
}
|
|
|
|
public Task<AiHealthDto> HealthAsync(CancellationToken cancellationToken = default) =>
|
|
Task.FromResult(new AiHealthDto(_provider, Enabled: false, Healthy: _healthy, Message: _message));
|
|
|
|
public Task<string> SummarizeEntryAsync(string content, string? fileStem = null, CancellationToken cancellationToken = default) =>
|
|
Task.FromResult(_message);
|
|
|
|
public Task<string> SummarizeAllAsync(IReadOnlyList<string> entries, CancellationToken cancellationToken = default) =>
|
|
Task.FromResult(_message);
|
|
|
|
public Task<string> ChatAsync(string prompt, CancellationToken cancellationToken = default) =>
|
|
Task.FromResult(_message);
|
|
|
|
public Task<IReadOnlyList<double>> EmbedAsync(string content, CancellationToken cancellationToken = default) =>
|
|
Task.FromResult<IReadOnlyList<double>>([]);
|
|
}
|