feat(fetch-requests): pdf/xlsx source types + trust_fallback create field
This commit is contained in:
@@ -13,7 +13,7 @@ import { EmptyState } from "../ui/EmptyState";
|
|||||||
import { formatApiError } from "../features/fetch-requests";
|
import { formatApiError } from "../features/fetch-requests";
|
||||||
import { useToast } from "../ui/Toast";
|
import { useToast } from "../ui/Toast";
|
||||||
|
|
||||||
const CREATE_FIELDS = ["account", "bank", "pipeline", "start_date", "end_date", "source"];
|
const CREATE_FIELDS = ["account", "bank", "pipeline", "trust_fallback", "start_date", "end_date", "source"];
|
||||||
|
|
||||||
function FetchRequestList() {
|
function FetchRequestList() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ export type FetchRequestStatus =
|
|||||||
| "completed"
|
| "completed"
|
||||||
| "failed";
|
| "failed";
|
||||||
|
|
||||||
|
export type SourceType = "file" | "pdf" | "xlsx" | "email";
|
||||||
|
|
||||||
export interface FileSource {
|
export interface FileSource {
|
||||||
|
type?: SourceType;
|
||||||
path: string;
|
path: string;
|
||||||
bank: string;
|
bank: string;
|
||||||
raw_lines?: string[];
|
raw_lines?: string[];
|
||||||
@@ -17,7 +20,16 @@ export interface FileSource {
|
|||||||
txn_dicts_count?: number;
|
txn_dicts_count?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface PdfSource extends FileSource {
|
||||||
|
type: "pdf";
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface XlsxSource extends FileSource {
|
||||||
|
type: "xlsx";
|
||||||
|
}
|
||||||
|
|
||||||
export interface EmailSource {
|
export interface EmailSource {
|
||||||
|
type: "email";
|
||||||
bank: string;
|
bank: string;
|
||||||
from_email?: string;
|
from_email?: string;
|
||||||
subject?: string;
|
subject?: string;
|
||||||
@@ -28,10 +40,13 @@ export interface EmailSource {
|
|||||||
|
|
||||||
export type PipelineType = "heuristic" | "llm" | "llama_parse";
|
export type PipelineType = "heuristic" | "llm" | "llama_parse";
|
||||||
|
|
||||||
|
export type TrustFallback = "amount" | "balance";
|
||||||
|
|
||||||
export interface FetchRequestCreate {
|
export interface FetchRequestCreate {
|
||||||
source: FileSource | EmailSource;
|
source: PdfSource | XlsxSource | FileSource | EmailSource;
|
||||||
account_name: string;
|
account_name: string;
|
||||||
pipeline?: PipelineType;
|
pipeline?: PipelineType;
|
||||||
|
trust_fallback?: TrustFallback | null;
|
||||||
payor_username?: string;
|
payor_username?: string;
|
||||||
start_date?: string;
|
start_date?: string;
|
||||||
end_date?: string;
|
end_date?: string;
|
||||||
@@ -113,7 +128,7 @@ export interface SSEEvent {
|
|||||||
export interface FetchRequestFilters {
|
export interface FetchRequestFilters {
|
||||||
status?: FetchRequestStatus[];
|
status?: FetchRequestStatus[];
|
||||||
account_name?: string;
|
account_name?: string;
|
||||||
source_type?: "file" | "email";
|
source_type?: SourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatApiError(err: any): string {
|
export function formatApiError(err: any): string {
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ export type {
|
|||||||
FetchRequestStatus,
|
FetchRequestStatus,
|
||||||
FetchRequestFilters,
|
FetchRequestFilters,
|
||||||
FileSource,
|
FileSource,
|
||||||
|
PdfSource,
|
||||||
|
XlsxSource,
|
||||||
|
SourceType,
|
||||||
EmailSource,
|
EmailSource,
|
||||||
UploadResult,
|
UploadResult,
|
||||||
PendingAmbiguity,
|
PendingAmbiguity,
|
||||||
@@ -15,6 +18,7 @@ export type {
|
|||||||
SSEEventStatus,
|
SSEEventStatus,
|
||||||
ProgressMessage,
|
ProgressMessage,
|
||||||
PipelineType,
|
PipelineType,
|
||||||
|
TrustFallback,
|
||||||
} from "./fetch-requests.models";
|
} from "./fetch-requests.models";
|
||||||
export { RETRY_MAX, formatApiError } from "./fetch-requests.models";
|
export { RETRY_MAX, formatApiError } from "./fetch-requests.models";
|
||||||
export {
|
export {
|
||||||
|
|||||||
Reference in New Issue
Block a user