mirror of
https://github.com/artiemis/artemis.js.git
synced 2026-02-14 10:21:54 +00:00
dont include language when no text was detected
This commit is contained in:
parent
79a0a61a15
commit
1d628e5722
@ -27,7 +27,7 @@ export function buildOcrPayload(
|
|||||||
try {
|
try {
|
||||||
return (
|
return (
|
||||||
new Intl.DisplayNames(["en"], { type: "language" }).of(language) ??
|
new Intl.DisplayNames(["en"], { type: "language" }).of(language) ??
|
||||||
"unknown"
|
"Unknown"
|
||||||
);
|
);
|
||||||
} catch {
|
} catch {
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
@ -54,12 +54,15 @@ export function buildOcrPayload(
|
|||||||
{
|
{
|
||||||
description: text,
|
description: text,
|
||||||
color: model === "yandex" ? 0xffdb4d : 0x4285f4,
|
color: model === "yandex" ? 0xffdb4d : 0x4285f4,
|
||||||
fields: [
|
fields:
|
||||||
{
|
text !== "No text detected"
|
||||||
name: "Detected language",
|
? [
|
||||||
value: languageName,
|
{
|
||||||
},
|
name: "Detected language",
|
||||||
],
|
value: languageName,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: [],
|
||||||
...(imageUrl ? { image: { url: imageUrl } } : {}),
|
...(imageUrl ? { image: { url: imageUrl } } : {}),
|
||||||
author: {
|
author: {
|
||||||
name: capitalize(model),
|
name: capitalize(model),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user