Fix: Se refinan IA y Estructuras
This commit is contained in:
31
ChatbotApi/Controllers/ChatController.cs
Normal file
31
ChatbotApi/Controllers/ChatController.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ChatbotApi.Data.Models;
|
||||
using Microsoft.AspNetCore.RateLimiting;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ChatbotApi.Services;
|
||||
|
||||
namespace ChatbotApi.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class ChatController : ControllerBase
|
||||
{
|
||||
private readonly IChatService _chatService;
|
||||
private readonly ILogger<ChatController> _logger;
|
||||
|
||||
public ChatController(IChatService chatService, ILogger<ChatController> logger)
|
||||
{
|
||||
_chatService = chatService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpPost("stream-message")]
|
||||
[EnableRateLimiting("fixed")]
|
||||
public IAsyncEnumerable<string> StreamMessage(
|
||||
[FromBody] ChatRequest request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return _chatService.StreamMessageAsync(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user