Feature: Add AI-Powered Categorization section to Recategorize page
Add new card for AI categorization alongside rule-based: - Rename existing section to "Rule-Based Categorization" - Add "AI-Powered Categorization" section with provider badge - Link to AICategorizePreview for AI category suggestions - Display explanation of how AI categorization works - Inject IConfiguration to read AI provider setting Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -48,10 +48,10 @@
|
|||||||
|
|
||||||
<div class="card shadow-sm mb-3">
|
<div class="card shadow-sm mb-3">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<strong>Auto-Categorize Existing Transactions</strong>
|
<strong>Rule-Based Categorization</strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p>Use the category mappings to automatically categorize transactions that are already in your database.</p>
|
<p>Use the category mappings to automatically categorize transactions based on pattern matching.</p>
|
||||||
|
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@@ -87,6 +87,51 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="card shadow-sm mb-3">
|
||||||
|
<div class="card-header d-flex justify-content-between align-items-center">
|
||||||
|
<strong>AI-Powered Categorization</strong>
|
||||||
|
<span class="badge bg-info">@Model.AIProvider</span>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<p>Use AI to analyze transaction names and suggest categories. High-confidence matches will automatically create new mapping rules for future use.</p>
|
||||||
|
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="border rounded p-3 h-100">
|
||||||
|
<h5 class="mb-3">AI Categorize Uncategorized</h5>
|
||||||
|
<p class="text-muted small">
|
||||||
|
Process up to 50 uncategorized transactions. Review AI suggestions before applying.
|
||||||
|
</p>
|
||||||
|
@if (Model.Stats.Uncategorized > 0)
|
||||||
|
{
|
||||||
|
<a asp-page="/AICategorizePreview" class="btn btn-success">
|
||||||
|
AI Categorize with Preview
|
||||||
|
</a>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<button type="button" class="btn btn-success" disabled>
|
||||||
|
AI Categorize with Preview
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="border rounded p-3 h-100">
|
||||||
|
<h5 class="mb-3">How AI Categorization Works</h5>
|
||||||
|
<ul class="text-muted small mb-0">
|
||||||
|
<li>AI analyzes transaction name, memo, and amount</li>
|
||||||
|
<li>Suggests category and canonical merchant name</li>
|
||||||
|
<li>Creates pattern rules for 70%+ confidence matches</li>
|
||||||
|
<li>Future transactions auto-match the new rules</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="card shadow-sm">
|
<div class="card shadow-sm">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<strong>How It Works</strong>
|
<strong>How It Works</strong>
|
||||||
|
|||||||
@@ -11,15 +11,22 @@ namespace MoneyMap.Pages
|
|||||||
private readonly MoneyMapContext _db;
|
private readonly MoneyMapContext _db;
|
||||||
private readonly ITransactionCategorizer _categorizer;
|
private readonly ITransactionCategorizer _categorizer;
|
||||||
private readonly ITransactionStatisticsService _statsService;
|
private readonly ITransactionStatisticsService _statsService;
|
||||||
|
private readonly IConfiguration _config;
|
||||||
|
|
||||||
public RecategorizeModel(MoneyMapContext db, ITransactionCategorizer categorizer, ITransactionStatisticsService statsService)
|
public RecategorizeModel(
|
||||||
|
MoneyMapContext db,
|
||||||
|
ITransactionCategorizer categorizer,
|
||||||
|
ITransactionStatisticsService statsService,
|
||||||
|
IConfiguration config)
|
||||||
{
|
{
|
||||||
_db = db;
|
_db = db;
|
||||||
_categorizer = categorizer;
|
_categorizer = categorizer;
|
||||||
_statsService = statsService;
|
_statsService = statsService;
|
||||||
|
_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecategorizeStats Stats { get; set; } = new();
|
public RecategorizeStats Stats { get; set; } = new();
|
||||||
|
public string AIProvider => _config["AI:CategorizationProvider"] ?? "OpenAI";
|
||||||
|
|
||||||
[TempData]
|
[TempData]
|
||||||
public string? SuccessMessage { get; set; }
|
public string? SuccessMessage { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user