@epam/ai-dial-chat-hooks 1.2.0-dev.1 → 1.2.0-dev.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/attachment/useAttachmentValidation/useAttachmentValidation.js +26 -19
- package/attachments.d.ts +10 -4
- package/catalog/map-deployment-to-catalog-item.js +2 -2
- package/catalog/map-skill-to-catalog-item.js +48 -48
- package/catalog/publish.js +2 -1
- package/catalog/useApplicationCredentials/useApplicationCredentials.js +39 -0
- package/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js +39 -39
- package/catalog/useSkillItemDetails.js +19 -17
- package/catalog.d.ts +60 -5
- package/catalog.js +15 -14
- package/conversation/announcement-message.js +16 -5
- package/conversation/conversation-transfer/queue.js +8 -5
- package/conversation/stage.js +23 -0
- package/conversation/useAttachmentUpload/useAttachmentUpload.js +12 -5
- package/conversation/useConversationHandlers/useConversationHandlers.js +13 -17
- package/conversation/useConversationImport/useConversationImport.js +1 -1
- package/conversation/useConversationScroll/useConversationScroll.js +68 -64
- package/conversation/useConversationStream/apply-chunk.js +1 -1
- package/conversation/useConversationStream/useConversationStream.js +5 -1
- package/conversation/useTranscribeAudio/transcription-retry.js +5 -4
- package/conversation-overlay.d.ts +7 -0
- package/conversation-overlay.js +2 -0
- package/conversation.d.ts +139 -7
- package/conversation.js +24 -23
- package/file-manager-canvas.d.ts +398 -0
- package/file-manager-canvas.js +2 -0
- package/file-manager.d.ts +71 -330
- package/file-manager.js +15 -15
- package/files/attachment-canvas.js +51 -13
- package/files/attachment-types.js +14 -13
- package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +1 -5
- package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +43 -0
- package/index.d.ts +761 -29
- package/index.js +123 -111
- package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +7 -5
- package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +1 -1
- package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +25 -23
- package/mcp-apps.d.ts +8 -6
- package/package.json +37 -18
- package/scheduled-task/scheduled-task-description.js +77 -0
- package/scheduled-task/scheduled-task-preparation.js +24 -0
- package/scheduled-task/scheduled-tasks-api-client.js +19 -0
- package/scheduled-task/use-scheduled-task-runs.js +82 -0
- package/scheduled-task/use-scheduled-tasks.js +93 -0
- package/scheduled-tasks.d.ts +178 -0
- package/scheduled-tasks.js +7 -2
- package/skill/skill.js +10 -7
- package/skill/useSkillArchiveImport/useSkillArchiveImport.js +75 -0
- package/skill/useSkillEditorLoad.js +29 -28
- package/skill/useSkillEditorSubmit.js +92 -75
- package/skill-editor.d.ts +107 -0
- package/skill-editor.js +9 -8
- package/usage/map-usage-data-to-dashboard.js +66 -0
- package/usage/map-user-usage-to-model-limits.js +160 -0
- package/usage.d.ts +120 -0
- package/usage.js +3 -0
package/catalog.js
CHANGED
|
@@ -8,17 +8,18 @@ import { mapDeploymentDetailsDtoToEntityDetails as u, mapEntityDetailsToCatalogD
|
|
|
8
8
|
import { mapDeploymentToCatalogItem as p, mapDeploymentToolsetCredentials as m, mapToolsetToCatalogItem as h, resolveDeploymentFolder as g } from "./catalog/map-deployment-to-catalog-item.js";
|
|
9
9
|
import { buildPromptOverview as _, isOrganisationPromptItem as v, mapPromptToCatalogItem as y } from "./catalog/map-prompt-to-catalog-item.js";
|
|
10
10
|
import { PUBLIC_SKILL_BUCKET as b, SKILL_LISTING_MAX_PAGES as x, SKILL_LISTING_PAGE_SIZE as S, SKILL_MANIFEST_MAX_BYTES as C, SkillSource as w, parseSkillResourceUrl as T } from "./skill/skill-types.js";
|
|
11
|
-
import { buildSkillContentTree as E, buildSkillOverview as D, mapSkillToCatalogItem as O, readSkillFileBytes as k,
|
|
12
|
-
import { McpResourceKind as
|
|
13
|
-
import { getPublicCatalogEntityFolderPath as
|
|
14
|
-
import { deriveAvailableTabIds as
|
|
15
|
-
import { CatalogPrimaryActionType as
|
|
16
|
-
import { useCatalogEditNavigation as
|
|
17
|
-
import { useSkillItemDetails as
|
|
18
|
-
import { useCatalogItemDetails as
|
|
19
|
-
import { useCatalogToolsetCredentials as
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
|
|
11
|
+
import { buildSkillContentTree as E, buildSkillOverview as D, mapSkillToCatalogItem as O, readSkillFileBytes as k, readSkillFilePreviewBytes as A, readSkillManifest as j, resolveSkillFileDownloadPath as M, resolveSkillManifestFileId as N } from "./catalog/map-skill-to-catalog-item.js";
|
|
12
|
+
import { McpResourceKind as P, buildApplicationMcpUrl as F, buildConnectApi as I, buildToolsetMcpUrl as L, resolveMcpResourceKind as R } from "./catalog/mcp-endpoint-url.js";
|
|
13
|
+
import { getPublicCatalogEntityFolderPath as z, isPublicCatalogEntityId as B, mapPublishConversationResultDto as V, mapPublishHistoryEntryDto as H, toPublishEntityType as U } from "./catalog/publish.js";
|
|
14
|
+
import { deriveAvailableTabIds as W, deriveFavoriteItems as G, filterCatalogItemsBySelector as K, filterHiddenOwnedItems as q, reconcileFilterTopics as J } from "./catalog/catalog-derivations.js";
|
|
15
|
+
import { CatalogPrimaryActionType as Y, resolveCatalogPrimaryAction as X } from "./catalog/catalog-primary-action.js";
|
|
16
|
+
import { useCatalogEditNavigation as Z } from "./catalog/useCatalogEditNavigation/useCatalogEditNavigation.js";
|
|
17
|
+
import { useSkillItemDetails as Q } from "./catalog/useSkillItemDetails.js";
|
|
18
|
+
import { useCatalogItemDetails as $ } from "./catalog/useCatalogItemDetails.js";
|
|
19
|
+
import { useCatalogToolsetCredentials as ee } from "./catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js";
|
|
20
|
+
import { useApplicationCredentials as te } from "./catalog/useApplicationCredentials/useApplicationCredentials.js";
|
|
21
|
+
import { useSkillDetailsPanelData as ne } from "./catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js";
|
|
22
|
+
import { FavoriteEntityType as re, useFavoriteEntitiesState as ie } from "./catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.js";
|
|
23
|
+
import { usePublishFolders as ae } from "./catalog/usePublishFolders/usePublishFolders.js";
|
|
24
|
+
import { SkillPreviewErrorKind as oe, useSkillFilePreview as se } from "./skill/useSkillFilePreview.js";
|
|
25
|
+
export { s as AuthenticationType, Y as CatalogPrimaryActionType, re as FavoriteEntityType, P as McpResourceKind, b as PUBLIC_SKILL_BUCKET, x as SKILL_LISTING_MAX_PAGES, S as SKILL_LISTING_PAGE_SIZE, C as SKILL_MANIFEST_MAX_BYTES, oe as SkillPreviewErrorKind, w as SkillSource, F as buildApplicationMcpUrl, n as buildChatCompletionsUrl, I as buildConnectApi, r as buildDeploymentConnectApi, _ as buildPromptOverview, i as buildResponsesUrl, E as buildSkillContentTree, D as buildSkillOverview, L as buildToolsetMcpUrl, e as createPublishApiClient, W as deriveAvailableTabIds, G as deriveFavoriteItems, a as encodeDeploymentId, K as filterCatalogItemsBySelector, q as filterHiddenOwnedItems, o as findDeploymentByIdOrReference, z as getPublicCatalogEntityFolderPath, v as isOrganisationPromptItem, B as isPublicCatalogEntityId, u as mapDeploymentDetailsDtoToEntityDetails, c as mapDeploymentLimitsDtoToCatalogLimits, l as mapDeploymentLimitsToInput, p as mapDeploymentToCatalogItem, m as mapDeploymentToolsetCredentials, d as mapEntityDetailsToCatalogDetails, y as mapPromptToCatalogItem, V as mapPublishConversationResultDto, H as mapPublishHistoryEntryDto, O as mapSkillToCatalogItem, f as mapToolsetCredentials, h as mapToolsetToCatalogItem, T as parseSkillResourceUrl, k as readSkillFileBytes, A as readSkillFilePreviewBytes, j as readSkillManifest, J as reconcileFilterTopics, X as resolveCatalogPrimaryAction, g as resolveDeploymentFolder, R as resolveMcpResourceKind, M as resolveSkillFileDownloadPath, N as resolveSkillManifestFileId, U as toPublishEntityType, t as toPublishRuleDto, te as useApplicationCredentials, Z as useCatalogEditNavigation, $ as useCatalogItemDetails, ee as useCatalogToolsetCredentials, ie as useFavoriteEntitiesState, ae as usePublishFolders, ne as useSkillDetailsPanelData, se as useSkillFilePreview, Q as useSkillItemDetails };
|
|
@@ -34,9 +34,20 @@ var t = {
|
|
|
34
34
|
e.addHook("afterSanitizeAttributes", (e) => {
|
|
35
35
|
e.tagName === "A" && e.getAttribute("target") === "_blank" && e.setAttribute("rel", "noopener noreferrer");
|
|
36
36
|
});
|
|
37
|
-
var r = (n) => e.sanitize(n, t), i = (t) => e.sanitize(t, n), a = (e) => typeof e == "string" && e.length > 0, o = ({ title: e, description: t }) => a(e) || a(t), s = (e) => o(e) || a(e.html), c = (e) =>
|
|
38
|
-
title: e.title
|
|
39
|
-
description: e.description ?? ""
|
|
40
|
-
|
|
37
|
+
var r = (n) => e.sanitize(n, t), i = (t) => e.sanitize(t, n), a = (e) => typeof e == "string" && e.length > 0, o = ({ title: e, description: t }) => a(e) || a(t), s = (e) => o(e) || a(e.html), c = (e) => e.map((e) => ({
|
|
38
|
+
title: e.title,
|
|
39
|
+
description: e.description ?? "",
|
|
40
|
+
link: e.link ? {
|
|
41
|
+
label: e.link.label,
|
|
42
|
+
href: e.link.href
|
|
43
|
+
} : null
|
|
44
|
+
})), l = (e) => {
|
|
45
|
+
if (!o(e)) return e.html ?? "";
|
|
46
|
+
let t = {
|
|
47
|
+
title: e.title ?? "",
|
|
48
|
+
description: e.description ?? ""
|
|
49
|
+
}, n = e.items ?? [];
|
|
50
|
+
return n.length > 0 && (t.items = c(n)), JSON.stringify(t);
|
|
51
|
+
};
|
|
41
52
|
//#endregion
|
|
42
|
-
export {
|
|
53
|
+
export { l as buildAnnouncementSignature, s as hasAnnouncementContent, o as hasStructuredAnnouncement, r as sanitizeAnnouncementHtml, i as sanitizeAnnouncementMessageHtml };
|
|
@@ -27,13 +27,14 @@ var o = () => {
|
|
|
27
27
|
progress: { percent: 100 },
|
|
28
28
|
errorCode: void 0
|
|
29
29
|
});
|
|
30
|
-
}, [u]), m = n((t, n) => {
|
|
31
|
-
s((
|
|
32
|
-
...
|
|
30
|
+
}, [u]), m = n((t, n, r) => {
|
|
31
|
+
s((i) => i.map((i) => i.id !== t || i.status !== e.InProgress ? i : {
|
|
32
|
+
...i,
|
|
33
33
|
status: e.Warning,
|
|
34
34
|
progress: { percent: 100 },
|
|
35
35
|
errorCode: void 0,
|
|
36
|
-
warningCode: n
|
|
36
|
+
warningCode: n,
|
|
37
|
+
warningNames: r
|
|
37
38
|
}));
|
|
38
39
|
}, []), h = n((t, n) => {
|
|
39
40
|
u(t, {
|
|
@@ -57,7 +58,9 @@ var o = () => {
|
|
|
57
58
|
return l.current.set(t, () => (u(t, {
|
|
58
59
|
status: e.InProgress,
|
|
59
60
|
progress: { percent: 0 },
|
|
60
|
-
errorCode: void 0
|
|
61
|
+
errorCode: void 0,
|
|
62
|
+
warningCode: void 0,
|
|
63
|
+
warningNames: void 0
|
|
61
64
|
}), r())), r();
|
|
62
65
|
}, [u]);
|
|
63
66
|
return r(() => {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StageStatus as e } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
//#region src/conversation/stage.ts
|
|
3
|
+
var t = (t) => t === e.Completed ? e.Completed : t === e.Failed ? e.Failed : null, n = (e) => ({
|
|
4
|
+
title: e.title ?? "",
|
|
5
|
+
...e.index != null && { index: e.index },
|
|
6
|
+
...e.type != null && { type: e.type },
|
|
7
|
+
...e.data != null && { data: e.data },
|
|
8
|
+
...e.url != null && { url: e.url },
|
|
9
|
+
...e.reference_type != null && { reference_type: e.reference_type },
|
|
10
|
+
...e.reference_url != null && { reference_url: e.reference_url }
|
|
11
|
+
}), r = (e) => ({
|
|
12
|
+
index: e.index ?? 0,
|
|
13
|
+
name: e.name ?? "",
|
|
14
|
+
status: t(e.status),
|
|
15
|
+
...e.content != null && { content: e.content },
|
|
16
|
+
...e.tag != null && { tag: e.tag },
|
|
17
|
+
...e.attachments?.length && { attachments: e.attachments.map(n) }
|
|
18
|
+
}), i = (e) => {
|
|
19
|
+
let t = Array.isArray(e) ? e : e?.custom_content?.stages ?? e?.customContent?.stages;
|
|
20
|
+
if (t?.length) return t.map(r);
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { i as mapStages, r as toStage };
|
|
@@ -26,9 +26,16 @@ var o = 700, s = 5, c = (e) => t(e.split("/").filter(Boolean).pop() ?? "file").r
|
|
|
26
26
|
})).url,
|
|
27
27
|
name: a.fileName
|
|
28
28
|
};
|
|
29
|
-
} catch (
|
|
30
|
-
if (l(
|
|
29
|
+
} catch (c) {
|
|
30
|
+
if (l(c)) {
|
|
31
31
|
if (i.markTaken(a.fileName), o < s) {
|
|
32
|
+
if (t.listFiles) try {
|
|
33
|
+
let e = await t.listFiles({
|
|
34
|
+
bucket: u,
|
|
35
|
+
path: a.path.slice(0, a.path.lastIndexOf("/"))
|
|
36
|
+
});
|
|
37
|
+
for (let t of e.items) i.markTaken(t.name);
|
|
38
|
+
} catch {}
|
|
32
39
|
a = i.allocate(n);
|
|
33
40
|
continue;
|
|
34
41
|
}
|
|
@@ -38,10 +45,10 @@ var o = 700, s = 5, c = (e) => t(e.split("/").filter(Boolean).pop() ?? "file").r
|
|
|
38
45
|
let e = p.current.splice(0);
|
|
39
46
|
d?.(e), m.current = null;
|
|
40
47
|
}, f);
|
|
41
|
-
let
|
|
42
|
-
throw
|
|
48
|
+
let t = c instanceof Error ? c : /* @__PURE__ */ Error("Network upload failed");
|
|
49
|
+
throw t.errorReason = r.Network, t;
|
|
43
50
|
}
|
|
44
|
-
throw
|
|
51
|
+
throw c;
|
|
45
52
|
}
|
|
46
53
|
}, [
|
|
47
54
|
u,
|
|
@@ -44,23 +44,19 @@ var p = ({ conversation: p, conversationId: m, bucket: h, isStreaming: g, startS
|
|
|
44
44
|
if (g || !m || !p || e === -1 || p.messages[e]?.role !== c.Assistant) return;
|
|
45
45
|
let t = p.messages[e - 1];
|
|
46
46
|
if (!t || t.role !== c.User) return;
|
|
47
|
-
let n = C()
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
messages: [...t.messages.slice(0, e), r]
|
|
61
|
-
};
|
|
62
|
-
return y.current = i, i;
|
|
63
|
-
}), A((t) => new Set([...t].filter((t) => t < e))), _(m, t.content, e, n, t.custom_content, l(), f.Regenerate);
|
|
47
|
+
let n = C(), r = {
|
|
48
|
+
...p.messages[e],
|
|
49
|
+
content: "",
|
|
50
|
+
custom_content: void 0,
|
|
51
|
+
wasStoppedByUser: void 0,
|
|
52
|
+
stoppedWithoutContent: void 0,
|
|
53
|
+
streamErrorMessage: void 0,
|
|
54
|
+
deploymentId: n
|
|
55
|
+
}, i = {
|
|
56
|
+
...p,
|
|
57
|
+
messages: [...p.messages.slice(0, e), r]
|
|
58
|
+
};
|
|
59
|
+
y.current = i, v(i), A((t) => new Set([...t].filter((t) => t < e))), _(m, t.content, e, n, t.custom_content, l(), f.Regenerate);
|
|
64
60
|
}, [
|
|
65
61
|
p,
|
|
66
62
|
m,
|
|
@@ -191,7 +191,7 @@ var b = 5, x = 5, S = (e) => /\.(dial|zip)$/i.test(e.name), C = (e) => new Promi
|
|
|
191
191
|
jobId: n,
|
|
192
192
|
code: t.AttachmentSkipped,
|
|
193
193
|
names: [...j]
|
|
194
|
-
}), A.length > 0 ? D.failJob(n, h.Unknown) : j.size > 0 ? D.warnJob(n, t.AttachmentSkipped) : D.succeedJob(n);
|
|
194
|
+
}), A.length > 0 ? D.failJob(n, h.Unknown) : j.size > 0 ? D.warnJob(n, t.AttachmentSkipped, [...j]) : D.succeedJob(n);
|
|
195
195
|
}
|
|
196
196
|
}, [
|
|
197
197
|
l,
|
|
@@ -1,121 +1,125 @@
|
|
|
1
1
|
import { useCallback as e, useEffect as t, useLayoutEffect as n, useRef as r, useState as i } from "react";
|
|
2
2
|
//#region src/conversation/useConversationScroll/useConversationScroll.ts
|
|
3
3
|
var a = 80, o = 1, s = ({ messages: s, isAssistantTyping: c, conversationId: l }) => {
|
|
4
|
-
let [u, d] = i(!1), f = r(null), p = r(null), m = r(null), h = r(!1), g = r(!1), _ = r(null), v = r(/* @__PURE__ */ new Map()),
|
|
5
|
-
t ?
|
|
6
|
-
}, []),
|
|
7
|
-
|
|
8
|
-
}, []),
|
|
4
|
+
let [u, d] = i(!1), f = r(null), p = r(null), m = r(null), h = r(!1), g = r(!1), _ = r(null), v = r(!0), y = r(/* @__PURE__ */ new Map()), b = e((e, t) => {
|
|
5
|
+
t ? y.current.set(e, t) : y.current.delete(e);
|
|
6
|
+
}, []), x = r(null), S = e((e) => {
|
|
7
|
+
x.current = e;
|
|
8
|
+
}, []), C = e((e, t) => {
|
|
9
9
|
let n = f.current;
|
|
10
10
|
n && n.scrollTo({
|
|
11
11
|
top: e,
|
|
12
12
|
behavior: t ? "instant" : "smooth"
|
|
13
13
|
});
|
|
14
|
-
}, []), C = e(() => {
|
|
15
|
-
m.current && (m.current.style.height = "0px"), h.current = !1, g.current = !1, _.current = null;
|
|
16
14
|
}, []), w = e(() => {
|
|
15
|
+
m.current && (m.current.style.height = "0px"), h.current = !1, g.current = !1, _.current = null;
|
|
16
|
+
}, []), T = e(() => {
|
|
17
17
|
let e = f.current, t = p.current;
|
|
18
18
|
if (!e || !t) return null;
|
|
19
19
|
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
20
20
|
return e.scrollTop + (r.bottom - n.top) - e.clientHeight;
|
|
21
|
-
}, []),
|
|
22
|
-
let t =
|
|
23
|
-
t != null &&
|
|
24
|
-
}, [
|
|
21
|
+
}, []), E = e((e = !1) => {
|
|
22
|
+
let t = T();
|
|
23
|
+
t != null && C(Math.max(t, 0), e);
|
|
24
|
+
}, [C, T]), D = e(() => {
|
|
25
25
|
let e = f.current, t = p.current;
|
|
26
26
|
if (!e || !t) return null;
|
|
27
27
|
let n = e.getBoundingClientRect();
|
|
28
28
|
return t.getBoundingClientRect().bottom - n.top - e.clientHeight;
|
|
29
|
-
}, []),
|
|
29
|
+
}, []), O = e(() => {
|
|
30
30
|
if (!g.current) return;
|
|
31
|
-
let e =
|
|
32
|
-
e == null || e < -1 ||
|
|
33
|
-
}, [
|
|
34
|
-
let t = f.current, n =
|
|
31
|
+
let e = D();
|
|
32
|
+
e == null || e < -1 || w();
|
|
33
|
+
}, [w, D]), k = e((e) => {
|
|
34
|
+
let t = f.current, n = y.current.get(e);
|
|
35
35
|
if (!t || !n) return null;
|
|
36
36
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect(), a = t.scrollTop + (i.top - r.top);
|
|
37
37
|
return Math.max(a, 0);
|
|
38
|
-
}, []),
|
|
39
|
-
let n =
|
|
40
|
-
n != null &&
|
|
41
|
-
}, [
|
|
42
|
-
let e =
|
|
38
|
+
}, []), A = e((e, t = !1) => {
|
|
39
|
+
let n = k(e);
|
|
40
|
+
n != null && C(n, t);
|
|
41
|
+
}, [k, C]), j = e(() => {
|
|
42
|
+
let e = T();
|
|
43
43
|
return e == null ? null : Math.max(e, 0);
|
|
44
|
-
}, [
|
|
44
|
+
}, [T]), M = e(() => {
|
|
45
45
|
if (!h.current) return null;
|
|
46
|
-
let e = _.current, t =
|
|
46
|
+
let e = _.current, t = j();
|
|
47
47
|
return e == null || t == null ? null : Math.max(e, t);
|
|
48
|
-
}, [
|
|
49
|
-
let e = f.current, t =
|
|
48
|
+
}, [j]), N = e(() => {
|
|
49
|
+
let e = f.current, t = M();
|
|
50
50
|
!e || t == null || e.scrollTop > t + o && (e.scrollTop = t);
|
|
51
|
-
}, [
|
|
52
|
-
let t = m.current, n =
|
|
51
|
+
}, [M]), P = e((e) => {
|
|
52
|
+
let t = m.current, n = j();
|
|
53
53
|
if (!t || n == null) return;
|
|
54
54
|
let r = Math.max(e - n, 0);
|
|
55
55
|
t.style.height = `${r}px`, h.current = r > 0, g.current = !1, _.current = r > 0 ? e : null;
|
|
56
|
-
}, [
|
|
57
|
-
let t =
|
|
58
|
-
t != null && (
|
|
56
|
+
}, [j]), F = e((e) => {
|
|
57
|
+
let t = k(e);
|
|
58
|
+
t != null && (P(t), A(e, !1));
|
|
59
59
|
}, [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
]),
|
|
64
|
-
let e =
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
P,
|
|
61
|
+
k,
|
|
62
|
+
A
|
|
63
|
+
]), I = e(() => {
|
|
64
|
+
let e = D();
|
|
65
|
+
if (e == null) return;
|
|
66
|
+
let t = e < a;
|
|
67
|
+
v.current = t, d(!t);
|
|
68
|
+
}, [D]), L = r(s.length), R = r(null);
|
|
67
69
|
n(() => {
|
|
68
|
-
let e = s.length !==
|
|
69
|
-
|
|
70
|
+
let e = s.length !== L.current, t = l !== R.current, n = () => {
|
|
71
|
+
L.current = s.length, R.current = l;
|
|
70
72
|
};
|
|
71
|
-
t &&
|
|
72
|
-
let r =
|
|
73
|
-
if (r != null &&
|
|
74
|
-
|
|
73
|
+
t && w();
|
|
74
|
+
let r = x.current;
|
|
75
|
+
if (r != null && y.current.has(r)) {
|
|
76
|
+
x.current = null, F(r), n();
|
|
75
77
|
return;
|
|
76
78
|
}
|
|
77
|
-
c || ((e || t) &&
|
|
79
|
+
c || ((e || t) && E(!1), n());
|
|
78
80
|
}, [
|
|
79
81
|
s,
|
|
80
82
|
c,
|
|
81
83
|
l,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
E,
|
|
85
|
+
F,
|
|
86
|
+
w
|
|
85
87
|
]), n(() => {
|
|
86
|
-
!c && h.current && (g.current = !0,
|
|
87
|
-
}, [c,
|
|
88
|
-
let
|
|
89
|
-
|
|
88
|
+
!c && h.current && (g.current = !0, O());
|
|
89
|
+
}, [c, O]);
|
|
90
|
+
let z = e(() => {
|
|
91
|
+
N(), O(), I();
|
|
90
92
|
}, [
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
N,
|
|
94
|
+
O,
|
|
95
|
+
I
|
|
94
96
|
]);
|
|
95
97
|
return t(() => {
|
|
96
98
|
let e = f.current;
|
|
97
|
-
if (e) return e.addEventListener("scroll",
|
|
98
|
-
}, [
|
|
99
|
+
if (e) return e.addEventListener("scroll", z, { passive: !0 }), () => e.removeEventListener("scroll", z);
|
|
100
|
+
}, [z]), t(() => {
|
|
99
101
|
let e = p.current;
|
|
100
102
|
if (!e) return;
|
|
101
103
|
let t = new ResizeObserver(() => {
|
|
102
|
-
|
|
104
|
+
let e = v.current && !h.current;
|
|
105
|
+
N(), e && E(!0), O(), I();
|
|
103
106
|
});
|
|
104
107
|
return t.observe(e), () => t.disconnect();
|
|
105
108
|
}, [
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
N,
|
|
110
|
+
O,
|
|
111
|
+
I,
|
|
112
|
+
E
|
|
109
113
|
]), {
|
|
110
114
|
containerRef: f,
|
|
111
115
|
contentRef: p,
|
|
112
116
|
spacerRef: m,
|
|
113
|
-
setMessageRef:
|
|
117
|
+
setMessageRef: b,
|
|
114
118
|
isScrollButtonVisible: u,
|
|
115
119
|
scrollToBottom: e(() => {
|
|
116
|
-
|
|
117
|
-
}, [
|
|
118
|
-
armAnchor:
|
|
120
|
+
E(!1);
|
|
121
|
+
}, [E]),
|
|
122
|
+
armAnchor: S
|
|
119
123
|
};
|
|
120
124
|
};
|
|
121
125
|
//#endregion
|
|
@@ -86,7 +86,11 @@ var m = 2e4, h = ({ conversationId: h, state: { setConversation: g, conversation
|
|
|
86
86
|
};
|
|
87
87
|
(async () => {
|
|
88
88
|
try {
|
|
89
|
-
let e = x?.channelId ?? await x?.waitForChannel(m) ?? void 0;
|
|
89
|
+
let e = x?.channelId ?? await x?.waitForChannel(m) ?? void 0, t = N.current.has(h);
|
|
90
|
+
if (D.signal.aborted || E() || t) {
|
|
91
|
+
M.current.get(C)?.generationId === h && M.current.delete(C), E() || R(C), k.current === h && (k.current = null, A.current = null, O(null)), b(C, h), x?.notifyGenerationSettled?.(), t ? N.current.delete(h) : E() || S?.notifyGenerationEnd?.();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
90
94
|
v.streamCompletion(C, o, l, F, u, h, f, T, e);
|
|
91
95
|
} catch (e) {
|
|
92
96
|
F.onError(e instanceof Error ? e : Error(String(e)));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AudioTranscriptionError as e, AudioTranscriptionErrorReason as t } from "./audio-transcription-error.js";
|
|
2
2
|
//#region src/conversation/useTranscribeAudio/transcription-retry.ts
|
|
3
|
-
var n = 2, r =
|
|
3
|
+
var n = 2, r = 6e3, i = (e, t) => (t.throwIfAborted(), new Promise((n, r) => {
|
|
4
4
|
let i = () => {
|
|
5
5
|
clearTimeout(a), r(t.reason);
|
|
6
6
|
}, a = setTimeout(() => {
|
|
@@ -28,9 +28,10 @@ var n = 2, r = 9e4, i = (e, t) => (t.throwIfAborted(), new Promise((n, r) => {
|
|
|
28
28
|
503,
|
|
29
29
|
504
|
|
30
30
|
].includes(u.status)) throw o;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
c
|
|
31
|
+
if ([429, 503].includes(u.status)) throw new e(t.Busy);
|
|
32
|
+
let d = Math.max(1e3, a(u.headers.get("retry-after")) ?? 2e3 * 2 ** l);
|
|
33
|
+
if (l >= n || c + d > r) throw new e(t.Busy);
|
|
34
|
+
c += d, await i(d, s);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Message } from '@epam/ai-dial-chat-shared';
|
|
2
|
+
import { OverlayChatMessage } from '@epam/ai-dial-chat-overlay';
|
|
3
|
+
|
|
4
|
+
/** Maps chat messages to the DIAL Chat Overlay protocol's message shape. */
|
|
5
|
+
export declare const toOverlayMessages: (messages: Message[]) => OverlayChatMessage[];
|
|
6
|
+
|
|
7
|
+
export { }
|