Ajout de HelloFresh
This commit is contained in:
31
Controllers/OllamaController.cs
Normal file
31
Controllers/OllamaController.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user