Config: Update Program.cs with new service registrations

- Add AddMemoryCache() for TransactionCategorizer caching
- Register IPdfToImageConverter
- Register OpenAIVisionClient and ClaudeVisionClient with HttpClient
- Update AIReceiptParser registration to use scoped instead of HttpClient

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-24 21:12:04 -05:00
parent 9f64c7784a
commit f42d5e87f9

View File

@@ -1,7 +1,6 @@
using Microsoft.EntityFrameworkCore;
using MoneyMap.Data;
using MoneyMap.Pages;
using MoneyMap.Services; // Add this for the services
using MoneyMap.Services;
var builder = WebApplication.CreateBuilder(args);
@@ -9,6 +8,9 @@ builder.Services.AddRazorPages();
builder.Services.AddDbContext<MoneyMapContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("MoneyMapDb")));
// Add memory cache for services like TransactionCategorizer
builder.Services.AddMemoryCache();
// Add session support
builder.Services.AddDistributedMemoryCache();
builder.Services.AddSession(options =>
@@ -43,9 +45,16 @@ builder.Services.AddScoped<IDashboardStatsCalculator, DashboardStatsCalculator>(
builder.Services.AddScoped<ITopCategoriesProvider, TopCategoriesProvider>();
builder.Services.AddScoped<IRecentTransactionsProvider, RecentTransactionsProvider>();
builder.Services.AddScoped<ISpendTrendsProvider, SpendTrendsProvider>();
// Receipt services
builder.Services.AddScoped<IReceiptManager, ReceiptManager>();
builder.Services.AddScoped<IReceiptAutoMapper, ReceiptAutoMapper>();
builder.Services.AddHttpClient<IReceiptParser, AIReceiptParser>();
builder.Services.AddScoped<IPdfToImageConverter, PdfToImageConverter>();
// AI vision clients
builder.Services.AddHttpClient<OpenAIVisionClient>();
builder.Services.AddHttpClient<ClaudeVisionClient>();
builder.Services.AddScoped<IReceiptParser, AIReceiptParser>();
// AI categorization service
builder.Services.AddHttpClient<ITransactionAICategorizer, TransactionAICategorizer>();