65 lines
2.0 KiB
C#
65 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.Extensions.Logging;
|
|
using xAiApi.Interfaces;
|
|
using xAiApi.Interfaces.Extractors;
|
|
using xAiModels.Models.Dtos;
|
|
using xCommons.Configurations;
|
|
using xCommons.Providers;
|
|
using xIdentityService.Controllers;
|
|
using xIdentityService.Interfaces;
|
|
|
|
namespace xAiApi.Controllers
|
|
{
|
|
[Authorize]
|
|
[Route("[controller]")]
|
|
public class ChatWithDocumentsController : XBaseIdentityApiV1Controller, IDisposable
|
|
{
|
|
/// <summary>
|
|
/// Default AI Service ...
|
|
/// </summary>
|
|
private IXDefaultAiService aiService;
|
|
|
|
/// <summary>
|
|
/// In Memory Vector Store ...
|
|
/// </summary>
|
|
private IList<XAiVectorDto> vectorStore = [];
|
|
|
|
/// <summary>
|
|
/// Embedding Service ...
|
|
/// </summary>
|
|
private readonly IXDefaultEmbeddingService embeddingService;
|
|
|
|
/// <summary>
|
|
/// File Context Extractor Service ...
|
|
/// </summary>
|
|
private readonly IXFileContentExtractor fileContentExtractor;
|
|
|
|
public ChatWithDocumentsController(
|
|
IXDefaultAiService aiService,
|
|
ILogger<ChatWithDocumentsController> logger,
|
|
XAppConfiguration appConfiguration,
|
|
IXIdentityProvider identityProvider,
|
|
IXDefaultEmbeddingService embeddingService,
|
|
XValidationProvider validationProvider,
|
|
IXFileContentExtractor fileContentExtractor
|
|
) : base(logger, appConfiguration, identityProvider, validationProvider)
|
|
{
|
|
this.aiService = aiService;
|
|
this.embeddingService = embeddingService;
|
|
this.fileContentExtractor = fileContentExtractor;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Dispose ...
|
|
/// </summary>
|
|
public void Dispose()
|
|
{
|
|
vectorStore.Clear();
|
|
}
|
|
}
|
|
} |