12345678910111213141516171819202122232425262728 |
- using HTEXGpt.Models;
- using HTEXGpt.Services;
- using Microsoft.AspNetCore.Http.HttpResults;
- using Microsoft.AspNetCore.Mvc;
- using System.Diagnostics.Tracing;
- using System.Net;
- namespace HTEXGpt.Controllers
- {
- [ProducesResponseType(StatusCodes.Status200OK)]
- [ProducesResponseType(StatusCodes.Status400BadRequest)]
- [Route("chat")]
- [ApiController]
- public class ChatController:ControllerBase
- {
- private static int _eventCounter = 0;
- private readonly IAiAppService _aiAppService;
- public ChatController(IAiAppService aiAppService) {
- _aiAppService=aiAppService;
- }
- [HttpPost("message")]
- public async Task<IActionResult > Message(ChatRequest dto) {
- var chatResponse = await _aiAppService.ChatMessage(dto.modelType, dto, HttpContext, Response);
- return Ok(new { response = chatResponse });
- }
- }
- }
|