Refactor: rename OpenAIReceiptParser to AIReceiptParser

Rename to reflect multi-provider support (OpenAI + Anthropic):
- Rename Services/OpenAIReceiptParser.cs to Services/AIReceiptParser.cs
- Update class name from OpenAIReceiptParser to AIReceiptParser
- Update DI registration in Program.cs

The parser now supports both OpenAI and Anthropic models, so the more generic name better reflects its capabilities.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
AJ
2025-10-19 16:19:27 -04:00
parent f7c6b2691b
commit 86b7312dd6
30 changed files with 31 additions and 80 deletions

View File

@@ -4,7 +4,13 @@
"Bash(git add:*)", "Bash(git add:*)",
"Bash(git commit:*)", "Bash(git commit:*)",
"Bash(dotnet ef migrations:*)", "Bash(dotnet ef migrations:*)",
"Bash(dotnet ef database:*)" "Bash(dotnet ef database:*)",
"Bash(mkdir \"C:\\Users\\AJ\\Desktop\\MoneyMap\\MoneyMap\\Prompts\")",
"Bash(dotnet build)",
"Bash(dotnet build --no-restore /p:UseAppHost=false)",
"Bash(dotnet build /property:UseAppHost=false)",
"Bash(git reset --soft d0f4b42)",
"Bash(git reset HEAD)"
], ],
"deny": [], "deny": [],
"ask": [] "ask": []

View File

@@ -1,6 +1,4 @@
using System; using Microsoft.EntityFrameworkCore;
using System.Text.RegularExpressions;
using Microsoft.EntityFrameworkCore;
using MoneyMap.Models; using MoneyMap.Models;
using MoneyMap.Services; using MoneyMap.Services;

View File

@@ -1,5 +1,4 @@
using System; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable

View File

@@ -1,5 +1,4 @@
using System; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable

View File

@@ -1,5 +1,4 @@
using System; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable

View File

@@ -1,5 +1,4 @@
using System; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable

View File

@@ -1,6 +1,5 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Transactions;
namespace MoneyMap.Models; namespace MoneyMap.Models;

View File

@@ -1,5 +1,5 @@
using System.ComponentModel.DataAnnotations;
using MoneyMap.Services; using MoneyMap.Services;
using System.ComponentModel.DataAnnotations;
namespace MoneyMap.Models; namespace MoneyMap.Models;

View File

@@ -1,7 +1,6 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Transactions;
namespace MoneyMap.Models; namespace MoneyMap.Models;

View File

@@ -1,6 +1,3 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;

View File

@@ -1,6 +1,3 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;

View File

@@ -1,15 +1,11 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using MoneyMap.Data; using MoneyMap.Data;
using MoneyMap.Services; using MoneyMap.Services;
using System.ComponentModel.DataAnnotations;
using System.Text;
using System.Text.Json;
namespace MoneyMap.Pages namespace MoneyMap.Pages
{ {

View File

@@ -1,9 +1,8 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using MoneyMap.Data; using MoneyMap.Data;
using MoneyMap.Models; using MoneyMap.Models;
using System.ComponentModel.DataAnnotations;
namespace MoneyMap.Pages namespace MoneyMap.Pages
{ {

View File

@@ -1,10 +1,9 @@
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using MoneyMap.Data; using MoneyMap.Data;
using MoneyMap.Models; using MoneyMap.Models;
using System.ComponentModel.DataAnnotations;
namespace MoneyMap.Pages namespace MoneyMap.Pages
{ {

View File

@@ -1,7 +1,3 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;

View File

@@ -1,6 +1,6 @@
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Diagnostics;
namespace MoneyMap.Pages namespace MoneyMap.Pages
{ {

View File

@@ -1,6 +1,3 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using MoneyMap.Data; using MoneyMap.Data;

View File

@@ -1,12 +1,9 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using MoneyMap.Data; using MoneyMap.Data;
using MoneyMap.Models; using MoneyMap.Models;
using System.ComponentModel.DataAnnotations;
namespace MoneyMap.Pages namespace MoneyMap.Pages
{ {

View File

@@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace MoneyMap.Pages namespace MoneyMap.Pages
{ {

View File

@@ -1,5 +1,3 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;

View File

@@ -2,7 +2,6 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using MoneyMap.Data; using MoneyMap.Data;
using MoneyMap.Models;
using MoneyMap.Services; using MoneyMap.Services;
namespace MoneyMap.Pages namespace MoneyMap.Pages

View File

@@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;

View File

@@ -1,11 +1,5 @@
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Text.RegularExpressions;
using CsvHelper; using CsvHelper;
using CsvHelper.Configuration; using CsvHelper.Configuration;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
@@ -13,6 +7,9 @@ using MoneyMap.Data;
using MoneyMap.Models; using MoneyMap.Models;
using MoneyMap.Models.Import; using MoneyMap.Models.Import;
using MoneyMap.Services; using MoneyMap.Services;
using System.Globalization;
using System.Text.Json;
using System.Text.RegularExpressions;
namespace MoneyMap.Pages namespace MoneyMap.Pages
{ {

View File

@@ -1,4 +1,3 @@
using CsvHelper;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using MoneyMap.Data; using MoneyMap.Data;
using MoneyMap.Pages; using MoneyMap.Pages;
@@ -34,7 +33,7 @@ builder.Services.AddScoped<IRecentTransactionsProvider, RecentTransactionsProvid
builder.Services.AddScoped<ISpendTrendsProvider, SpendTrendsProvider>(); builder.Services.AddScoped<ISpendTrendsProvider, SpendTrendsProvider>();
builder.Services.AddScoped<IReceiptManager, ReceiptManager>(); builder.Services.AddScoped<IReceiptManager, ReceiptManager>();
builder.Services.AddScoped<IReceiptAutoMapper, ReceiptAutoMapper>(); builder.Services.AddScoped<IReceiptAutoMapper, ReceiptAutoMapper>();
builder.Services.AddHttpClient<IReceiptParser, OpenAIReceiptParser>(); builder.Services.AddHttpClient<IReceiptParser, AIReceiptParser>();
// AI categorization service // AI categorization service
builder.Services.AddHttpClient<ITransactionAICategorizer, TransactionAICategorizer>(); builder.Services.AddHttpClient<ITransactionAICategorizer, TransactionAICategorizer>();

View File

@@ -12,7 +12,7 @@ namespace MoneyMap.Services
Task<ReceiptParseResult> ParseReceiptAsync(long receiptId, string? model = null); Task<ReceiptParseResult> ParseReceiptAsync(long receiptId, string? model = null);
} }
public class OpenAIReceiptParser : IReceiptParser public class AIReceiptParser : IReceiptParser
{ {
private readonly MoneyMapContext _db; private readonly MoneyMapContext _db;
private readonly IWebHostEnvironment _environment; private readonly IWebHostEnvironment _environment;
@@ -22,7 +22,7 @@ namespace MoneyMap.Services
private readonly IServiceProvider _serviceProvider; private readonly IServiceProvider _serviceProvider;
private string? _promptTemplate; private string? _promptTemplate;
public OpenAIReceiptParser( public AIReceiptParser(
MoneyMapContext db, MoneyMapContext db,
IWebHostEnvironment environment, IWebHostEnvironment environment,
IConfiguration configuration, IConfiguration configuration,

View File

@@ -1,4 +1,3 @@
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using MoneyMap.Data; using MoneyMap.Data;
using MoneyMap.Models; using MoneyMap.Models;

View File

@@ -1,14 +1,8 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using MoneyMap.Data; using MoneyMap.Data;
using MoneyMap.Models; using MoneyMap.Models;
using System;
using System.IO;
using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace MoneyMap.Services namespace MoneyMap.Services
{ {

View File

@@ -1,10 +1,9 @@
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using MoneyMap.Data; using MoneyMap.Data;
using MoneyMap.Models; using MoneyMap.Models;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace MoneyMap.Services; namespace MoneyMap.Services;

View File

@@ -1,8 +1,4 @@
using System; using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using MoneyMap.Data; using MoneyMap.Data;
namespace MoneyMap.Services namespace MoneyMap.Services

View File

@@ -1,4 +1,3 @@
using System.Linq;
using MoneyMap.Models; using MoneyMap.Models;
namespace MoneyMap.Services namespace MoneyMap.Services