uploading pdfs, including images now at claim

This commit is contained in:
2025-06-25 23:30:40 +05:30
parent 795a17bcad
commit aefcf950e8
7 changed files with 205 additions and 444 deletions

View File

@@ -6,27 +6,44 @@ export interface SeleniumPayload {
originalname: string;
bufferBase64: string;
}[];
images: {
originalname: string;
bufferBase64: string;
}[];
}
export async function forwardToSeleniumAgent(
claimData: any,
files: Express.Multer.File[]
): Promise<any> {
const payload: SeleniumPayload = {
claim: claimData,
pdfs: files.map(file => ({
const pdfs = files
.filter((file) => file.mimetype === "application/pdf")
.map((file) => ({
originalname: file.originalname,
bufferBase64: file.buffer.toString("base64"),
})),
}));
const images = files
.filter((file) => file.mimetype.startsWith("image/"))
.map((file) => ({
originalname: file.originalname,
bufferBase64: file.buffer.toString("base64"),
}));
const payload: SeleniumPayload = {
claim: claimData,
pdfs,
images,
};
const response = await axios.post("http://localhost:5002/start-workflow", payload);
const response = await axios.post(
"http://localhost:5002/start-workflow",
payload
);
return response.data;
}
export async function forwardToSeleniumAgent2(
): Promise<any> {
export async function forwardToSeleniumAgent2(): Promise<any> {
const response = await axios.post("http://localhost:5002/fetch-pdf");
return response.data;
}