Files
administration/Controllers/OllamaController.cs
2025-09-03 20:17:50 +02:00

32 lines
756 B
C#

using Microsoft.AspNetCore.Mvc;
using IngredientsAI.Services;
namespace IngredientsAI.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class OllamaController : ControllerBase
{
private readonly OllamaService _ollama;
public OllamaController(OllamaService ollama)
{
_ollama = ollama;
}
[HttpGet("models")]
public async Task<IActionResult> GetModels()
{
try
{
var models = await _ollama.GetModelsAsync();
return Ok(new { items = models });
}
catch (Exception ex)
{
return BadRequest(new { error = ex.Message });
}
}
}
}