@epam/ai-dial-chat-shared 1.1.0-dev.444 → 1.1.0-dev.445
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/index.d.ts +36 -9
- package/index.js +41 -41
- package/package.json +1 -1
- package/utils/prompt-variables.js +22 -6
package/index.d.ts
CHANGED
|
@@ -159,6 +159,12 @@ export declare const BASE_MD_ICON_PROPS: {
|
|
|
159
159
|
/** Builds a `CSSProperties` object from a record of CSS custom property names to values, omitting entries with `undefined` or empty-string values. */
|
|
160
160
|
export declare const buildCssVars: (vars: Record<string, string | number | undefined>) => CSSProperties;
|
|
161
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Returns the starting values for `parameters`, keyed by name — one entry per
|
|
164
|
+
* parameter that carries a default, and nothing for the rest.
|
|
165
|
+
*/
|
|
166
|
+
export declare const buildPromptParamDefaults: (parameters: PromptParameter[]) => Record<string, string>;
|
|
167
|
+
|
|
162
168
|
/** Entity type for a catalog item. Values are uppercase for direct color-map lookup. */
|
|
163
169
|
export declare enum CatalogEntityType {
|
|
164
170
|
Model = "MODEL",
|
|
@@ -958,10 +964,12 @@ export declare interface ExportFormat {
|
|
|
958
964
|
export declare const extractInitials: (name: string) => string;
|
|
959
965
|
|
|
960
966
|
/**
|
|
961
|
-
* Returns the distinct
|
|
962
|
-
* order. Single-brace sequences (e.g. `{name}`) are not parameters.
|
|
967
|
+
* Returns the distinct parameters found in `content`, in first-occurrence
|
|
968
|
+
* order. Single-brace sequences (e.g. `{name}`) are not parameters. When one
|
|
969
|
+
* name appears more than once the first occurrence decides the default, so the
|
|
970
|
+
* parameter is still asked for once.
|
|
963
971
|
*/
|
|
964
|
-
export declare const extractPromptParams: (content: string) =>
|
|
972
|
+
export declare const extractPromptParams: (content: string) => PromptParameter[];
|
|
965
973
|
|
|
966
974
|
/** Featured badge rendered on a catalog card when `item.isFeatured` is true. */
|
|
967
975
|
export declare const FeaturedChip: FC<FeaturedChipProps>;
|
|
@@ -1985,15 +1993,34 @@ declare type PrismStyleMap = Record<string, CSSProperties>;
|
|
|
1985
1993
|
export declare const PROHIBITED_CONVERSATION_NAME_CHARS_RE: RegExp;
|
|
1986
1994
|
|
|
1987
1995
|
/**
|
|
1988
|
-
*
|
|
1989
|
-
* `{{`
|
|
1990
|
-
*
|
|
1996
|
+
* Separator between a parameter's name and its default value inside a token.
|
|
1997
|
+
* `{{language|Spanish}}` names the parameter `language` and offers `Spanish`
|
|
1998
|
+
* as its starting value. It is the form the classic chat's prompt editor
|
|
1999
|
+
* documents, so prompts authored there carry it.
|
|
2000
|
+
*/
|
|
2001
|
+
export declare const PROMPT_PARAM_DEFAULT_SEPARATOR = "|";
|
|
2002
|
+
|
|
2003
|
+
/**
|
|
2004
|
+
* Matches a `{{name}}` or `{{name|defaultValue}}` placeholder. The inner run
|
|
2005
|
+
* excludes braces so a stray `{{` cannot swallow the rest of the document, and
|
|
2006
|
+
* it must be non-empty so a literal `{{}}` stays plain text.
|
|
1991
2007
|
*/
|
|
1992
2008
|
export declare const PROMPT_PARAM_PATTERN: RegExp;
|
|
1993
2009
|
|
|
1994
2010
|
/** Class applied to each highlighted placeholder. The host owns its styling. */
|
|
1995
2011
|
export declare const PROMPT_VARIABLE_CLASS_NAME = "cat-prompt-variable";
|
|
1996
2012
|
|
|
2013
|
+
/** A `{{name}}` or `{{name|defaultValue}}` parameter read out of a prompt. */
|
|
2014
|
+
export declare interface PromptParameter {
|
|
2015
|
+
/** The parameter's name — the label a host shows, and the key its value is read by. */
|
|
2016
|
+
name: string;
|
|
2017
|
+
/**
|
|
2018
|
+
* The value the field starts with, when the token carried one. Absent for a
|
|
2019
|
+
* bare `{{name}}` token.
|
|
2020
|
+
*/
|
|
2021
|
+
defaultValue?: string;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
1997
2024
|
/** Describes an available identity provider. */
|
|
1998
2025
|
export declare interface ProviderInfo {
|
|
1999
2026
|
/** Unique provider identifier used in API calls. */
|
|
@@ -2030,9 +2057,9 @@ export declare const RESIZABLE_FIELD_MAX_HEIGHT_CSS_VARIABLE = "--resizable-fiel
|
|
|
2030
2057
|
export declare const RESIZABLE_TEXTAREA_CLASS_NAME = "max-h-[50vh]";
|
|
2031
2058
|
|
|
2032
2059
|
/**
|
|
2033
|
-
* Replaces every
|
|
2034
|
-
*
|
|
2035
|
-
*
|
|
2060
|
+
* Replaces every parameter occurrence in `content` with the matching entry in
|
|
2061
|
+
* `values` (keyed by parameter name), falling back to the token's own default
|
|
2062
|
+
* value. A token with neither is left unchanged.
|
|
2036
2063
|
*/
|
|
2037
2064
|
export declare const resolvePromptParams: (content: string, values: Record<string, string>) => string;
|
|
2038
2065
|
|
package/index.js
CHANGED
|
@@ -21,44 +21,44 @@ import { formatFileSize as z } from "./utils/format-file-size.js";
|
|
|
21
21
|
import { formatCost as B, formatPrice as V, formatUnitPrice as H } from "./utils/format-price.js";
|
|
22
22
|
import { base64ToBlob as U, downloadTextFile as W, ensureDownloadFilename as G, getFileExtensionForLanguage as K, triggerAnchorDownload as q, triggerBlobDownload as J, tryBase64ToBytes as Y } from "./utils/file-download.js";
|
|
23
23
|
import { ENTITY_TYPE_BG_COLOR as X, ENTITY_TYPE_COLOR as Z } from "./constants/entity-colors.js";
|
|
24
|
-
import {
|
|
25
|
-
import { generateUUID as
|
|
26
|
-
import { BASE_LG_ICON_PROPS as
|
|
27
|
-
import { HIDDEN_FILE as
|
|
28
|
-
import { TAG_INPUT_TAG_CLASS_NAME as
|
|
29
|
-
import { MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME as
|
|
30
|
-
import { MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME as
|
|
31
|
-
import { SELECT_LIST_MAX_HEIGHT_CLASS_NAME as
|
|
32
|
-
import { pickAvatarColor as
|
|
33
|
-
import { extractInitials as
|
|
34
|
-
import { InitialsAvatar as
|
|
35
|
-
import { DeploymentIcon as
|
|
36
|
-
import { CopyButton as
|
|
37
|
-
import { PanelEmptyState as
|
|
38
|
-
import { ItemHeader as
|
|
39
|
-
import { EntityTypeLabel as
|
|
40
|
-
import { FeaturedChip as
|
|
41
|
-
import { EntityHeader as
|
|
42
|
-
import { ResourceSummary as
|
|
43
|
-
import { TableHeader as
|
|
44
|
-
import { useCodeCopy as
|
|
45
|
-
import { restrainedSyntaxTheme as
|
|
46
|
-
import { MarkdownCodeBlock as
|
|
47
|
-
import { DEFAULT_MARKDOWN_TABLE_DOWNLOAD_FILENAME as
|
|
48
|
-
import { MarkdownTable as
|
|
49
|
-
import { MarkdownRenderer as
|
|
50
|
-
import { COMPACT_MARKDOWN_CLASS_NAMES as
|
|
51
|
-
import { MDMessageViewer as
|
|
52
|
-
import { MarkdownWithPlaceholders as
|
|
53
|
-
import { useCollapsedText as
|
|
54
|
-
import { useAvailableHeightCap as
|
|
55
|
-
import { useIsMobile as
|
|
56
|
-
import { DialFileManagerActionProfile as
|
|
57
|
-
import { getParentFolderPath as
|
|
58
|
-
import { FileUploadStatus as
|
|
59
|
-
import { useGridEditingScroll as
|
|
60
|
-
import { OperationLoaderModal as
|
|
61
|
-
import { UploadProgressModal as
|
|
62
|
-
import { DialFileManagerShell as
|
|
63
|
-
import { FileManagerAttachModal as
|
|
64
|
-
export { f as AttachmentErrorReason, p as AttachmentType,
|
|
24
|
+
import { PROMPT_PARAM_DEFAULT_SEPARATOR as Q, PROMPT_PARAM_PATTERN as $, PROMPT_VARIABLE_CLASS_NAME as ee, buildPromptParamDefaults as te, extractPromptParams as ne, rehypePromptVariables as re, resolvePromptParams as ie } from "./utils/prompt-variables.js";
|
|
25
|
+
import { generateUUID as ae } from "./utils/generate-uuid.js";
|
|
26
|
+
import { BASE_LG_ICON_PROPS as oe, BASE_MD_ICON_PROPS as se } from "./constants/icon.js";
|
|
27
|
+
import { HIDDEN_FILE as ce } from "./constants/dial.js";
|
|
28
|
+
import { TAG_INPUT_TAG_CLASS_NAME as le } from "./constants/tag-input.js";
|
|
29
|
+
import { MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME as ue, RESIZABLE_FIELD_MAX_HEIGHT_CSS_VARIABLE as de, RESIZABLE_TEXTAREA_CLASS_NAME as fe } from "./constants/resizable-fields.js";
|
|
30
|
+
import { MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME as pe } from "./constants/markdown-editor.js";
|
|
31
|
+
import { SELECT_LIST_MAX_HEIGHT_CLASS_NAME as me, SELECT_LIST_MAX_HEIGHT_PX as he } from "./constants/select-list.js";
|
|
32
|
+
import { pickAvatarColor as ge } from "./utils/avatar-color.js";
|
|
33
|
+
import { extractInitials as _e } from "./utils/initials.js";
|
|
34
|
+
import { InitialsAvatar as ve } from "./components/InitialsAvatar/InitialsAvatar.js";
|
|
35
|
+
import { DeploymentIcon as ye } from "./components/DeploymentIcon/DeploymentIcon.js";
|
|
36
|
+
import { CopyButton as be, CopyIconButton as xe } from "./components/CopyButton/CopyButton.js";
|
|
37
|
+
import { PanelEmptyState as Se } from "./components/PanelEmptyState/PanelEmptyState.js";
|
|
38
|
+
import { ItemHeader as Ce } from "./components/ItemHeader/ItemHeader.js";
|
|
39
|
+
import { EntityTypeLabel as we } from "./components/EntityTypeLabel/EntityTypeLabel.js";
|
|
40
|
+
import { FeaturedChip as Te } from "./components/FeaturedChip/FeaturedChip.js";
|
|
41
|
+
import { EntityHeader as Ee } from "./components/EntityHeader/EntityHeader.js";
|
|
42
|
+
import { ResourceSummary as De } from "./components/ResourceSummary/ResourceSummary.js";
|
|
43
|
+
import { TableHeader as Oe } from "./components/MarkdownRenderer/Table/TableHeader.js";
|
|
44
|
+
import { useCodeCopy as ke } from "./hooks/useCodeCopy.js";
|
|
45
|
+
import { restrainedSyntaxTheme as Ae } from "./components/MarkdownRenderer/CodeBlock/syntax-theme.js";
|
|
46
|
+
import { MarkdownCodeBlock as je } from "./components/MarkdownRenderer/CodeBlock/CodeBlock.js";
|
|
47
|
+
import { DEFAULT_MARKDOWN_TABLE_DOWNLOAD_FILENAME as Me, MARKDOWN_TABLE_CSV_MIME_TYPE as Ne, MarkdownTableCopyFormat as Pe, serializeMarkdownTableRows as Fe } from "./components/MarkdownRenderer/Table/table-serialization.js";
|
|
48
|
+
import { MarkdownTable as Ie } from "./components/MarkdownRenderer/Table/MarkdownTable.js";
|
|
49
|
+
import { MarkdownRenderer as Le, defaultMarkdownComponents as Re } from "./components/MarkdownRenderer/MarkdownRenderer.js";
|
|
50
|
+
import { COMPACT_MARKDOWN_CLASS_NAMES as ze, DEFAULT_MARKDOWN_CLASS_NAMES as Be } from "./components/MarkdownRenderer/markdown-class-names.js";
|
|
51
|
+
import { MDMessageViewer as Ve } from "./components/MarkdownRenderer/MDMessageViewer.js";
|
|
52
|
+
import { MarkdownWithPlaceholders as He } from "./components/MarkdownWithPlaceholders/MarkdownWithPlaceholders.js";
|
|
53
|
+
import { useCollapsedText as Ue } from "./hooks/useCollapsedText.js";
|
|
54
|
+
import { useAvailableHeightCap as We } from "./hooks/useAvailableHeightCap.js";
|
|
55
|
+
import { useIsMobile as Ge } from "./hooks/useIsMobile.js";
|
|
56
|
+
import { DialFileManagerActionProfile as Ke, DialFileManagerVariant as qe } from "./file-manager/file-manager-variant.js";
|
|
57
|
+
import { getParentFolderPath as Je, isHiddenPath as Ye } from "./file-manager/path.js";
|
|
58
|
+
import { FileUploadStatus as Xe } from "./file-manager/upload-batch.js";
|
|
59
|
+
import { useGridEditingScroll as Ze } from "./file-manager/useGridEditingScroll/useGridEditingScroll.js";
|
|
60
|
+
import { OperationLoaderModal as Qe } from "./file-manager/OperationLoaderModal/OperationLoaderModal.js";
|
|
61
|
+
import { UploadProgressModal as $e } from "./file-manager/UploadProgressModal/UploadProgressModal.js";
|
|
62
|
+
import { DialFileManagerShell as et } from "./file-manager/DialFileManagerShell/DialFileManagerShell.js";
|
|
63
|
+
import { FileManagerAttachModal as tt } from "./file-manager/FileManagerAttachModal/FileManagerAttachModal.js";
|
|
64
|
+
export { f as AttachmentErrorReason, p as AttachmentType, oe as BASE_LG_ICON_PROPS, se as BASE_MD_ICON_PROPS, ze as COMPACT_MARKDOWN_CLASS_NAMES, m as CatalogEntityType, _ as CodeBlockTheme, e as ConversationTransferErrorCode, t as ConversationTransferJobStatus, n as ConversationTransferSubjectKind, r as ConversationTransferUnitKind, i as ConversationTransferWarningCode, be as CopyButton, xe as CopyIconButton, Be as DEFAULT_MARKDOWN_CLASS_NAMES, Me as DEFAULT_MARKDOWN_TABLE_DOWNLOAD_FILENAME, ye as DeploymentIcon, Ke as DialFileManagerActionProfile, et as DialFileManagerShell, qe as DialFileManagerVariant, X as ENTITY_TYPE_BG_COLOR, Z as ENTITY_TYPE_COLOR, Ee as EntityHeader, we as EntityTypeLabel, Te as FeaturedChip, h as FileExtension, tt as FileManagerAttachModal, Xe as FileUploadStatus, a as FilterTab, ce as HIDDEN_FILE, ve as InitialsAvatar, Ce as ItemHeader, ue as MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME, pe as MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME, Ne as MARKDOWN_TABLE_CSV_MIME_TYPE, Ve as MDMessageViewer, g as MIMEType, j as MIME_TYPE_AUDIO_PREFIX, M as MIME_TYPE_EXT_MAP, N as MIME_TYPE_WILDCARD, je as MarkdownCodeBlock, Le as MarkdownRenderer, Ie as MarkdownTable, Pe as MarkdownTableCopyFormat, He as MarkdownWithPlaceholders, o as MessageRating, s as MessageRole, Qe as OperationLoaderModal, v as PROHIBITED_CONVERSATION_NAME_CHARS_RE, Q as PROMPT_PARAM_DEFAULT_SEPARATOR, $ as PROMPT_PARAM_PATTERN, ee as PROMPT_VARIABLE_CLASS_NAME, Se as PanelEmptyState, de as RESIZABLE_FIELD_MAX_HEIGHT_CSS_VARIABLE, fe as RESIZABLE_TEXTAREA_CLASS_NAME, c as RequestStatus, De as ResourceSummary, d as ResponseFormat, me as SELECT_LIST_MAX_HEIGHT_CLASS_NAME, he as SELECT_LIST_MAX_HEIGHT_PX, l as StageStatus, u as StatusEvent, le as TAG_INPUT_TAG_CLASS_NAME, Oe as TableHeader, $e as UploadProgressModal, U as base64ToBlob, w as buildCssVars, te as buildPromptParamDefaults, F as copyMarkdownAsRichText, I as copyToClipboard, Re as defaultMarkdownComponents, W as downloadTextFile, G as ensureDownloadFilename, _e as extractInitials, ne as extractPromptParams, B as formatCost, z as formatFileSize, R as formatLastUsed, V as formatPrice, H as formatUnitPrice, ae as generateUUID, E as getAttachmentTypeFromMime, K as getFileExtensionForLanguage, Je as getParentFolderPath, y as getUtf8ByteLength, D as inferMimeTypeFromPath, P as isAudioTranscriptionSupported, Ye as isHiddenPath, T as isStatusMessage, L as markdownToRichTextHtml, C as mergeClasses, k as messageAttachmentToDisplayAttachment, A as messageAttachmentsToDisplayAttachments, ge as pickAvatarColor, re as rehypePromptVariables, ie as resolvePromptParams, Ae as restrainedSyntaxTheme, b as sanitizeConversationName, Fe as serializeMarkdownTableRows, x as stripTrailingDots, O as stripUrlQueryAndFragment, q as triggerAnchorDownload, J as triggerBlobDownload, S as truncateToUtf8Bytes, Y as tryBase64ToBytes, We as useAvailableHeightCap, ke as useCodeCopy, Ue as useCollapsedText, Ze as useGridEditingScroll, Ge as useIsMobile };
|
package/package.json
CHANGED
|
@@ -32,11 +32,27 @@ var e = /\{\{([^{}]+)\}\}/g, t = "cat-prompt-variable", n = new Set(["code", "pr
|
|
|
32
32
|
e.children = t;
|
|
33
33
|
}, a = () => (e) => {
|
|
34
34
|
i(e);
|
|
35
|
-
}, o = (
|
|
35
|
+
}, o = "|", s = (e) => {
|
|
36
|
+
let t = e.indexOf("|");
|
|
37
|
+
return t === -1 ? { name: e } : {
|
|
38
|
+
name: e.slice(0, t),
|
|
39
|
+
defaultValue: e.slice(t + 1)
|
|
40
|
+
};
|
|
41
|
+
}, c = (t) => {
|
|
36
42
|
e.lastIndex = 0;
|
|
37
|
-
let n = /* @__PURE__ */ new
|
|
38
|
-
for (; r != null;)
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
let n = /* @__PURE__ */ new Map(), r = e.exec(t);
|
|
44
|
+
for (; r != null;) {
|
|
45
|
+
let i = s(r[1]);
|
|
46
|
+
n.has(i.name) || n.set(i.name, i), r = e.exec(t);
|
|
47
|
+
}
|
|
48
|
+
return Array.from(n.values());
|
|
49
|
+
}, l = (t, n) => t.replace(e, (e, t) => {
|
|
50
|
+
let { name: r, defaultValue: i } = s(t);
|
|
51
|
+
return n[r] ?? i ?? e;
|
|
52
|
+
}), u = (e) => {
|
|
53
|
+
let t = {};
|
|
54
|
+
for (let { name: n, defaultValue: r } of e) r != null && (t[n] = r);
|
|
55
|
+
return t;
|
|
56
|
+
};
|
|
41
57
|
//#endregion
|
|
42
|
-
export { e as PROMPT_PARAM_PATTERN, t as PROMPT_VARIABLE_CLASS_NAME,
|
|
58
|
+
export { o as PROMPT_PARAM_DEFAULT_SEPARATOR, e as PROMPT_PARAM_PATTERN, t as PROMPT_VARIABLE_CLASS_NAME, u as buildPromptParamDefaults, c as extractPromptParams, a as rehypePromptVariables, l as resolvePromptParams };
|