fix: update Blob creation for file uploads to handle buffer offsets correctly
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
import { Controller, Get } from '@nestjs/common';
|
import { Controller, Get } from '@nestjs/common';
|
||||||
import { Public } from '../auth/decorators/public.decorator';
|
import { Public } from '../auth/decorators/public.decorator';
|
||||||
import { AI_CATEGORIZATION_MODEL } from './ai.service';
|
import { AI_CATEGORIZATION_MODEL } from './ai.service';
|
||||||
import { RECEIPT_IMPORT_MODEL } from '../receipt-import/receipt-import.service';
|
|
||||||
|
const RECEIPT_IMPORT_MODEL = 'mistral-small-2603';
|
||||||
|
|
||||||
export interface AiModelInfo {
|
export interface AiModelInfo {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export class QuickImportService {
|
|||||||
const form = new FormData();
|
const form = new FormData();
|
||||||
form.append(
|
form.append(
|
||||||
'file',
|
'file',
|
||||||
new Blob([file.buffer], { type: file.mimetype }),
|
new Blob([file.buffer.buffer.slice(file.buffer.byteOffset, file.buffer.byteOffset + file.buffer.byteLength)], { type: file.mimetype }),
|
||||||
file.originalname,
|
file.originalname,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export class ReceiptImportService {
|
|||||||
const form = new FormData();
|
const form = new FormData();
|
||||||
form.append(
|
form.append(
|
||||||
'file',
|
'file',
|
||||||
new Blob([file.buffer], { type: file.mimetype }),
|
new Blob([file.buffer.buffer.slice(file.buffer.byteOffset, file.buffer.byteOffset + file.buffer.byteLength)], { type: file.mimetype }),
|
||||||
file.originalname,
|
file.originalname,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user