@@ -1,83 +0,0 @@
|
|||||||
{
|
|
||||||
"Serilog": {
|
|
||||||
"MinimumLevel": {
|
|
||||||
"Default": "Debug",
|
|
||||||
"Override": {
|
|
||||||
"Microsoft.AspNetCore": "Information",
|
|
||||||
"Microsoft.AspNetCore.Hosting": "Information",
|
|
||||||
"Microsoft.AspNetCore.Routing": "Warning",
|
|
||||||
"System.Net.Http.HttpClient": "Warning",
|
|
||||||
"Api": "Debug"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"WriteTo": [
|
|
||||||
{
|
|
||||||
"Name": "Console",
|
|
||||||
"Args": {
|
|
||||||
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext}: {Message:lj}{NewLine}{Exception}"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "File",
|
|
||||||
"Args": {
|
|
||||||
"path": "logs/dev-.log",
|
|
||||||
"rollingInterval": "Day",
|
|
||||||
"retainedFileCountLimit": 7,
|
|
||||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {SourceContext}: {Message:lj}{NewLine}{Exception}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Information",
|
|
||||||
"Microsoft.AspNetCore.Hosting": "Information",
|
|
||||||
"Microsoft.AspNetCore.Routing": "Warning",
|
|
||||||
"System.Net.Http.HttpClient": "Warning",
|
|
||||||
"Api": "Debug"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"LogEnvironmentOnStartup": true,
|
|
||||||
"KeyVault": {
|
|
||||||
"VaultUri": "",
|
|
||||||
"Enabled": false
|
|
||||||
},
|
|
||||||
"Google": {
|
|
||||||
"TagManagerId": "",
|
|
||||||
"MapKey": ""
|
|
||||||
},
|
|
||||||
"Contact": {
|
|
||||||
"ToEmail": "",
|
|
||||||
"FromEmail": "",
|
|
||||||
"SubjectPrefix": ""
|
|
||||||
},
|
|
||||||
"Subscribe": {
|
|
||||||
"ToEmail": "",
|
|
||||||
"SubjectPrefix": ""
|
|
||||||
},
|
|
||||||
"Smtp": {
|
|
||||||
"Host": "mail.example.com",
|
|
||||||
"Port": 587,
|
|
||||||
"Username": "",
|
|
||||||
"Password": "",
|
|
||||||
"UseStartTls": false
|
|
||||||
},
|
|
||||||
"Captcha": {
|
|
||||||
"Provider": "Recaptcha",
|
|
||||||
"SecretKey": "",
|
|
||||||
"PublicKey": "",
|
|
||||||
"MinimumScore": 0.5
|
|
||||||
},
|
|
||||||
"FileStorage": {
|
|
||||||
"Path": "Files",
|
|
||||||
"DefaultFileName": "",
|
|
||||||
"ToEmail": "",
|
|
||||||
"FromEmail": "",
|
|
||||||
"SubjectPrefix": "[File Download]"
|
|
||||||
},
|
|
||||||
"CvMatcherApi": {
|
|
||||||
"BaseUrl": "",
|
|
||||||
"InternalApiKey": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -105,5 +105,9 @@
|
|||||||
"ToEmail": "",
|
"ToEmail": "",
|
||||||
"FromEmail": "",
|
"FromEmail": "",
|
||||||
"SubjectPrefix": "[File Download]"
|
"SubjectPrefix": "[File Download]"
|
||||||
|
},
|
||||||
|
"CvMatcherApi": {
|
||||||
|
"BaseUrl": "",
|
||||||
|
"InternalApiKey": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
namespace CvMatcher.Models.Settings;
|
|
||||||
|
|
||||||
public sealed class SmtpSettings
|
|
||||||
{
|
|
||||||
public string Host { get; set; } = string.Empty;
|
|
||||||
public int Port { get; set; } = 587;
|
|
||||||
public string Username { get; set; } = string.Empty;
|
|
||||||
public string Password { get; set; } = string.Empty;
|
|
||||||
public bool UseStartTls { get; set; } = true;
|
|
||||||
public string FromEmail { get; set; } = "noreply@myai.ro";
|
|
||||||
public string ToEmail { get; set; } = string.Empty;
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
using System.Reflection;
|
|
||||||
using Api.Clients.Ai;
|
using Api.Clients.Ai;
|
||||||
using Api.Clients.Ai.Contracts;
|
using Api.Clients.Ai.Contracts;
|
||||||
using Api.Clients.Api;
|
using Api.Clients.Api;
|
||||||
@@ -14,6 +13,8 @@ using Refit;
|
|||||||
using Serilog;
|
using Serilog;
|
||||||
using Shared.Models.Settings;
|
using Shared.Models.Settings;
|
||||||
using StartupHelpers;
|
using StartupHelpers;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
StartupExtensions.LoadDotEnvFile();
|
StartupExtensions.LoadDotEnvFile();
|
||||||
|
|
||||||
@@ -29,11 +30,11 @@ try
|
|||||||
|
|
||||||
builder.AddAzureKeyVaultIfConfigured();
|
builder.AddAzureKeyVaultIfConfigured();
|
||||||
|
|
||||||
|
builder.Services.Configure<DatabaseSettings>(builder.Configuration.GetSection("Database"));
|
||||||
builder.Services.Configure<RagApiSettings>(builder.Configuration.GetSection("RagApi"));
|
builder.Services.Configure<RagApiSettings>(builder.Configuration.GetSection("RagApi"));
|
||||||
builder.Services.Configure<InternalApiSettings>(builder.Configuration.GetSection("InternalApi"));
|
builder.Services.Configure<InternalApiSettings>(builder.Configuration.GetSection("InternalApi"));
|
||||||
builder.Services.Configure<CvMatcher.Models.Settings.AiSettings>(builder.Configuration.GetSection("Ai"));
|
builder.Services.Configure<CvMatcher.Models.Settings.AiSettings>(builder.Configuration.GetSection("Ai"));
|
||||||
builder.Services.Configure<MatcherSettings>(builder.Configuration.GetSection("Matcher"));
|
builder.Services.Configure<MatcherSettings>(builder.Configuration.GetSection("Matcher"));
|
||||||
builder.Services.Configure<SmtpSettings>(builder.Configuration.GetSection("Smtp"));
|
|
||||||
|
|
||||||
builder.Services.AddRefitClient<IRefitRagApi>()
|
builder.Services.AddRefitClient<IRefitRagApi>()
|
||||||
.ConfigureHttpClient((sp, c) =>
|
.ConfigureHttpClient((sp, c) =>
|
||||||
@@ -49,9 +50,15 @@ try
|
|||||||
builder.Services.AddScoped<IRagApiClient, RagApiClient>();
|
builder.Services.AddScoped<IRagApiClient, RagApiClient>();
|
||||||
builder.Services.AddHttpClient<IMatcherAiClient, MatcherAiClient>();
|
builder.Services.AddHttpClient<IMatcherAiClient, MatcherAiClient>();
|
||||||
builder.Services.AddHttpClient<IJobTextExtractor, JobTextExtractor>();
|
builder.Services.AddHttpClient<IJobTextExtractor, JobTextExtractor>();
|
||||||
|
|
||||||
builder.Services.AddDbContext<CvMatcherDbContext>(options =>
|
builder.Services.AddDbContext<CvMatcherDbContext>(options =>
|
||||||
options.UseSqlServer(builder.Configuration.GetConnectionString("CvMatcherDb")
|
{
|
||||||
?? throw new InvalidOperationException("Connection string 'CvMatcherDb' is missing.")));
|
var configuration = builder.Configuration;
|
||||||
|
var connectionString = builder.Services.GetConfiguredDbConnectionString(configuration);
|
||||||
|
|
||||||
|
options.UseSqlServer(connectionString);
|
||||||
|
});
|
||||||
|
|
||||||
builder.Services.AddScoped<IMatcherRepository, EfMatcherRepository>();
|
builder.Services.AddScoped<IMatcherRepository, EfMatcherRepository>();
|
||||||
builder.Services.AddScoped<ICvMatcherService, CvMatcherService>();
|
builder.Services.AddScoped<ICvMatcherService, CvMatcherService>();
|
||||||
|
|
||||||
|
|||||||
@@ -73,8 +73,13 @@
|
|||||||
"VaultUri": "",
|
"VaultUri": "",
|
||||||
"Enabled": false
|
"Enabled": false
|
||||||
},
|
},
|
||||||
"ConnectionStrings": {
|
"Database": {
|
||||||
"CvMatcherDb": "Server=localhost,1433;Database=MyAiCvMatcher;User Id=sa;Password=Your_strong_password123;TrustServerCertificate=True"
|
"Host": "localhost",
|
||||||
|
"Port": 1433,
|
||||||
|
"Name": "MyAiCvMatcher",
|
||||||
|
"User": "sa",
|
||||||
|
"Password": "",
|
||||||
|
"TrustServerCertificate": true
|
||||||
},
|
},
|
||||||
"InternalApi": {
|
"InternalApi": {
|
||||||
"ApiKey": "",
|
"ApiKey": "",
|
||||||
@@ -101,14 +106,5 @@
|
|||||||
"TopK": 10,
|
"TopK": 10,
|
||||||
"DeepScoreTopN": 5,
|
"DeepScoreTopN": 5,
|
||||||
"MaxJobTextChars": 60000
|
"MaxJobTextChars": 60000
|
||||||
},
|
|
||||||
"Smtp": {
|
|
||||||
"Host": "",
|
|
||||||
"Port": 587,
|
|
||||||
"Username": "",
|
|
||||||
"Password": "",
|
|
||||||
"UseStartTls": true,
|
|
||||||
"FromEmail": "noreply@myai.ro",
|
|
||||||
"ToEmail": ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
# .env.production - production environment variables for docker-compose
|
||||||
|
# DO NOT commit real secrets to git
|
||||||
|
|
||||||
|
# Common
|
||||||
|
ASPNETCORE_ENVIRONMENT=Production
|
||||||
|
|
||||||
|
# API (main)
|
||||||
|
ASPNETCORE_URLS=http://+:8080
|
||||||
|
APP_ENVIRONMENT_NAME=easySoft.ro-Production
|
||||||
|
|
||||||
|
# SMTP
|
||||||
|
Smtp__Host=mail.easysoft.ro
|
||||||
|
Smtp__Port=587
|
||||||
|
Smtp__Username=no-reply@myai.ro
|
||||||
|
Smtp__Password=37,_,tunSis
|
||||||
|
Smtp__UseStartTls=true
|
||||||
|
|
||||||
|
# AI settings
|
||||||
|
Ai__Provider=OpenAI
|
||||||
|
Ai__OpenAI__ApiKey=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
|
||||||
|
Ai__OpenAI__ChatModel=gpt-4o-mini
|
||||||
|
Ai__OpenAI__EmbeddingModel=text-embedding-3-small
|
||||||
|
Ai__OpenAI__TimeoutSeconds=60
|
||||||
|
Ai__Ollama__BaseUrl=
|
||||||
|
Ai__Ollama__ChatModel=
|
||||||
|
Ai__Ollama__EmbeddingModel=
|
||||||
|
Ai__Ollama__TimeoutSeconds=
|
||||||
|
|
||||||
|
# Captcha
|
||||||
|
Captcha__Provider=Recaptcha
|
||||||
|
Captcha__SecretKey=6LfR3NUsAAAAAP6ZDeJMmksyHZMkApQ29Kb4xZ5v
|
||||||
|
Captcha__PublicKey=6LfR3NUsAAAAAH1bFYTKlgwp9SBKf5IRB2IOrhBe
|
||||||
|
Captcha__MinimumScore=0.5
|
||||||
|
|
||||||
|
# File Storage
|
||||||
|
FileStorage__Path=/opt/myai/files
|
||||||
|
FileStorage__DefaultFileName=
|
||||||
|
FileStorage__ToEmail=webmaster@myai.ro
|
||||||
|
FileStorage__SubjectPrefix=[File Download]
|
||||||
|
|
||||||
|
# Contact / Subscribe
|
||||||
|
Contact__ToEmail=contact@myai.ro
|
||||||
|
Contact__SubjectPrefix=[Contact]
|
||||||
|
Subscribe__ToEmail=contact@myai.ro
|
||||||
|
Subscribe__SubjectPrefix=[Subscribe]
|
||||||
|
|
||||||
|
# CORS
|
||||||
|
Cors__AllowedOrigins__0=https://myai.ro
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
Logging__LogLevel__Default=Information
|
||||||
|
Logging__LogLevel__Microsoft=Warning
|
||||||
|
Logging__LogLevel__Microsoft__AspNetCore=Warning
|
||||||
|
Logging__LogLevel__Api=Information
|
||||||
|
|
||||||
|
# Serilog
|
||||||
|
Serilog__WriteTo__2__Args__fromEmail=no-reply@myai.ro
|
||||||
|
Serilog__WriteTo__2__Args__toEmail=webmaster@myai.ro
|
||||||
|
Serilog__WriteTo__2__Args__mailServer=mail.easysoft.ro
|
||||||
|
Serilog__WriteTo__2__Args__networkCredential__userName=no-reply@myai.ro
|
||||||
|
Serilog__WriteTo__2__Args__networkCredential__password=37,_,tunSis
|
||||||
|
Serilog__WriteTo__2__Args__port=587
|
||||||
|
Serilog__WriteTo__2__Args__enableSsl=true
|
||||||
|
|
||||||
|
# CvMatcher API internal
|
||||||
|
CvMatcherApi__BaseUrl=http://cv-matcher-api:8081
|
||||||
|
CvMatcherApi__InternalApiKey=614ffeda-6300-4cb8-acad-806679daa7ec
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
# .env.staging - staging environment variables for docker-compose
|
||||||
|
# DO NOT commit real secrets to git
|
||||||
|
|
||||||
|
# Common
|
||||||
|
ASPNETCORE_ENVIRONMENT=Staging
|
||||||
|
|
||||||
|
# API (main)
|
||||||
|
ASPNETCORE_URLS=http://+:8080
|
||||||
|
APP_ENVIRONMENT_NAME=myai.ro-Staging
|
||||||
|
|
||||||
|
# SMTP
|
||||||
|
Smtp__Host=mail.easysoft.ro
|
||||||
|
Smtp__Port=587
|
||||||
|
Smtp__Username=no-reply-staging@easysoft.ro
|
||||||
|
Smtp__Password=37,_,tunSis
|
||||||
|
Smtp__UseStartTls=true
|
||||||
|
|
||||||
|
# AI settings
|
||||||
|
Ai__Provider=OpenAI
|
||||||
|
Ai__OpenAI__ApiKey=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
|
||||||
|
Ai__OpenAI__ChatModel=gpt-4
|
||||||
|
Ai__OpenAI__EmbeddingModel=text-embedding-3-large
|
||||||
|
Ai__OpenAI__TimeoutSeconds=30
|
||||||
|
Ai__Ollama__BaseUrl=
|
||||||
|
Ai__Ollama__ChatModel=
|
||||||
|
Ai__Ollama__EmbeddingModel=
|
||||||
|
Ai__Ollama__TimeoutSeconds=
|
||||||
|
|
||||||
|
# Captcha
|
||||||
|
Captcha__Provider=Recaptcha
|
||||||
|
Captcha__SecretKey=6LfR3NUsAAAAAP6ZDeJMmksyHZMkApQ29Kb4xZ5v
|
||||||
|
Captcha__PublicKey=6LfR3NUsAAAAAH1bFYTKlgwp9SBKf5IRB2IOrhBe
|
||||||
|
Captcha__MinimumScore=0.5
|
||||||
|
|
||||||
|
# File Storage
|
||||||
|
FileStorage__Path=/opt/easysoft/files
|
||||||
|
FileStorage__DefaultFileName=
|
||||||
|
FileStorage__ToEmail=webmaster-staging@easysoft.ro
|
||||||
|
FileStorage__SubjectPrefix=[File Download]
|
||||||
|
|
||||||
|
# Contact / Subscribe
|
||||||
|
Contact__ToEmail=contact-staging@easysoft.ro
|
||||||
|
Contact__SubjectPrefix=[Contact]
|
||||||
|
Subscribe__ToEmail=contact-staging@easysoft.ro
|
||||||
|
Subscribe__SubjectPrefix=[Subscribe]
|
||||||
|
|
||||||
|
# CORS
|
||||||
|
Cors__AllowedOrigins__0=http://localhost:3000
|
||||||
|
Cors__AllowedOrigins__1=http://localhost:5000
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
Logging__LogLevel__Default=Information
|
||||||
|
Logging__LogLevel__Microsoft=Warning
|
||||||
|
Logging__LogLevel__Microsoft__AspNetCore=Warning
|
||||||
|
Logging__LogLevel__Api=Information
|
||||||
|
|
||||||
|
# Serilog
|
||||||
|
Serilog__WriteTo__2__Args__fromEmail=no-reply-staging@easysoft.ro
|
||||||
|
Serilog__WriteTo__2__Args__toEmail=webmaster-staging@easysoft.ro
|
||||||
|
Serilog__WriteTo__2__Args__mailServer=mail.easysoft.ro
|
||||||
|
Serilog__WriteTo__2__Args__networkCredential__userName=no-reply-staging@easysoft.ro
|
||||||
|
Serilog__WriteTo__2__Args__networkCredential__password=37,_,tunSis
|
||||||
|
Serilog__WriteTo__2__Args__port=587
|
||||||
|
Serilog__WriteTo__2__Args__enableSsl=true
|
||||||
|
|
||||||
|
# CvMatcher API internal
|
||||||
|
CvMatcherApi__BaseUrl=http://cv-matcher-api:8081
|
||||||
|
CvMatcherApi__InternalApiKey=614ffeda-6300-4cb8-acad-806679daa7ec
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
# .env.template - Template of environment variables for docker-compose
|
||||||
|
# Copy this file to `.env.production` or `.env.staging` and fill the secret values.
|
||||||
|
# Do NOT commit your `.env.*` files containing real secrets.
|
||||||
|
|
||||||
|
# Common
|
||||||
|
ASPNETCORE_ENVIRONMENT=Development
|
||||||
|
|
||||||
|
# API (main)
|
||||||
|
ASPNETCORE_URLS=http://+:8080
|
||||||
|
APP_ENVIRONMENT_NAME=myai-Development
|
||||||
|
|
||||||
|
# SMTP Configuration
|
||||||
|
Smtp__Host=your.smtp.host
|
||||||
|
Smtp__Port=587
|
||||||
|
Smtp__Username=your-smtp-username
|
||||||
|
Smtp__Password=
|
||||||
|
Smtp__UseStartTls=true
|
||||||
|
|
||||||
|
# AI Settings (choose provider: OpenAI or Ollama)
|
||||||
|
Ai__Provider=OpenAI
|
||||||
|
|
||||||
|
# OpenAI settings
|
||||||
|
Ai__OpenAI__ApiKey=
|
||||||
|
Ai__OpenAI__ChatModel=gpt-4
|
||||||
|
Ai__OpenAI__EmbeddingModel=text-embedding-3-large
|
||||||
|
Ai__OpenAI__TimeoutSeconds=30
|
||||||
|
|
||||||
|
# Ollama settings
|
||||||
|
Ai__Ollama__BaseUrl=http://localhost:11434
|
||||||
|
Ai__Ollama__ChatModel=llama2
|
||||||
|
Ai__Ollama__EmbeddingModel=embedding-model
|
||||||
|
Ai__Ollama__TimeoutSeconds=30
|
||||||
|
|
||||||
|
# Captcha
|
||||||
|
Captcha__Provider=Recaptcha
|
||||||
|
Captcha__SecretKey=
|
||||||
|
Captcha__PublicKey=
|
||||||
|
Captcha__MinimumScore=0.5
|
||||||
|
|
||||||
|
# File Storage
|
||||||
|
FileStorage__Path=/opt/easysoft/files
|
||||||
|
FileStorage__DefaultFileName=
|
||||||
|
FileStorage__ToEmail=
|
||||||
|
FileStorage__SubjectPrefix=[File Download]
|
||||||
|
|
||||||
|
# Contact / Subscribe
|
||||||
|
Contact__ToEmail=
|
||||||
|
Contact__SubjectPrefix=[Contact]
|
||||||
|
Subscribe__ToEmail=
|
||||||
|
Subscribe__SubjectPrefix=[Subscribe]
|
||||||
|
|
||||||
|
# CORS
|
||||||
|
Cors__AllowedOrigins__0=http://localhost:3000
|
||||||
|
Cors__AllowedOrigins__1=http://localhost:5000
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
Logging__LogLevel__Default=Information
|
||||||
|
Logging__LogLevel__Microsoft=Warning
|
||||||
|
Logging__LogLevel__Microsoft__AspNetCore=Warning
|
||||||
|
Logging__LogLevel__Api=Information
|
||||||
|
|
||||||
|
# Serilog
|
||||||
|
Serilog__WriteTo__2__Args__fromEmail=
|
||||||
|
Serilog__WriteTo__2__Args__toEmail=
|
||||||
|
Serilog__WriteTo__2__Args__mailServer=
|
||||||
|
Serilog__WriteTo__2__Args__networkCredential__userName=
|
||||||
|
Serilog__WriteTo__2__Args__networkCredential__password=
|
||||||
|
Serilog__WriteTo__2__Args__port=587
|
||||||
|
Serilog__WriteTo__2__Args__enableSsl=true
|
||||||
|
|
||||||
|
# CvMatcher API internal
|
||||||
|
CvMatcherApi__BaseUrl=http://cv-matcher-api:8081
|
||||||
|
CvMatcherApi__InternalApiKey=
|
||||||
@@ -9,7 +9,9 @@
|
|||||||
<ProjectVersion>2.1</ProjectVersion>
|
<ProjectVersion>2.1</ProjectVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include=".env" />
|
<None Include=".env.production" />
|
||||||
|
<None Include=".env.staging" />
|
||||||
|
<None Include=".env.template" />
|
||||||
<None Include="docker-compose.yml" />
|
<None Include="docker-compose.yml" />
|
||||||
<None Include="docker-compose.staging.yml">
|
<None Include="docker-compose.staging.yml">
|
||||||
<DependentUpon>docker-compose.yml</DependentUpon>
|
<DependentUpon>docker-compose.yml</DependentUpon>
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ services:
|
|||||||
- Serilog__WriteTo__2__Args__networkCredential__password=${Smtp__Password}
|
- Serilog__WriteTo__2__Args__networkCredential__password=${Smtp__Password}
|
||||||
- Serilog__WriteTo__2__Args__port=587
|
- Serilog__WriteTo__2__Args__port=587
|
||||||
- Serilog__WriteTo__2__Args__enableSsl=true
|
- Serilog__WriteTo__2__Args__enableSsl=true
|
||||||
- OpenAI__ApiKey=${OpenAI__ApiKey}
|
- Ai__OpenAI__ApiKey=${Ai__OpenAI__ApiKey}
|
||||||
- OpenAI__ChatModel=gpt-4o-mini
|
- Ai__OpenAI__ChatModel=${Ai__OpenAI__ChatModel}
|
||||||
- OpenAI__EmbeddingModel=text-embedding-3-small
|
- Ai__OpenAI__EmbeddingModel=${Ai__OpenAI__EmbeddingModel}
|
||||||
- OpenAI__TimeoutSeconds=60
|
- Ai__OpenAI__TimeoutSeconds=${Ai__OpenAI__TimeoutSeconds}
|
||||||
- Rag__MaxPdfSizeMb=5
|
- Rag__MaxPdfSizeMb=5
|
||||||
- Rag__ChunkSize=900
|
- Rag__ChunkSize=900
|
||||||
- Rag__ChunkOverlap=150
|
- Rag__ChunkOverlap=150
|
||||||
|
|||||||
+9
-2
@@ -26,14 +26,21 @@ try
|
|||||||
|
|
||||||
builder.AddAzureKeyVaultIfConfigured();
|
builder.AddAzureKeyVaultIfConfigured();
|
||||||
|
|
||||||
|
builder.Services.Configure<DatabaseSettings>(builder.Configuration.GetSection("Database"));
|
||||||
builder.Services.Configure<RagSettings>(builder.Configuration.GetSection("Rag"));
|
builder.Services.Configure<RagSettings>(builder.Configuration.GetSection("Rag"));
|
||||||
builder.Services.Configure<Rag.Models.Settings.AiSettings>(builder.Configuration.GetSection("Ai"));
|
builder.Services.Configure<Rag.Models.Settings.AiSettings>(builder.Configuration.GetSection("Ai"));
|
||||||
builder.Services.Configure<InternalApiSettings>(builder.Configuration.GetSection("InternalApi"));
|
builder.Services.Configure<InternalApiSettings>(builder.Configuration.GetSection("InternalApi"));
|
||||||
|
|
||||||
builder.Services.AddDbContext<RagDbContext>(options =>
|
builder.Services.AddDbContext<RagDbContext>(options =>
|
||||||
options.UseSqlServer(builder.Configuration.GetConnectionString("RagDb")
|
{
|
||||||
?? throw new InvalidOperationException("Connection string 'RagDb' is missing.")));
|
var configuration = builder.Configuration;
|
||||||
|
var connectionString = builder.Services.GetConfiguredDbConnectionString(configuration);
|
||||||
|
|
||||||
|
options.UseSqlServer(connectionString);
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.Services.AddHttpClient<RagAiClient>();
|
||||||
|
builder.Services.AddScoped<IRagRepository, EfRagRepository>();
|
||||||
builder.Services.AddHttpClient<RagAiClient>();
|
builder.Services.AddHttpClient<RagAiClient>();
|
||||||
builder.Services.AddScoped<IRagRepository, EfRagRepository>();
|
builder.Services.AddScoped<IRagRepository, EfRagRepository>();
|
||||||
builder.Services.AddScoped<IAiClient, CachedRagAiClient>();
|
builder.Services.AddScoped<IAiClient, CachedRagAiClient>();
|
||||||
|
|||||||
@@ -73,8 +73,13 @@
|
|||||||
"VaultUri": "",
|
"VaultUri": "",
|
||||||
"Enabled": false
|
"Enabled": false
|
||||||
},
|
},
|
||||||
"ConnectionStrings": {
|
"Database": {
|
||||||
"RagDb": "Server=localhost,1433;Database=MyAiRag;User Id=sa;Password=Your_strong_password123;TrustServerCertificate=True"
|
"Host": "localhost",
|
||||||
|
"Port": 1433,
|
||||||
|
"Name": "MyAiCvMatcher",
|
||||||
|
"User": "sa",
|
||||||
|
"Password": "",
|
||||||
|
"TrustServerCertificate": true
|
||||||
},
|
},
|
||||||
"InternalApi": {
|
"InternalApi": {
|
||||||
"ApiKey": "",
|
"ApiKey": "",
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
namespace Shared.Models.Settings
|
||||||
|
{
|
||||||
|
public class DatabaseSettings
|
||||||
|
{
|
||||||
|
public string Host { get; set; } = "";
|
||||||
|
public int Port { get; set; }
|
||||||
|
public string Name { get; set; } = "";
|
||||||
|
public string User { get; set; } = "";
|
||||||
|
public string Password { get; set; } = "";
|
||||||
|
public bool TrustServerCertificate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Shared.Models.Settings;
|
||||||
|
|
||||||
|
namespace StartupHelpers;
|
||||||
|
|
||||||
|
public static class DatabaseExtensions
|
||||||
|
{
|
||||||
|
public static string GetConfiguredDbConnectionString(this IServiceCollection services, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
var dbOptions = configuration
|
||||||
|
.GetSection("Database")
|
||||||
|
.Get<DatabaseSettings>()
|
||||||
|
?? throw new InvalidOperationException("Database config missing");
|
||||||
|
|
||||||
|
return
|
||||||
|
$"Server={dbOptions.Host},{dbOptions.Port};" +
|
||||||
|
$"Database={dbOptions.Name};" +
|
||||||
|
$"User Id={dbOptions.User};" +
|
||||||
|
$"Password={dbOptions.Password};" +
|
||||||
|
$"TrustServerCertificate={dbOptions.TrustServerCertificate};";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,4 +21,8 @@
|
|||||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="10.1.7" />
|
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="10.1.7" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\shared-models\shared-models.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user