@epam/ai-dial-chat-hooks 1.1.0-dev.423 → 1.1.0-dev.426
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/{api-error-DuLNy43N.js → api-error/api-error.js} +1 -1
- package/api-transport/create-csrf-middleware.js +21 -0
- package/api-transport/create-unauthorized-middleware.js +41 -0
- package/attachment/useAttachmentAction/useAttachmentAction.js +74 -0
- package/attachment/useAttachmentValidation/useAttachmentValidation.js +35 -0
- package/attachments.js +3 -2
- package/catalog/catalog-derivations.js +10 -0
- package/catalog/catalog-primary-action.js +21 -0
- package/catalog/create-publish-api.js +27 -0
- package/catalog/deployment-endpoint-url.js +34 -0
- package/{deployment-id-CxWgJTs9.js → catalog/deployment-id.js} +1 -1
- package/catalog/entity-details.js +6 -0
- package/catalog/map-deployment-limits-to-catalog.js +73 -0
- package/catalog/map-deployment-limits-to-input.js +14 -0
- package/catalog/map-deployment-to-catalog-item.js +92 -0
- package/catalog/map-entity-details-to-catalog.js +350 -0
- package/catalog/map-prompt-to-catalog-item.js +49 -0
- package/catalog/map-skill-to-catalog-item.js +123 -0
- package/catalog/mcp-endpoint-url.js +26 -0
- package/catalog/publish.js +18 -0
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +109 -0
- package/catalog/useCatalogItemDetails.js +101 -0
- package/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js +146 -0
- package/catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.js +50 -0
- package/catalog/usePublishFolders/usePublishFolders.js +72 -0
- package/catalog.js +22 -3
- package/conversation/announcement-message.js +42 -0
- package/conversation/conversation-transfer/async.js +18 -0
- package/conversation/conversation-transfer/attachment-refs.js +11 -0
- package/conversation/conversation-transfer/build-upload-path.js +27 -0
- package/{date-BeuD8G79.js → conversation/conversation-transfer/date.js} +1 -1
- package/conversation/conversation-transfer/dial-file-resolve.js +18 -0
- package/conversation/conversation-transfer/export-conversation.js +32 -0
- package/conversation/conversation-transfer/import-conversation.js +93 -0
- package/conversation/conversation-transfer/progress.js +39 -0
- package/conversation/conversation-transfer/queue.js +84 -0
- package/conversation/conversation-transfer/types.js +9 -0
- package/conversation/conversation-transfer/zip-export.js +19 -0
- package/conversation/conversation-transfer/zip-import.js +29 -0
- package/conversation/create-chat-stream-api.js +96 -0
- package/conversation/deriveConversationRowActionState/deriveConversationRowActionState.js +14 -0
- package/conversation/display-name-watch.js +5 -0
- package/conversation/footer-message.js +23 -0
- package/conversation/get-model-id-from-conversation-id.js +14 -0
- package/conversation/greeting.js +7 -0
- package/conversation/message-factory.js +19 -0
- package/conversation/message-utils.js +13 -0
- package/conversation/overlay-messages.js +8 -0
- package/conversation/quick-app-conversation-starters.js +29 -0
- package/conversation/starter-option.js +27 -0
- package/conversation/useActiveConversationSync/useActiveConversationSync.js +19 -0
- package/conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.js +39 -0
- package/conversation/useAttachmentUpload/useAttachmentUpload.js +33 -0
- package/conversation/useConversationExport/useConversationExport.js +285 -0
- package/conversation/useConversationHandlers/attachment-to-dto.js +13 -0
- package/conversation/useConversationHandlers/message-factory.js +21 -0
- package/conversation/useConversationHandlers/message-utils.js +8 -0
- package/conversation/useConversationHandlers/starter-option.js +11 -0
- package/conversation/useConversationHandlers/useConversationHandlers.js +263 -0
- package/conversation/useConversationImport/useConversationImport.js +239 -0
- package/conversation/useConversationLookupMaps/useConversationLookupMaps.js +11 -0
- package/conversation/useConversationPanelItems/useConversationPanelItems.js +35 -0
- package/{useConversationScroll-CliIMnjP.js → conversation/useConversationScroll/useConversationScroll.js} +1 -1
- package/conversation/useConversationStream/apply-chunk.js +78 -0
- package/conversation/useConversationStream/buffered-generation.js +18 -0
- package/conversation/useConversationStream/conversation-path.js +8 -0
- package/conversation/useConversationStream/generation-resume.js +126 -0
- package/conversation/useConversationStream/useConversationStream.js +148 -0
- package/conversation/useImportFilePicker/useImportFilePicker.js +20 -0
- package/conversation/useTranscribeAudio/audio-transcription-error.js +12 -0
- package/conversation/useTranscribeAudio/transcription-retry.js +38 -0
- package/conversation/useTranscribeAudio/useTranscribeAudio.js +41 -0
- package/{useConversationSources-DKaKvjXZ.js → conversation-sources/useConversationSources/useConversationSources.js} +1 -1
- package/conversation-sources.js +1 -1
- package/conversation-transfer.js +7 -3
- package/conversation.d.ts +66 -0
- package/conversation.js +31 -2
- package/file-manager.d.ts +3 -4
- package/file-manager.js +28 -3
- package/files/annotation.js +15 -0
- package/files/attachment-canvas.js +218 -0
- package/files/attachment-dto-to-display.js +15 -0
- package/files/attachment-types.js +16 -0
- package/files/create-files-api.js +40 -0
- package/files/create-upload-file-with-progress.js +42 -0
- package/files/dial-file-manager-copy-move.util.js +55 -0
- package/files/dial-file-manager-mapping.util.js +140 -0
- package/files/dial-file-manager-path.util.js +72 -0
- package/files/dial-file-manager.model.js +25 -0
- package/files/dial-file-manager.types.js +10 -0
- package/files/dial-file-to-attachment.js +37 -0
- package/files/dial-file.js +30 -0
- package/files/dial-files-api.js +6 -0
- package/files/download-destination.js +6 -0
- package/files/file-manager-variant.js +11 -0
- package/files/file-name.js +19 -0
- package/files/prepare-download-destination.js +24 -0
- package/files/resolve-dial-file-api-path.js +33 -0
- package/files/source-content.js +37 -0
- package/files/useDialFileListing/useDialFileListing.js +295 -0
- package/files/useDialFileManager/useDialFileManager.js +146 -0
- package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +23 -0
- package/files/useDialFileMetadata/useDialFileMetadata.js +42 -0
- package/files/useDialFileMutations/useDialFileMutations.js +359 -0
- package/files/useDialFileSharing/useDialFileSharing.js +70 -0
- package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +156 -0
- package/index.d.ts +69 -4
- package/index.js +134 -28
- package/mcp-apps/mcp-apps-api-client.js +48 -0
- package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +26 -0
- package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +26 -0
- package/mcp-apps/useMcpAppTools/useMcpAppTools.js +71 -0
- package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +58 -0
- package/mcp-apps.js +6 -2
- package/oauth/authorize-url.js +12 -0
- package/oauth/handshake.js +65 -0
- package/oauth/popup.js +29 -0
- package/oauth/toolset-id.js +10 -0
- package/oauth/types.js +24 -0
- package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.js +94 -0
- package/oauth/useToolsetLogin/useToolsetLogin.js +73 -0
- package/oauth.js +9 -3
- package/package.json +35 -23
- package/prompt/export-prompt.js +28 -0
- package/prompt/prompt-resource.js +15 -0
- package/prompt/prompt.js +12 -0
- package/prompt/usePromptsState/usePromptsState.js +42 -0
- package/scheduled-task/scheduled-task-mapping.js +6 -0
- package/{scheduled-task-trigger-D9RZCk52.js → scheduled-task/scheduled-task-trigger.js} +39 -40
- package/scheduled-tasks.js +3 -2
- package/scroll-anchoring.js +1 -1
- package/shared/application-schema.js +4 -0
- package/shared/browser-timezone.js +10 -0
- package/{cron-weekday-B4w29eAC.js → shared/cron-weekday.js} +1 -1
- package/shared/custom-apps.js +30 -0
- package/shared/external-services.js +18 -0
- package/{formatting-CZyyxBG3.js → shared/formatting.js} +1 -1
- package/{prompt-resource-Bt1I-8ri.js → shared/locale.js} +2 -13
- package/{string-utils-iBi2Y55C.js → shared/string-utils.js} +1 -1
- package/shared/toolset-login-events.js +13 -0
- package/sharing.js +3 -3
- package/skill/skill-file-batch-validation.js +48 -0
- package/skill/skill-file-preview.js +15 -0
- package/skill/skill-manifest.js +70 -0
- package/skill/skill-types.js +15 -0
- package/skill/skill.js +48 -0
- package/skill/useSkillEditorLoad.js +103 -0
- package/skill/useSkillEditorSubmit.js +135 -0
- package/skill/useSkillFileActions.js +99 -0
- package/skill/useSkillFilePreview.js +29 -0
- package/{useSkillsState-BoLlwmzb.js → skill/useSkillsState/useSkillsState.js} +1 -1
- package/skill-editor.js +8 -3
- package/skills-state.js +1 -1
- package/source-content.d.ts +29 -0
- package/source-content.js +2 -0
- package/usage/useUsageData/useUsageData.js +32 -0
- package/useChatSettingsFormConfig/useChatSettingsFormConfig.js +74 -0
- package/{usePanelMaxWidth-BEZYuqF9.js → usePageFileDrag/usePageFileDrag.js} +1 -11
- package/usePanelMaxWidth/usePanelMaxWidth.js +8 -0
- package/{useShareLink-xkiaxATt.js → useShareLink/useShareLink.js} +1 -1
- package/{useShareRecipientsCount-BgwCLKY0.js → useShareRecipientsCount/useShareRecipientsCount.js} +1 -1
- package/useToolsMenu/useToolsMenu.js +50 -0
- package/useViewportWidth/useViewportWidth.js +12 -0
- package/utils.js +17 -7
- package/viewport-layout.js +4 -2
- package/attachment-types-AAoN9E95.js +0 -7760
- package/browser-Btsa0Lmr.js +0 -607
- package/skill-manifest-CeG6-WSK.js +0 -4056
- package/useAttachmentValidation-CkMTd5lA.js +0 -102
- package/useConversationImport-CDRs7JF1.js +0 -826
- package/useDialFileManagerTabConfig-CjI46lMo.js +0 -2291
- package/useOAuthCallbackCompletion-CvyTKLER.js +0 -93
- package/useOpenMcpAppCanvas-C7-AMseH.js +0 -207
- package/useSkillFileActions-B-VaGD20.js +0 -373
- package/useSkillFilePreview-B5o1n_0F.js +0 -1244
- package/useToolsMenu-zURpMEn1.js +0 -1882
- package/useToolsetLogin-B05m134e.js +0 -195
- package/useUsageData-D7BxloKZ.js +0 -201
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/api-transport/create-csrf-middleware.ts
|
|
2
|
+
var e = (e) => ({
|
|
3
|
+
pre: async (t) => {
|
|
4
|
+
let n = e.getCsrfToken();
|
|
5
|
+
if (t.init.method === "GET" || n === null) return t;
|
|
6
|
+
let r = new Headers(t.init.headers);
|
|
7
|
+
return r.set("X-CSRF-Token", n), {
|
|
8
|
+
...t,
|
|
9
|
+
init: {
|
|
10
|
+
...t.init,
|
|
11
|
+
headers: r
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
post: async (t) => {
|
|
16
|
+
let n = t.response.headers.get("x-csrf-token");
|
|
17
|
+
return n && e.setCsrfToken(n), t.response;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { e as createCsrfMiddleware };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region src/api-transport/create-unauthorized-middleware.ts
|
|
2
|
+
var e = async (e) => {
|
|
3
|
+
try {
|
|
4
|
+
return await e.clone().text();
|
|
5
|
+
} catch {
|
|
6
|
+
return "";
|
|
7
|
+
}
|
|
8
|
+
}, t = (e) => new Headers(e.headers).get("X-CSRF-Token"), n = (e, t) => {
|
|
9
|
+
let n = new Headers(e.init.headers);
|
|
10
|
+
return e.init.method !== "GET" && n.set("X-CSRF-Token", t), fetch(e.url, {
|
|
11
|
+
...e.init,
|
|
12
|
+
headers: n
|
|
13
|
+
});
|
|
14
|
+
}, r = (r) => {
|
|
15
|
+
let i = async (e) => {
|
|
16
|
+
let i = t(e.init), a = r.getCsrfToken();
|
|
17
|
+
if (a !== null && a !== i) return n(e, a);
|
|
18
|
+
let o = await r.refreshCsrfToken();
|
|
19
|
+
if (o.status === "unauthorized") throw r.notifyUnauthorized(e.url), r.createUnauthorizedError(e.url);
|
|
20
|
+
if (o.status !== "ok") throw Error(`CSRF refresh failed for ${e.url}`);
|
|
21
|
+
return n(e, o.token);
|
|
22
|
+
}, a = async (t, n) => {
|
|
23
|
+
let i = n.headers.get("x-csrf-token");
|
|
24
|
+
if (i && r.setCsrfToken(i), n.status === 401) throw r.notifyUnauthorized(t.url), r.createUnauthorizedError(t.url);
|
|
25
|
+
if (!n.ok) {
|
|
26
|
+
let i = await e(n);
|
|
27
|
+
throw n.status === 403 && r.isInvalidCsrfErrorBody(i) ? (r.notifyUnauthorized(t.url), r.createUnauthorizedError(t.url)) : Error(`Request failed with status ${n.status} for ${t.init.method ?? "GET"} ${t.url}: ${i}`);
|
|
28
|
+
}
|
|
29
|
+
return n;
|
|
30
|
+
};
|
|
31
|
+
return { post: async (t) => {
|
|
32
|
+
if (t.response.status === 401) throw r.notifyUnauthorized(t.url), r.createUnauthorizedError(t.url);
|
|
33
|
+
if (t.response.status === 403) {
|
|
34
|
+
let n = await e(t.response);
|
|
35
|
+
if (r.isInvalidCsrfErrorBody(n)) return a(t, await i(t));
|
|
36
|
+
}
|
|
37
|
+
return t.response;
|
|
38
|
+
} };
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { r as createUnauthorizedMiddleware };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { isDialFileId as e } from "../../files/dial-file.js";
|
|
2
|
+
import { AttachmentContentType as t, useAttachmentCanvas as n } from "@epam/ai-dial-attachment-canvas";
|
|
3
|
+
import { MIMEType as r, base64ToBlob as i, ensureDownloadFilename as a, triggerAnchorDownload as o, triggerBlobDownload as s } from "@epam/ai-dial-chat-shared";
|
|
4
|
+
import { parsePdfPageReference as c } from "@epam/ai-dial-quotations";
|
|
5
|
+
import { useCallback as l } from "react";
|
|
6
|
+
//#region src/attachment/useAttachmentAction/useAttachmentAction.ts
|
|
7
|
+
var u = (t) => t.url != null && e(t.url) || t.data != null, d = (t, n) => {
|
|
8
|
+
let { url: c, name: l, contentType: u, data: d } = t;
|
|
9
|
+
if (c != null && e(c)) {
|
|
10
|
+
let e = n(c);
|
|
11
|
+
return e == null ? !1 : (o(e, a(l, c, u)), !0);
|
|
12
|
+
}
|
|
13
|
+
return d == null ? !1 : (s(i(d, u || r.Plain), a(l, c, u)), !0);
|
|
14
|
+
}, f = (t, n) => {
|
|
15
|
+
let { url: r } = t;
|
|
16
|
+
if (r == null) return;
|
|
17
|
+
let i = r.split("#")[0];
|
|
18
|
+
if (e(i)) {
|
|
19
|
+
let e = n(i);
|
|
20
|
+
if (e == null) return;
|
|
21
|
+
o(e, a(t.title ?? i.split("/").pop() ?? "", i, t.type));
|
|
22
|
+
} else window.open(r, "_blank", "noopener,noreferrer");
|
|
23
|
+
}, p = (n, r) => {
|
|
24
|
+
let i = c(n.url);
|
|
25
|
+
if (i == null) return null;
|
|
26
|
+
let a = e(i.baseUrl) ? r(i.baseUrl) : i.baseUrl;
|
|
27
|
+
if (a == null) return null;
|
|
28
|
+
if (i.page == null) return {
|
|
29
|
+
type: t.Pdf,
|
|
30
|
+
url: a
|
|
31
|
+
};
|
|
32
|
+
let o = `reference-page-${i.page}`;
|
|
33
|
+
return {
|
|
34
|
+
type: t.Pdf,
|
|
35
|
+
url: a,
|
|
36
|
+
highlights: [{
|
|
37
|
+
id: o,
|
|
38
|
+
bboxes: [{
|
|
39
|
+
page: i.page,
|
|
40
|
+
x1: 0,
|
|
41
|
+
y1: 0,
|
|
42
|
+
x2: 0,
|
|
43
|
+
y2: 0
|
|
44
|
+
}],
|
|
45
|
+
style: {
|
|
46
|
+
backgroundColor: "transparent",
|
|
47
|
+
opacity: 0
|
|
48
|
+
}
|
|
49
|
+
}],
|
|
50
|
+
selectedHighlightId: o
|
|
51
|
+
};
|
|
52
|
+
}, m = ({ resolveDownloadUrl: e }) => {
|
|
53
|
+
let { openCanvas: t } = n();
|
|
54
|
+
return { handleAttachmentClick: l((n) => {
|
|
55
|
+
let { url: r, referenceUrl: i, data: a, name: o } = n;
|
|
56
|
+
if (r != null || a != null) {
|
|
57
|
+
d(n, e);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (i == null) return;
|
|
61
|
+
let s = {
|
|
62
|
+
type: n.contentType,
|
|
63
|
+
url: i,
|
|
64
|
+
title: o
|
|
65
|
+
}, c = p(s, e);
|
|
66
|
+
if (c) {
|
|
67
|
+
t(c, o);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
f(s, e);
|
|
71
|
+
}, [t, e]) };
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
74
|
+
export { d as downloadAttachment, u as isDownloadableAttachment, m as useAttachmentAction };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { mimeTypesToFileAccept as e } from "../../files/attachment-types.js";
|
|
2
|
+
import { AttachmentErrorReason as t } from "@epam/ai-dial-chat-shared";
|
|
3
|
+
import { useCallback as n, useEffect as r, useMemo as i, useRef as a } from "react";
|
|
4
|
+
import { isMimeTypeAllowed as o, mimeTypesToExtensionLabels as s } from "@epam/ai-dial-attachment-input";
|
|
5
|
+
//#region src/attachment/useAttachmentValidation/useAttachmentValidation.ts
|
|
6
|
+
var c = 100, l = /* @__PURE__ */ function(e) {
|
|
7
|
+
return e.NoTypesAllowed = "noTypesAllowed", e.UnsupportedType = "unsupportedType", e;
|
|
8
|
+
}({}), u = ({ allowedMimeTypes: l, onValidationError: u, debounceMs: d = c }) => {
|
|
9
|
+
let f = a(l);
|
|
10
|
+
(f.current.length !== l.length || f.current.some((e, t) => e !== l[t])) && (f.current = l);
|
|
11
|
+
let p = f.current, m = p.length > 0, h = i(() => e(p), [p]), g = a(null);
|
|
12
|
+
return r(() => () => {
|
|
13
|
+
g.current != null && clearTimeout(g.current);
|
|
14
|
+
}, []), {
|
|
15
|
+
inputAttachmentTypes: p,
|
|
16
|
+
isAttachmentsAllowed: m,
|
|
17
|
+
validateAttachment: n((e) => {
|
|
18
|
+
if (!o(e.contentType, p)) return g.current != null && clearTimeout(g.current), g.current = setTimeout(() => {
|
|
19
|
+
let e = p.length === 0;
|
|
20
|
+
u?.({
|
|
21
|
+
reason: e ? "noTypesAllowed" : "unsupportedType",
|
|
22
|
+
allowedMimeTypes: p,
|
|
23
|
+
...e ? {} : { formats: s(p) }
|
|
24
|
+
}), g.current = null;
|
|
25
|
+
}, d), t.UnsupportedType;
|
|
26
|
+
}, [
|
|
27
|
+
p,
|
|
28
|
+
d,
|
|
29
|
+
u
|
|
30
|
+
]),
|
|
31
|
+
fileAccept: h
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { l as AttachmentValidationErrorReason, u as useAttachmentValidation };
|
package/attachments.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { downloadAttachment as e, isDownloadableAttachment as t, useAttachmentAction as n } from "./attachment/useAttachmentAction/useAttachmentAction.js";
|
|
2
|
+
import { AttachmentValidationErrorReason as r, useAttachmentValidation as i } from "./attachment/useAttachmentValidation/useAttachmentValidation.js";
|
|
3
|
+
export { r as AttachmentValidationErrorReason, e as downloadAttachment, t as isDownloadableAttachment, n as useAttachmentAction, i as useAttachmentValidation };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/catalog/catalog-derivations.ts
|
|
2
|
+
var e = (e, t) => e.filter((e) => t.has(e.type)), t = (e, t) => t ? e.filter((e) => !e.isMyApp) : [...e], n = (e) => e.filter((e) => e.isUserFavorite), r = (e, t) => {
|
|
3
|
+
let n = new Set(e.map((e) => e.type));
|
|
4
|
+
return t.filter((e) => n.has(e));
|
|
5
|
+
}, i = (e, t) => {
|
|
6
|
+
let n = new Set(t.flatMap((e) => e.topics));
|
|
7
|
+
return new Set(Array.from(e).filter((e) => n.has(e)));
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { r as deriveAvailableTabIds, n as deriveFavoriteItems, e as filterCatalogItemsBySelector, t as filterHiddenOwnedItems, i as reconcileFilterTopics };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CatalogEntityType as e, extractPromptParams as t } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
//#region src/catalog/catalog-primary-action.ts
|
|
3
|
+
var n = /* @__PURE__ */ function(e) {
|
|
4
|
+
return e.Deployment = "deployment", e.Prompt = "prompt", e;
|
|
5
|
+
}({}), r = async (n, r) => {
|
|
6
|
+
if (n.type !== e.Prompt) return {
|
|
7
|
+
kind: "deployment",
|
|
8
|
+
id: n.id
|
|
9
|
+
};
|
|
10
|
+
let i = n.details?.promptContent?.content;
|
|
11
|
+
return i ??= (await r(n)).content, {
|
|
12
|
+
kind: "prompt",
|
|
13
|
+
id: n.id,
|
|
14
|
+
name: n.name,
|
|
15
|
+
description: n.description,
|
|
16
|
+
content: i,
|
|
17
|
+
hasParameters: t(i).length > 0
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { n as CatalogPrimaryActionType, r as resolveCatalogPrimaryAction };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/catalog/create-publish-api.ts
|
|
2
|
+
var e = (e) => ({
|
|
3
|
+
source: e.source,
|
|
4
|
+
targets: e.targets,
|
|
5
|
+
function: e.function
|
|
6
|
+
}), t = (e) => ({
|
|
7
|
+
publishCatalogEntity: (t, n, r) => e.publishCatalogEntity({
|
|
8
|
+
entityType: t,
|
|
9
|
+
entityId: n,
|
|
10
|
+
publishCatalogEntityDto: r
|
|
11
|
+
}),
|
|
12
|
+
unpublishCatalogEntity: (t, n, r) => e.unpublishCatalogEntity({
|
|
13
|
+
entityType: t,
|
|
14
|
+
entityId: n,
|
|
15
|
+
unpublishCatalogEntityDto: r
|
|
16
|
+
}),
|
|
17
|
+
getCatalogPublishHistory: (t, n) => e.getCatalogPublishHistory({
|
|
18
|
+
entityType: t,
|
|
19
|
+
entityId: n
|
|
20
|
+
}),
|
|
21
|
+
getPublishRules: async (t) => (await e.getPublishRules({ folderPath: t })).rules.map(({ function: e, ...t }) => ({
|
|
22
|
+
...t,
|
|
23
|
+
function: e
|
|
24
|
+
}))
|
|
25
|
+
});
|
|
26
|
+
//#endregion
|
|
27
|
+
export { t as createPublishApiClient, e as toPublishRuleDto };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { safeDecodeURIComponent as e } from "../shared/string-utils.js";
|
|
2
|
+
import { CodeLanguage as t } from "@epam/ai-dial-catalog";
|
|
3
|
+
//#region src/catalog/deployment-endpoint-url.ts
|
|
4
|
+
var n = (e) => e.endsWith("/") ? e.slice(0, -1) : e, r = (t) => t.split("/").map((t) => encodeURIComponent(e(t))).join("/"), i = (t) => t.split("/").map(e).join("/"), a = (e, t) => `${n(e)}/openai/deployments/${r(t)}/chat/completions`, o = (e) => `${n(e)}/openai/v1/responses`, s = (e, n, { hasChatCompletion: r, hasResponsesApi: s }) => {
|
|
5
|
+
let c = [];
|
|
6
|
+
if (r) {
|
|
7
|
+
let r = a(e, n);
|
|
8
|
+
c.push({
|
|
9
|
+
label: "Chat Completions",
|
|
10
|
+
url: r,
|
|
11
|
+
snippets: [{
|
|
12
|
+
language: t.Curl,
|
|
13
|
+
code: `curl -X POST '${r}?api-version=<api-version>' \\\n -H 'Content-Type: application/json' \\\n -H 'Api-Key: <key>' \\\n -d '{"messages":[{"role":"user","content":"Hello"}]}'`
|
|
14
|
+
}]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if (s) {
|
|
18
|
+
let r = o(e);
|
|
19
|
+
c.push({
|
|
20
|
+
label: "Responses",
|
|
21
|
+
url: r,
|
|
22
|
+
snippets: [{
|
|
23
|
+
language: t.Curl,
|
|
24
|
+
code: `curl -X POST '${r}' \\\n -H 'Content-Type: application/json' \\\n -H 'Api-Key: <key>' \\\n -d '{"model":"${n}","input":"Hello"}'`
|
|
25
|
+
}]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (c.length !== 0) return {
|
|
29
|
+
resource: { modelId: i(n) },
|
|
30
|
+
endpoints: c
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { a as buildChatCompletionsUrl, s as buildDeploymentConnectApi, o as buildResponsesUrl };
|
|
@@ -3,4 +3,4 @@ var e = (e) => e.split("/").map((e) => encodeURIComponent(e)).join("/"), t = (e,
|
|
|
3
3
|
if (t) return e.find((e) => e.id === t) ?? e.find((e) => e.reference === t);
|
|
4
4
|
};
|
|
5
5
|
//#endregion
|
|
6
|
-
export {
|
|
6
|
+
export { e as encodeDeploymentId, t as findDeploymentByIdOrReference };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { formatCost as e } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { CatalogLimitStatus as t } from "@epam/ai-dial-catalog";
|
|
3
|
+
//#region src/catalog/map-deployment-limits-to-catalog.ts
|
|
4
|
+
var n = [
|
|
5
|
+
{
|
|
6
|
+
key: "dayTokenStats",
|
|
7
|
+
labelField: "tokensPerDay",
|
|
8
|
+
costKey: "dayCostStats"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
key: "weekTokenStats",
|
|
12
|
+
labelField: "tokensPerWeek",
|
|
13
|
+
costKey: "weekCostStats"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
key: "monthTokenStats",
|
|
17
|
+
labelField: "tokensPerMonth",
|
|
18
|
+
costKey: "monthCostStats"
|
|
19
|
+
}
|
|
20
|
+
], r = 2 ** 53 - 1, i = .75, a = [1e6, 1e3], o = new Intl.NumberFormat(void 0, {
|
|
21
|
+
notation: "compact",
|
|
22
|
+
maximumFractionDigits: 1
|
|
23
|
+
}), s = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }), c = (e) => {
|
|
24
|
+
let t = a.find((t) => Math.abs(e) >= t);
|
|
25
|
+
return t == null ? e : Math.trunc(e / t * 10) / 10 * t;
|
|
26
|
+
}, l = (e) => e != null && Number.isFinite(e.total) && Number.isFinite(e.used) && e.total > 0, u = (e) => e >= r, d = (e) => e != null && Number.isFinite(e.total) && Number.isFinite(e.used), f = (t, n) => {
|
|
27
|
+
if (d(t)) return n.formatSpentCaption(e(Math.max(0, t.used)));
|
|
28
|
+
}, p = (e, t, n, r) => {
|
|
29
|
+
let i = Math.max(0, e.used), a = e.total, l = o.format(c(i)), d = o.format(a), f = s.format(i), p = s.format(a), m = u(a);
|
|
30
|
+
return {
|
|
31
|
+
label: t,
|
|
32
|
+
used: i,
|
|
33
|
+
total: a,
|
|
34
|
+
captionLabel: n,
|
|
35
|
+
...m ? {
|
|
36
|
+
isUnlimited: !0,
|
|
37
|
+
noteLabel: r.followsCostLimit
|
|
38
|
+
} : {
|
|
39
|
+
usedLabel: l,
|
|
40
|
+
totalLabel: d
|
|
41
|
+
},
|
|
42
|
+
valueLabel: m ? l : r.formatValueLabel(l, d),
|
|
43
|
+
ariaLabel: m ? r.formatFollowsCostLimitAriaLabel({
|
|
44
|
+
label: t,
|
|
45
|
+
used: f
|
|
46
|
+
}) : r.formatProgressAriaLabel({
|
|
47
|
+
label: t,
|
|
48
|
+
used: f,
|
|
49
|
+
total: p
|
|
50
|
+
})
|
|
51
|
+
};
|
|
52
|
+
}, m = (e) => u(e.total) ? 0 : Math.max(e.used, 0) / e.total, h = (e) => e.reduce((e, n) => {
|
|
53
|
+
let r = m(n);
|
|
54
|
+
return r >= 1 ? t.LimitReached : r >= i && e !== t.LimitReached ? t.RunningLow : e;
|
|
55
|
+
}, void 0), g = (e, t) => {
|
|
56
|
+
if (e == null) return;
|
|
57
|
+
let r = [], i = n.flatMap((n) => {
|
|
58
|
+
let i = e[n.key];
|
|
59
|
+
if (!l(i)) return [];
|
|
60
|
+
r.push(i);
|
|
61
|
+
let a = f(e[n.costKey], t);
|
|
62
|
+
return [p(i, t[n.labelField], a, t)];
|
|
63
|
+
});
|
|
64
|
+
return i.length > 0 ? {
|
|
65
|
+
groups: [{
|
|
66
|
+
label: t.tokenGroup,
|
|
67
|
+
rows: i
|
|
68
|
+
}],
|
|
69
|
+
status: h(r)
|
|
70
|
+
} : void 0;
|
|
71
|
+
};
|
|
72
|
+
//#endregion
|
|
73
|
+
export { g as mapDeploymentLimitsDtoToCatalogLimits };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/catalog/map-deployment-limits-to-input.ts
|
|
2
|
+
var e = (e) => {
|
|
3
|
+
let t = e?.monthTokenStats;
|
|
4
|
+
if (t == null || !Number.isFinite(t.total) || !Number.isFinite(t.used) || t.total <= 0 || t.total >= 2 ** 53 - 1) return;
|
|
5
|
+
let n = Math.max(0, t.used);
|
|
6
|
+
return {
|
|
7
|
+
used: n,
|
|
8
|
+
total: t.total,
|
|
9
|
+
remaining: Math.max(0, t.total - n),
|
|
10
|
+
usedPercent: Math.min(100, Math.round(n / t.total * 100))
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { e as mapDeploymentLimitsToInput };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { safeDecodeURIComponent as e } from "../shared/string-utils.js";
|
|
2
|
+
import { isPublicToolsetId as t } from "../oauth/toolset-id.js";
|
|
3
|
+
import { resolveLocalizedText as n } from "../shared/locale.js";
|
|
4
|
+
import { mapEntityDetailsToCatalogDetails as r } from "./map-entity-details-to-catalog.js";
|
|
5
|
+
import { CatalogEntityType as i, formatLastUsed as a } from "@epam/ai-dial-chat-shared";
|
|
6
|
+
import { CredentialStatus as o, ToolsetAuthenticationType as s } from "@epam/ai-dial-catalog";
|
|
7
|
+
//#region src/catalog/map-deployment-to-catalog-item.ts
|
|
8
|
+
var c = {
|
|
9
|
+
NONE: s.None,
|
|
10
|
+
API_KEY: s.ApiKey,
|
|
11
|
+
OAUTH: s.OAuth
|
|
12
|
+
}, l = {
|
|
13
|
+
SIGNED_IN: o.SignedIn,
|
|
14
|
+
SIGNED_OUT: o.SignedOut,
|
|
15
|
+
FAILED: o.Failed
|
|
16
|
+
}, u = (e, n, r) => {
|
|
17
|
+
if (n == null) return;
|
|
18
|
+
let i = t(e), a = n.userLevelAuthStatus ? l[n.userLevelAuthStatus] : void 0, u = n.globalAuthStatus ? l[n.globalAuthStatus] : void 0;
|
|
19
|
+
return {
|
|
20
|
+
authenticationType: !r && i && a !== o.SignedIn && u === o.SignedIn ? s.None : c[n.authenticationType],
|
|
21
|
+
userStatus: a,
|
|
22
|
+
globalStatus: u,
|
|
23
|
+
isPublic: i,
|
|
24
|
+
isManageableByAdmin: r && i,
|
|
25
|
+
apiKeyHeader: n.apiKeyHeader
|
|
26
|
+
};
|
|
27
|
+
}, d = {
|
|
28
|
+
model: i.Model,
|
|
29
|
+
toolset: i.Toolset,
|
|
30
|
+
application: i.Agent
|
|
31
|
+
}, f = "applications/", p = "toolsets/", m = "public", h = (t, n) => (t.startsWith(n) ? t.slice(n.length) : t).split("/").filter(Boolean).map(e), g = (e, t) => {
|
|
32
|
+
if (e.isMy) return [t.personal];
|
|
33
|
+
let n = h(e.applicationFolder ?? "", f);
|
|
34
|
+
return e.sharedWithMe ? [t.shared, ...n.slice(1)] : n[0]?.toLowerCase() === m ? [t.public, ...n.slice(1)] : n;
|
|
35
|
+
}, _ = (e, t) => {
|
|
36
|
+
if (e.isMy && t != null) return [t.personal];
|
|
37
|
+
let n = e.toolset || e.id;
|
|
38
|
+
if (!n.startsWith(p)) return [];
|
|
39
|
+
let r = h(n, p).slice(0, -1);
|
|
40
|
+
return e.sharedWithMe && t != null ? [t.shared, ...r.slice(1)] : r[0]?.toLowerCase() === m && t != null ? [t.public, ...r.slice(1)] : r.slice(1);
|
|
41
|
+
}, v = (e, { favoriteIds: t = /* @__PURE__ */ new Set(), entityDetails: o, folderLabels: s, editableSchemaIds: c = [], isCustomAppsEditable: l = !1, activeLocale: u, primaryLocale: f, resolveIconUrl: p }) => {
|
|
42
|
+
let m = n(e.displayName, u, f) || e.id, h = (e.type ?? "").toLowerCase();
|
|
43
|
+
return {
|
|
44
|
+
id: e.id,
|
|
45
|
+
type: d[h] ?? i.Model,
|
|
46
|
+
name: m,
|
|
47
|
+
description: n(e.description, u, f),
|
|
48
|
+
iconUrl: p(e.iconUrl),
|
|
49
|
+
version: e.displayVersion ?? "",
|
|
50
|
+
lastUsed: a(e.updatedAt),
|
|
51
|
+
updatedAt: e.updatedAt,
|
|
52
|
+
createdAt: e.createdAt,
|
|
53
|
+
isFeatured: e.isFeatured ?? !1,
|
|
54
|
+
isHidden: e.isHidden ?? !1,
|
|
55
|
+
topics: e.topics ?? [],
|
|
56
|
+
isUserFavorite: t.has(e.id),
|
|
57
|
+
isStarred: t.has(e.id),
|
|
58
|
+
isMyApp: e.isMy ?? !1,
|
|
59
|
+
sharedWithMe: e.sharedWithMe ?? !1,
|
|
60
|
+
isEditable: (!!e.isMy || !!e.canEdit) && (c.length > 0 && c.includes(e.applicationTypeSchemaId ?? "") || l && !e.applicationTypeSchemaId && h === "application"),
|
|
61
|
+
folder: g(e, s),
|
|
62
|
+
details: o == null ? void 0 : r(o),
|
|
63
|
+
supportsMcp: e.features?.mcp === !0,
|
|
64
|
+
supportsChat: e.interfaces == null || e.interfaces.includes("chat")
|
|
65
|
+
};
|
|
66
|
+
}, y = (e, { favoriteIds: t = /* @__PURE__ */ new Set(), isAdmin: r = !1, folderLabels: o, activeLocale: s, primaryLocale: c, resolveIconUrl: l }) => {
|
|
67
|
+
let d = n(e.displayName, s, c) || e.toolset || e.reference || e.id, f = e.allowedTools ?? [];
|
|
68
|
+
return {
|
|
69
|
+
id: e.id,
|
|
70
|
+
type: i.Toolset,
|
|
71
|
+
name: d,
|
|
72
|
+
description: n(e.description, s, c),
|
|
73
|
+
iconUrl: l(e.iconUrl),
|
|
74
|
+
version: e.displayVersion ?? "",
|
|
75
|
+
lastUsed: a(e.updatedAt),
|
|
76
|
+
updatedAt: e.updatedAt,
|
|
77
|
+
createdAt: e.createdAt,
|
|
78
|
+
isFeatured: !1,
|
|
79
|
+
isHidden: !1,
|
|
80
|
+
topics: e.descriptionKeywords ?? [],
|
|
81
|
+
isUserFavorite: t.has(e.id),
|
|
82
|
+
isStarred: t.has(e.id),
|
|
83
|
+
isMyApp: e.isMy ?? !1,
|
|
84
|
+
sharedWithMe: e.sharedWithMe ?? !1,
|
|
85
|
+
isEditable: !!(e.isMy || e.canEdit),
|
|
86
|
+
folder: _(e, o),
|
|
87
|
+
credentials: u(e.id, e.authSettings, r),
|
|
88
|
+
details: f.length > 0 ? { tools: { tools: f.map((e) => ({ name: e })) } } : void 0
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
//#endregion
|
|
92
|
+
export { v as mapDeploymentToCatalogItem, u as mapDeploymentToolsetCredentials, y as mapToolsetToCatalogItem, g as resolveDeploymentFolder };
|