mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat: getAssetOcr endpoint (#23331)
* feat: getAssetOcr endpoint * pr feedback
This commit is contained in:
parent
8d25f81bec
commit
9098717c55
12 changed files with 560 additions and 0 deletions
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue