Heaven K Claude Opus 4.6 (1M context) commited on
Commit
2099286
·
1 Parent(s): 2f12493

fix: prevent AI from translating names and emails during extraction

Browse files

Added explicit rule to the extraction prompt: never translate any text,
keep all names, messages, and fields exactly as they appear in the
original email (e.g. "Trois-Rivières" stays as-is, not "Three Rivers").

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

packages/server/src/services/aiService.ts CHANGED
@@ -19,6 +19,7 @@ export const EXTRACTION_PROMPT = `You are a financial data extraction assistant.
19
  - status: One of "deposited", "pending", "expired", "cancelled"
20
 
21
  Rules:
 
22
  - If a field is not found, set it to null.
23
  - The amount must be a number (e.g., 150.00 not "$150.00").
24
  - If the email is NOT an Interac e-Transfer notification, return all fields as null with amount as 0.
 
19
  - status: One of "deposited", "pending", "expired", "cancelled"
20
 
21
  Rules:
22
+ - NEVER translate any text. Extract names, messages, emails, and all fields EXACTLY as they appear in the original email. Keep French, English, or any other language as-is. For example "Trois-Rivières" must stay "Trois-Rivières", NOT "Three Rivers".
23
  - If a field is not found, set it to null.
24
  - The amount must be a number (e.g., 150.00 not "$150.00").
25
  - If the email is NOT an Interac e-Transfer notification, return all fields as null with amount as 0.