Skip to content

Commit

Permalink
Fixed images_ocr passed as a task to addImage request (#910)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlymonkai authored Feb 20, 2025
1 parent 3b5cd95 commit a75adb3
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
9 changes: 8 additions & 1 deletion packages/network/src/api/image/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ function createBeautyShotImageData(
): AddImageData {
const filename = `${options.sightId}-${options.inspectionId}-${Date.now()}.${filetype}`;
const tasks = options.tasks.filter(
(task) => ![TaskName.COMPLIANCES, TaskName.HUMAN_IN_THE_LOOP].includes(task),
(task) =>
![TaskName.COMPLIANCES, TaskName.HUMAN_IN_THE_LOOP, TaskName.IMAGES_OCR].includes(task),
) as ApiImagePostTask[];
tasks.push({
name: TaskName.COMPLIANCES,
Expand All @@ -298,6 +299,12 @@ function createBeautyShotImageData(
image_details: { sight_label: sights[options.sightId].label },
});
}
if (options.tasks.includes(TaskName.IMAGES_OCR)) {
tasks.push({
name: TaskName.IMAGES_OCR,
image_details: { image_type: 'VIN' },
});
}

const body: ApiImagePost = {
acquisition: {
Expand Down
24 changes: 22 additions & 2 deletions packages/network/src/api/models/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import type { ApiAdditionalData, ApiCenterOnElement, ApiLabelPrediction } from '
import type { ApiRenderedOutputs } from './renderedOutput';
import type { ApiImageComplianceResults } from './compliance';
import type { ApiViews } from './view';
import { ApiBusinessTaskName, ApiHinlTaskPost, ApiImageCompliancesTaskPost } from './task';
import {
ApiBusinessTaskName,
ApiHinlTaskPost,
ApiImageCompliancesTaskPost,
ApiImagesOCRTaskPost,
} from './task';

export type ApiImageType = 'unknown' | 'beauty_shot' | 'close_up';

Expand Down Expand Up @@ -79,7 +84,22 @@ export interface ApiCompliance {
zoom_level?: ApiComplianceParameters;
}

export type ApiImagePostTask = ApiBusinessTaskName | ApiImageCompliancesTaskPost | ApiHinlTaskPost;
export type ApiImagePostTask =
| Omit<
ApiBusinessTaskName,
| 'repair_estimate'
| 'images_ocr'
| 'image_editing'
| 'inspection_pdf'
| 'pricing'
| 'zoom_level'
| 'coverage_360'
| 'iqa_compliance'
| 'human_in_the_loop'
>
| ApiImageCompliancesTaskPost
| ApiHinlTaskPost
| ApiImagesOCRTaskPost;

export interface ApiImagePost {
acquisition: ApiAcquisition;
Expand Down
12 changes: 11 additions & 1 deletion packages/network/src/api/models/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export type ApiBusinessTaskName =
| 'zoom_level'
| 'coverage_360'
| 'iqa_compliance'
| 'compliances';
| 'compliances'
| 'human_in_the_loop';

export interface ApiImageCompliancesDetails {
sight_id: string;
Expand All @@ -37,6 +38,15 @@ export interface ApiHinlTaskPost {
image_details: ApiHinlImageDetails;
}

export interface ApiImagesOCRImageDetails {
image_type: 'VIN';
}

export interface ApiImagesOCRTaskPost {
name: 'images_ocr';
image_details: ApiImagesOCRImageDetails;
}

export type ApiTaskProgressStatus =
| 'NOT_STARTED'
| 'TODO'
Expand Down

0 comments on commit a75adb3

Please sign in to comment.