From 7e403a8623bdcdf847979a75807977a552d99e78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A2=D0=B8=D0=BC=D1=83=D1=80=20=D0=93=D0=BE=D1=80=D0=BE?= =?UTF-8?q?=D0=B4=D0=B5=D1=86=D0=BA=D0=B8=D0=B9?= Date: Wed, 16 Sep 2026 15:01:04 +0500 Subject: [PATCH] =?UTF-8?q?feat:=20=D0=B8=D0=B7=D0=B2=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D0=B0=D1=8E=20=D1=82=D0=B5=D0=BA=D1=81=D1=82=20PDF=20=D1=87?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=B7=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=B9=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Step2CommercialOffers/useKpProcessing.ts | 8 ++++++++ .../forms/ct/services/CtService.ts | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/webparts/ctFormsPortal/forms/ct/components/Step2CommercialOffers/useKpProcessing.ts b/src/webparts/ctFormsPortal/forms/ct/components/Step2CommercialOffers/useKpProcessing.ts index 32d3fee..9caf562 100644 --- a/src/webparts/ctFormsPortal/forms/ct/components/Step2CommercialOffers/useKpProcessing.ts +++ b/src/webparts/ctFormsPortal/forms/ct/components/Step2CommercialOffers/useKpProcessing.ts @@ -240,6 +240,7 @@ export function useKpProcessing( patchFile(entry.localId, { spId, status: 'extracting' }); const isWord = /\.(doc|docx|xls|xlsx)$/i.test(entry.file.name); + const isPdf = /\.pdf$/i.test(entry.file.name); if (isWord) { try { await service.extractWordText(spId); @@ -247,6 +248,13 @@ export function useKpProcessing( patchFile(entry.localId, { status: 'error', error: `Ошибка извлечения текста Word: ${(err as Error).message}` }); continue; } + } else if (isPdf) { + try { + await service.extractPDFText(spId); + } catch (err) { + patchFile(entry.localId, { status: 'error', error: `Ошибка извлечения текста PDF: ${(err as Error).message}` }); + continue; + } } pollSyntex(entry.localId, spId, name, 0).catch(err => { diff --git a/src/webparts/ctFormsPortal/forms/ct/services/CtService.ts b/src/webparts/ctFormsPortal/forms/ct/services/CtService.ts index 6fcdec2..4cbefb4 100644 --- a/src/webparts/ctFormsPortal/forms/ct/services/CtService.ts +++ b/src/webparts/ctFormsPortal/forms/ct/services/CtService.ts @@ -1406,6 +1406,24 @@ export class CtService { throw new Error(`Ошибка извлечения текста Word: ${res.status}`); } + async extractPDFText(itemId: number): Promise { + const token = await this._getApiToken(); + const res = await fetch(`${EXTERNAL_API}/Document/extractPDFText`, { + method: "POST", + headers: { + Authorization: `Bearer ${token}`, + "Content-Type": "application/json", + }, + body: JSON.stringify({ + siteUrl: this.baseUrl, + libraryName: KP_LIBRARY_DISPLAY_NAME, + itemId: String(itemId), + }), + }); + if (!res.ok) + throw new Error(`Ошибка извлечения текста PDF: ${res.status}`); + } + async triggerFlow( fileName: string, fileId: number,