This commit is contained in:
mmrbnjd
2025-08-18 00:28:32 +03:30
parent bd1f907673
commit a10fbeab62
11 changed files with 711 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
using Common.Dtos.Conversation;
using Common.Dtos;
using Common.Dtos.Conversation;
using Common.Enums;
using Hushian.Application.Constants;
using Hushian.Application.Services;
@@ -16,11 +17,13 @@ namespace Hushian.WebApi.Controllers.v1
private readonly ConversationService _conversationService;
private readonly CompanyService _companyService;
private readonly ExperService _experService;
public ConversationController(ConversationService conversationService, CompanyService companyService, ExperService experService)
private readonly AIService _aIService;
public ConversationController(ConversationService conversationService, CompanyService companyService, ExperService experService, AIService aIService)
{
_conversationService = conversationService;
_companyService = companyService;
_experService = experService;
_aIService = aIService;
}
//*
@@ -164,5 +167,23 @@ namespace Hushian.WebApi.Controllers.v1
var response = await _conversationService.GEtConversation(UserID,CompanyID );
return Ok(response) ;
}
[HttpPost("ai/NewResponse")]
[Authorize(Roles = "User")]
public async Task<ActionResult> ainewresponse(aiNewResponseDto dto)
{
string strUserID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => s.Value).First();
dto.userId = Convert.ToInt32(strUserID);
var response = await _aIService.NewRequest(dto);
return response.Success ? Ok(response):BadRequest(response.Errors);
}
[HttpGet("ai/CurrentResponse/{companyID}")]
[Authorize(Roles = "User")]
public async Task<ActionResult> aiCurrentResponse(int companyID)
{
string strUserID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => s.Value).First();
var UserId = Convert.ToInt32(strUserID);
var response = await _aIService.GetCurrent(companyID,UserId);
return Ok(response);
}
}
}