38 lines
977 B
C#
38 lines
977 B
C#
using ChatBot.Models.Configuration;
|
|
using Microsoft.Extensions.Options;
|
|
|
|
namespace ChatBot.Services
|
|
{
|
|
/// <summary>
|
|
/// Service for managing AI model
|
|
/// </summary>
|
|
public class ModelService
|
|
{
|
|
private readonly ILogger<ModelService> _logger;
|
|
private readonly string _currentModel;
|
|
|
|
public ModelService(ILogger<ModelService> logger, IOptions<OllamaSettings> ollamaSettings)
|
|
{
|
|
_logger = logger;
|
|
_currentModel = ollamaSettings.Value.DefaultModel;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initialize the service
|
|
/// </summary>
|
|
public Task InitializeAsync()
|
|
{
|
|
_logger.LogInformation("Using model: {Model}", _currentModel);
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the current model name
|
|
/// </summary>
|
|
public virtual string GetCurrentModel()
|
|
{
|
|
return _currentModel;
|
|
}
|
|
}
|
|
}
|