This commit is contained in:
mmrbnjd
2025-08-18 14:18:08 +03:30
parent 7ce8812098
commit 067607d98a
19 changed files with 715 additions and 55 deletions

View File

@@ -11,7 +11,7 @@ namespace Hushian.WebApi.Controllers.v1
{
[Route("api/v1/[controller]")]
[ApiController]
[Authorize]
// [Authorize]
public class ConversationController : ControllerBase
{
private readonly ConversationService _conversationService;
@@ -80,6 +80,7 @@ namespace Hushian.WebApi.Controllers.v1
}
//*
[HttpPost("NewConversationFromCurrentUser")]
[Authorize(Roles = "User")]
public async Task<ActionResult> NewConversationFromCurrentUser(ADD_ConversationDto conversation)
{
conversation.UserID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => Convert.ToInt32( s.Value)).First();
@@ -168,21 +169,21 @@ namespace Hushian.WebApi.Controllers.v1
return Ok(response) ;
}
[HttpPost("ai/NewResponse")]
[Authorize(Roles = "User")]
//[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);
//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.Value):BadRequest(response.Errors);
}
[HttpGet("ai/CurrentResponse/{companyID}")]
[Authorize(Roles = "User")]
public async Task<ActionResult> aiCurrentResponse(int companyID)
[HttpGet("ai/CurrentResponse/{companyID}/{aiKeyUser}")]
//[Authorize(Roles = "User")]
public async Task<ActionResult> aiCurrentResponse(int companyID,string aiKeyUser)
{
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);
//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, aiKeyUser);
return Ok(response);
}
}