This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using Api.Models.Settings;
|
||||
using Rag.Models.Settings;
|
||||
using Api.Data.Repositories.Contracts;
|
||||
using Api.Clients.Ai.Contracts;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Api.Models.Settings;
|
||||
using Rag.Models.Settings;
|
||||
using Api.Clients.Ai.Contracts;
|
||||
|
||||
namespace Api.Clients.Ai;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Api.Services.Contracts;
|
||||
using Api.Models.Requests;
|
||||
using Rag.Models.Requests;
|
||||
|
||||
namespace Api.Controllers;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Api.Models;
|
||||
using Rag.Models;
|
||||
|
||||
namespace Api.Data.Repositories.Contracts;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ using Api.Data;
|
||||
using Api.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Api.Data.Repositories.Contracts;
|
||||
using Api.Models;
|
||||
using Rag.Models;
|
||||
|
||||
namespace Api.Data.Repositories;
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace Api.Models
|
||||
{
|
||||
public sealed class DocumentClassification
|
||||
{
|
||||
public required string DocumentType { get; init; }
|
||||
public double Confidence { get; init; }
|
||||
public required string Title { get; init; }
|
||||
public Dictionary<string, string> Metadata { get; init; } = new Dictionary<string, string>();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace Api.Models
|
||||
{
|
||||
public sealed class RagChunkRecord
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
public required string DocumentId { get; init; }
|
||||
public int ChunkIndex { get; init; }
|
||||
public required string Text { get; init; }
|
||||
public required float[] Embedding { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace Api.Models
|
||||
{
|
||||
public sealed class RagDocumentDetails
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
public required string DocumentType { get; init; }
|
||||
public required string Title { get; init; }
|
||||
public string? SourceUrl { get; init; }
|
||||
public required string Text { get; init; }
|
||||
public required string TextHash { get; init; }
|
||||
public DateTimeOffset CreatedAt { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace Api.Models
|
||||
{
|
||||
public sealed class RagDocumentRecord
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
public required string DocumentType { get; init; }
|
||||
public required string Title { get; init; }
|
||||
public string? SourceUrl { get; init; }
|
||||
public required string Text { get; init; }
|
||||
public required string TextHash { get; init; }
|
||||
public double TypeConfidence { get; init; }
|
||||
public string MetadataJson { get; init; } = "{}";
|
||||
public DateTimeOffset CreatedAt { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace Api.Models.Requests
|
||||
{
|
||||
public sealed class IndexDocumentRequest
|
||||
{
|
||||
public string? Text { get; set; }
|
||||
public string? SourceUrl { get; set; }
|
||||
public string? DocumentType { get; set; }
|
||||
public string? Title { get; set; }
|
||||
public Dictionary<string, string>? Metadata { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace Api.Models.Requests
|
||||
{
|
||||
public sealed class SearchRequest
|
||||
{
|
||||
public required string QueryText { get; init; }
|
||||
public IReadOnlyList<string>? TargetDocumentTypes { get; init; }
|
||||
public int? TopK { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
namespace Api.Models.Responses
|
||||
{
|
||||
public sealed class IndexDocumentResponse
|
||||
{
|
||||
public required string DocumentId { get; init; }
|
||||
public required string TextHash { get; init; }
|
||||
public required string DocumentType { get; init; }
|
||||
public double DocumentTypeConfidence { get; init; }
|
||||
public required string Title { get; init; }
|
||||
public int Chunks { get; init; }
|
||||
public int Characters { get; init; }
|
||||
public bool Cached { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
namespace Api.Models.Responses
|
||||
{
|
||||
public sealed class SearchResponse
|
||||
{
|
||||
public IReadOnlyList<SearchDocumentResult> Results { get; init; } = System.Array.Empty<SearchDocumentResult>();
|
||||
}
|
||||
|
||||
public sealed class SearchDocumentResult
|
||||
{
|
||||
public required string DocumentId { get; init; }
|
||||
public required string DocumentType { get; init; }
|
||||
public required string Title { get; init; }
|
||||
public string? SourceUrl { get; init; }
|
||||
public double Score { get; init; }
|
||||
public IReadOnlyList<SearchChunkResult> MatchedChunks { get; init; } = System.Array.Empty<SearchChunkResult>();
|
||||
}
|
||||
|
||||
public sealed class SearchChunkResult
|
||||
{
|
||||
public required string ChunkId { get; init; }
|
||||
public int ChunkIndex { get; init; }
|
||||
public required string Text { get; init; }
|
||||
public double Score { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace Api.Models
|
||||
{
|
||||
public sealed class SearchCandidateChunk
|
||||
{
|
||||
public required RagDocumentRecord Document { get; init; }
|
||||
public required RagChunkRecord Chunk { get; init; }
|
||||
public double Score { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace Api.Models.Settings;
|
||||
|
||||
public sealed class AiSettings
|
||||
{
|
||||
public string Provider { get; set; } = "OpenAI";
|
||||
public OpenAiProviderSettings OpenAI { get; set; } = new();
|
||||
public OllamaProviderSettings Ollama { get; set; } = new();
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Api.Models.Settings;
|
||||
|
||||
public sealed class InternalApiSettings
|
||||
{
|
||||
public string ApiKey { get; set; } = string.Empty;
|
||||
public bool RequireApiKey { get; set; } = false;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace Api.Models.Settings;
|
||||
|
||||
public sealed class OllamaProviderSettings
|
||||
{
|
||||
public string BaseUrl { get; set; } = "http://localhost:11434";
|
||||
public string ChatModel { get; set; } = "llama3.1:8b";
|
||||
public string EmbeddingModel { get; set; } = "nomic-embed-text";
|
||||
public int TimeoutSeconds { get; set; } = 180;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace Api.Models.Settings;
|
||||
|
||||
public sealed class OpenAiProviderSettings
|
||||
{
|
||||
public string ApiKey { get; set; } = string.Empty;
|
||||
public string ChatModel { get; set; } = "gpt-4o-mini";
|
||||
public string EmbeddingModel { get; set; } = "text-embedding-3-small";
|
||||
public int TimeoutSeconds { get; set; } = 90;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace Api.Models.Settings;
|
||||
|
||||
public sealed class RagSettings
|
||||
{
|
||||
public int MaxFileSizeMb { get; set; } = 8;
|
||||
public int ChunkSize { get; set; } = 900;
|
||||
public int ChunkOverlap { get; set; } = 150;
|
||||
public int MaxTextChars { get; set; } = 60000;
|
||||
public int DefaultTopK { get; set; } = 20;
|
||||
public int MaxTopK { get; set; } = 50;
|
||||
public bool ClassifyWithAi { get; set; } = false;
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@ using Api.Services.Contracts;
|
||||
using Serilog;
|
||||
using System.Reflection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Api.Models.Settings;
|
||||
using Rag.Models.Settings;
|
||||
using Api.Data.Repositories.Contracts;
|
||||
using Api.Data.Repositories;
|
||||
using Api.Clients.Ai.Contracts;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Api.Models;
|
||||
using Rag.Models;
|
||||
|
||||
namespace Api.Services.Contracts;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Api.Models;
|
||||
using Api.Models.Requests;
|
||||
using Api.Models.Responses;
|
||||
using Rag.Models;
|
||||
using Rag.Models.Requests;
|
||||
using Rag.Models.Responses;
|
||||
|
||||
namespace Api.Services.Contracts;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using Api.Services.Contracts;
|
||||
using Api.Models;
|
||||
using Rag.Models;
|
||||
|
||||
namespace Api.Services;
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using System.Text.Json;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Api.Services.Contracts;
|
||||
using Api.Models.Requests;
|
||||
using Api.Models.Responses;
|
||||
using Api.Models.Settings;
|
||||
using Rag.Models.Requests;
|
||||
using Rag.Models.Responses;
|
||||
using Rag.Models.Settings;
|
||||
using Api.Data.Repositories.Contracts;
|
||||
using Api.Clients.Ai.Contracts;
|
||||
using Api.Clients.Ai;
|
||||
using Api.Models;
|
||||
using Rag.Models;
|
||||
|
||||
namespace Api.Services;
|
||||
|
||||
|
||||
@@ -75,4 +75,8 @@
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="10.1.7" />
|
||||
<PackageReference Include="Refit.HttpClientFactory" Version="10.1.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\rag-api-models\rag-api-models.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user