mirror of
https://github.com/FranP-code/inbox-negotiator.git
synced 2025-10-13 00:42:26 +00:00
Add AI parsing capabilities for debt information and update database schema
- Implemented AI-powered parsing for debt emails using Google's Gemini model. - Enhanced Postmark webhook to extract debt details including amount, vendor, description, due date, and legitimacy. - Updated database schema to include new columns for AI-extracted data. - Added environment variable requirements and updated package dependencies. - Created migration script for new database columns and indexes.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
-- Add new columns for AI-enhanced debt parsing
|
||||
-- Migration for improved debt information storage
|
||||
|
||||
-- Add new columns to debts table
|
||||
ALTER TABLE debts ADD COLUMN IF NOT EXISTS description text;
|
||||
ALTER TABLE debts ADD COLUMN IF NOT EXISTS due_date timestamptz;
|
||||
ALTER TABLE debts ADD COLUMN IF NOT EXISTS metadata jsonb DEFAULT '{}'::jsonb;
|
||||
|
||||
-- Create indexes for new columns
|
||||
CREATE INDEX IF NOT EXISTS idx_debts_due_date ON debts(due_date);
|
||||
CREATE INDEX IF NOT EXISTS idx_debts_metadata ON debts USING gin(metadata);
|
||||
|
||||
-- Add comment for documentation
|
||||
COMMENT ON COLUMN debts.description IS 'AI-extracted description of what the debt is for';
|
||||
COMMENT ON COLUMN debts.due_date IS 'Due date extracted from the email, if mentioned';
|
||||
COMMENT ON COLUMN debts.metadata IS 'Additional metadata including isDebtCollection flag and other AI-extracted information';
|
||||
Reference in New Issue
Block a user