mirror of
https://github.com/immich-app/immich.git
synced 2025-12-17 17:23:20 +03:00
feat: getAssetOcr endpoint (#23331)
* feat: getAssetOcr endpoint * pr feedback
This commit is contained in:
@@ -546,6 +546,32 @@ export type AssetMetadataResponseDto = {
|
||||
export type AssetMetadataUpsertDto = {
|
||||
items: AssetMetadataUpsertItemDto[];
|
||||
};
|
||||
export type AssetOcrResponseDto = {
|
||||
assetId: string;
|
||||
/** Confidence score for text detection box */
|
||||
boxScore: number;
|
||||
id: string;
|
||||
/** Recognized text */
|
||||
text: string;
|
||||
/** Confidence score for text recognition */
|
||||
textScore: number;
|
||||
/** Normalized x coordinate of box corner 1 (0-1) */
|
||||
x1: number;
|
||||
/** Normalized x coordinate of box corner 2 (0-1) */
|
||||
x2: number;
|
||||
/** Normalized x coordinate of box corner 3 (0-1) */
|
||||
x3: number;
|
||||
/** Normalized x coordinate of box corner 4 (0-1) */
|
||||
x4: number;
|
||||
/** Normalized y coordinate of box corner 1 (0-1) */
|
||||
y1: number;
|
||||
/** Normalized y coordinate of box corner 2 (0-1) */
|
||||
y2: number;
|
||||
/** Normalized y coordinate of box corner 3 (0-1) */
|
||||
y3: number;
|
||||
/** Normalized y coordinate of box corner 4 (0-1) */
|
||||
y4: number;
|
||||
};
|
||||
export type AssetMediaReplaceDto = {
|
||||
assetData: Blob;
|
||||
deviceAssetId: string;
|
||||
@@ -2390,6 +2416,19 @@ export function getAssetMetadataByKey({ id, key }: {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* This endpoint requires the `asset.read` permission.
|
||||
*/
|
||||
export function getAssetOcr({ id }: {
|
||||
id: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: AssetOcrResponseDto[];
|
||||
}>(`/assets/${encodeURIComponent(id)}/ocr`, {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* This endpoint requires the `asset.download` permission.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user