feat(expense-categories): AI 建議 for group/sub name + 990 line
ci-cd-vm / ci-cd (push) Successful in 2m25s
ci-cd-vm / ci-cd (push) Successful in 2m25s
Add an AI assist button to the Edit/New Group (大項) and Subcategory (小項) dialogs: the user enters a Chinese name, and the model refines the Chinese, translates it to English, and suggests the matching IRS Form 990 Part IX line. Suggestions surface in a confirm card; Apply fills the Chinese name, English name, and 990 line fields. Backend mirrors the existing expense-classification AI family but over the Form 990 line catalog: IExpenseCategoryAiService + base (catalog load, prompt, id validation) + Claude/Gemini providers + factory that picks the provider from ChurchProfile.AiProvider. New write-gated POST api/expense-categories/ai-suggest endpoint; sub-category requests pass the parent group + its 990 line to bias the choice. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -29,3 +29,37 @@ public class ExpenseAiSuggestion
|
||||
/// <summary>Model self-reported confidence in the classification, 0..1.</summary>
|
||||
public double Confidence { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request body for the expense-category AI assist endpoint: refine the name, translate to English,
|
||||
/// and suggest a Form 990 line for an expense category (大項/小項) being defined or edited.
|
||||
/// </summary>
|
||||
public class ExpenseCategoryAiRequest
|
||||
{
|
||||
/// <summary>The user-typed Chinese name (the primary input).</summary>
|
||||
public string Name_zh { get; set; } = "";
|
||||
/// <summary>The English name, if already typed (extra context for the model).</summary>
|
||||
public string? Name_en { get; set; }
|
||||
/// <summary>"group" (大項) or "sub" (小項); selects the prompt framing.</summary>
|
||||
public string Level { get; set; } = "group";
|
||||
/// <summary>For a sub-category: the parent group's bilingual name, used for context.</summary>
|
||||
public string? ParentGroupName { get; set; }
|
||||
/// <summary>For a sub-category: the parent group's mapped Form 990 line id, used to bias the choice.</summary>
|
||||
public int? ParentForm990LineId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// AI suggestion for an expense category: a refined Chinese name, an English translation, and a
|
||||
/// proposed Form 990 line. Line fields are null when the model returned an id outside the live catalog.
|
||||
/// </summary>
|
||||
public class CategoryAiSuggestion
|
||||
{
|
||||
/// <summary>Typo-corrected, refined Traditional Chinese name.</summary>
|
||||
public string? ChineseName { get; set; }
|
||||
public string? EnglishName { get; set; }
|
||||
public int? Form990LineId { get; set; }
|
||||
/// <summary>Bilingual label of the suggested line, e.g. "16 — Occupancy / 場地".</summary>
|
||||
public string? Form990LineLabel { get; set; }
|
||||
/// <summary>Model self-reported confidence in the mapping, 0..1.</summary>
|
||||
public double Confidence { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user