feat: adds PDF import with conversion to JSON 1.0

- Accept only PDF and JSON files in import modal and API
- Convert PDF statements to JSON 1.0 via LLM (OpenAI-compatible)
- Use multipart/form-data for file upload (multer, 15 MB limit)
- Add LLM_API_KEY and LLM_API_BASE_URL for configurable LLM endpoint
- Update ImportModal to validate type and send FormData
- Add postFormData to API client for file upload
This commit is contained in:
Anton
2026-03-13 13:38:02 +03:00
parent d1536b8872
commit 975f2c4fd2
13 changed files with 745 additions and 48 deletions

View File

@@ -2,7 +2,12 @@ import type { ImportStatementResponse } from '@family-budget/shared';
import { api } from './client';
export async function importStatement(
file: unknown,
file: File,
): Promise<ImportStatementResponse> {
return api.post<ImportStatementResponse>('/api/import/statement', file);
const formData = new FormData();
formData.append('file', file);
return api.postFormData<ImportStatementResponse>(
'/api/import/statement',
formData,
);
}