diff --git a/Controllers/V1/AiController.cs b/Controllers/V1/AiController.cs new file mode 100644 index 0000000..e824c31 --- /dev/null +++ b/Controllers/V1/AiController.cs @@ -0,0 +1,55 @@ +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using xAiService.Controllers; +using xAiService.Interfaces; +using xCommons.Attributes; +using xCommons.Configurations; +using xCommons.Providers; +using xIdentityService.Interfaces; + +namespace xApi.Controllers.V1 +{ + [ApiController] + [ApiVersion("1.0")] + [RequireXPowered(true)] + [Route("api/v{version:apiVersion}/[controller]")] + public class AiController : XAiServiceControllerBase, IXAiServiceControllerBase + { + // + #region Constructor ... + public AiController( + ILogger logger, + IXAiService aiService, + XAppConfiguration appConfiguration, + IXIdentityProvider identityProvider, + XValidationProvider validationProvider + ) : base( + logger, + aiService, + appConfiguration, + identityProvider, + validationProvider + ) + { } + #endregion + + // + #region Text Actions ... + [AllowAnonymous] + [HttpGet("Ask")] + public override async Task> Ask( + [FromQuery] string prompt, + CancellationToken cancellationToken = default + ) + { + return await base.Ask( + prompt: prompt, + cancellationToken: cancellationToken + ); + } + #endregion + } +} \ No newline at end of file diff --git a/appsettings.json b/appsettings.json index d87e335..a46f4a6 100644 --- a/appsettings.json +++ b/appsettings.json @@ -122,6 +122,11 @@ "SummaryEndsWdith": " ...", "ContentSummaryMaxLength": 255 }, + "AIServiceConfiguration": { + "Url": "https://localhost:6001/api/v1/ai", + "XPoweredValue": "SaherElmITCenter", + "DefaultClientTimeout": -1 + }, "Logging": { "LogLevel": { "Default": "Information", diff --git a/nuget.config b/nuget.config index 461a288..ddee910 100644 --- a/nuget.config +++ b/nuget.config @@ -1,8 +1,8 @@ + - \ No newline at end of file