@epam/ai-dial-chat-hooks 1.2.0-dev.14 → 1.2.0-dev.142
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/api-error.js +5 -4
- 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 +30 -27
- package/catalog/publish.js +2 -1
- package/catalog/useApplicationCredentials/useApplicationCredentials.js +39 -0
- package/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js +39 -39
- package/catalog/useSkillItemDetails.js +17 -13
- package/catalog.d.ts +42 -5
- package/catalog.js +6 -5
- package/conversation/conversation-transfer/queue.js +8 -5
- package/conversation/create-chat-stream-api.js +30 -21
- package/conversation/stage.js +23 -0
- package/conversation/useAttachmentUpload/useAttachmentUpload.js +12 -5
- 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/generation-resume.js +75 -63
- package/conversation/useConversationStream/useConversationStream.js +145 -102
- package/conversation-overlay.d.ts +7 -0
- package/conversation-overlay.js +2 -0
- package/conversation-sources/useConversationSources/useConversationSources.js +31 -24
- package/conversation-sources.d.ts +1 -1
- package/conversation.d.ts +140 -8
- package/conversation.js +31 -30
- 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 +750 -35
- package/index.js +123 -111
- package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +7 -5
- package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +1 -1
- package/mcp-apps/useMcpAppTools/useMcpAppTools.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-task-trigger.js +7 -2
- 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 +180 -3
- 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/utils.d.ts +3 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { formatCost as e } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { UsageLimitStatus as t } from "@epam/ai-dial-usage-dashboard";
|
|
3
|
+
//#region src/usage/map-usage-data-to-dashboard.ts
|
|
4
|
+
var n = {
|
|
5
|
+
todayTitle: "usage.todayTitle",
|
|
6
|
+
todayPeriodDescription: "usage.todayPeriodDescription",
|
|
7
|
+
thisWeekTitle: "usage.thisWeekTitle",
|
|
8
|
+
thisWeekPeriodDescription: "usage.thisWeekPeriodDescription",
|
|
9
|
+
thisMonthTitle: "usage.thisMonthTitle",
|
|
10
|
+
thisMonthPeriodDescription: "usage.thisMonthPeriodDescription",
|
|
11
|
+
unlimitedProgressAriaLabel: "usage.unlimitedProgressAriaLabel",
|
|
12
|
+
progressAriaLabel: "usage.progressAriaLabel"
|
|
13
|
+
}, r = 2 ** 53, i = 75, a = (e) => e != null && Number.isFinite(e.total) && Number.isFinite(e.used), o = (e) => e >= 100 ? t.LimitReached : e >= i ? t.RunningLow : t.Default, s = (e) => e ? {
|
|
14
|
+
resetLabel: e.label,
|
|
15
|
+
resetIsoValue: e.isoValue,
|
|
16
|
+
resetAriaLabel: e.ariaLabel
|
|
17
|
+
} : {}, c = (i, a, c, l, u) => {
|
|
18
|
+
let d = Math.max(0, i.used), f = e(d), p = s(u);
|
|
19
|
+
if (i.total >= r) return {
|
|
20
|
+
title: a,
|
|
21
|
+
periodDescription: c,
|
|
22
|
+
used: d,
|
|
23
|
+
total: i.total,
|
|
24
|
+
usedLabel: f,
|
|
25
|
+
isUnlimited: !0,
|
|
26
|
+
status: t.Default,
|
|
27
|
+
progressAriaLabel: l(n.unlimitedProgressAriaLabel, { used: f }),
|
|
28
|
+
...p
|
|
29
|
+
};
|
|
30
|
+
let m = Math.max(i.total, 0), h = Math.max(m - d, 0), g = m > 0 ? d / m * 100 : 100, _ = e(m);
|
|
31
|
+
return {
|
|
32
|
+
title: a,
|
|
33
|
+
periodDescription: c,
|
|
34
|
+
used: d,
|
|
35
|
+
total: m,
|
|
36
|
+
usedLabel: f,
|
|
37
|
+
totalLabel: _,
|
|
38
|
+
remainingLabel: e(h),
|
|
39
|
+
usedPercent: g,
|
|
40
|
+
status: o(g),
|
|
41
|
+
progressAriaLabel: l(n.progressAriaLabel, {
|
|
42
|
+
used: f,
|
|
43
|
+
total: _,
|
|
44
|
+
percent: Math.round(g)
|
|
45
|
+
}),
|
|
46
|
+
...p
|
|
47
|
+
};
|
|
48
|
+
}, l = (e, t, r) => [
|
|
49
|
+
{
|
|
50
|
+
stats: e?.dayCostStats,
|
|
51
|
+
titleKey: n.todayTitle,
|
|
52
|
+
periodDescriptionKey: n.todayPeriodDescription
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
stats: e?.weekCostStats,
|
|
56
|
+
titleKey: n.thisWeekTitle,
|
|
57
|
+
periodDescriptionKey: n.thisWeekPeriodDescription
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
stats: e?.monthCostStats,
|
|
61
|
+
titleKey: n.thisMonthTitle,
|
|
62
|
+
periodDescriptionKey: n.thisMonthPeriodDescription
|
|
63
|
+
}
|
|
64
|
+
].flatMap(({ stats: e, titleKey: n, periodDescriptionKey: i }) => a(e) ? [c(e, t(n), t(i), t, r(e.resetsAt))] : []);
|
|
65
|
+
//#endregion
|
|
66
|
+
export { n as USAGE_DATA_I18N_KEYS, l as mapUsageDataToDashboard };
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { formatCost as e } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { DeploymentItemDtoTypeEnum as t } from "@epam/ai-dial-chat-api-client";
|
|
3
|
+
import { ModelLimitMetricKind as n, ModelLimitStatus as r } from "@epam/ai-dial-usage-dashboard";
|
|
4
|
+
//#region src/usage/map-user-usage-to-model-limits.ts
|
|
5
|
+
var i = 2 ** 53, a = 75, o = new Intl.NumberFormat(void 0, {
|
|
6
|
+
notation: "compact",
|
|
7
|
+
maximumFractionDigits: 1
|
|
8
|
+
}), s = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }), c = {
|
|
9
|
+
todayPeriodDescription: "usage.todayPeriodDescription",
|
|
10
|
+
thisWeekPeriodDescription: "usage.thisWeekPeriodDescription",
|
|
11
|
+
thisMonthPeriodDescription: "usage.thisMonthPeriodDescription",
|
|
12
|
+
overallCostLimitRunningLowTooltip: "usage.overallCostLimitRunningLowTooltip",
|
|
13
|
+
overallCostLimitReachedTooltip: "usage.overallCostLimitReachedTooltip",
|
|
14
|
+
unavailableLabel: "usage.unavailableLabel",
|
|
15
|
+
followsCostLimitLabel: "usage.followsCostLimitLabel",
|
|
16
|
+
noLimitLabel: "usage.noLimitLabel",
|
|
17
|
+
followsCostLimitAriaLabel: "usage.followsCostLimitAriaLabel",
|
|
18
|
+
unlimitedProgressAriaLabel: "usage.unlimitedProgressAriaLabel",
|
|
19
|
+
progressAriaLabel: "usage.progressAriaLabel",
|
|
20
|
+
spentLabel: "usage.spentLabel"
|
|
21
|
+
}, l = {
|
|
22
|
+
day: {
|
|
23
|
+
cost: "dayCostStats",
|
|
24
|
+
tokens: "dayTokenStats"
|
|
25
|
+
},
|
|
26
|
+
week: {
|
|
27
|
+
cost: "weekCostStats",
|
|
28
|
+
tokens: "weekTokenStats"
|
|
29
|
+
},
|
|
30
|
+
month: {
|
|
31
|
+
cost: "monthCostStats",
|
|
32
|
+
tokens: "monthTokenStats"
|
|
33
|
+
}
|
|
34
|
+
}, u = {
|
|
35
|
+
day: {
|
|
36
|
+
field: "dayCostStats",
|
|
37
|
+
labelKey: c.todayPeriodDescription
|
|
38
|
+
},
|
|
39
|
+
week: {
|
|
40
|
+
field: "weekCostStats",
|
|
41
|
+
labelKey: c.thisWeekPeriodDescription
|
|
42
|
+
},
|
|
43
|
+
month: {
|
|
44
|
+
field: "monthCostStats",
|
|
45
|
+
labelKey: c.thisMonthPeriodDescription
|
|
46
|
+
}
|
|
47
|
+
}, d = (e) => e != null && Number.isFinite(e.total) && Number.isFinite(e.used), f = (e) => e >= 100 ? r.LimitReached : e >= a ? r.RunningLow : r.WithinLimits, p = (e) => {
|
|
48
|
+
if (!d(e)) return r.Unavailable;
|
|
49
|
+
if (e.total >= i) return r.NoLimit;
|
|
50
|
+
let t = Math.max(0, e.used), n = Math.max(0, e.total);
|
|
51
|
+
return f(n > 0 ? t / n * 100 : 100);
|
|
52
|
+
}, m = (e) => e === r.WithinLimits || e === r.RunningLow || e === r.LimitReached, h = (e, t, n, i, a) => {
|
|
53
|
+
let o = e?.[t.field], s = p(o), l = a(o?.resetsAt), u = i(t.labelKey).toLocaleLowerCase(n);
|
|
54
|
+
return {
|
|
55
|
+
status: s,
|
|
56
|
+
tooltipLabel: s === r.LimitReached ? i(c.overallCostLimitReachedTooltip, { period: u }) : s === r.RunningLow ? i(c.overallCostLimitRunningLowTooltip, { period: u }) : void 0,
|
|
57
|
+
...l ? {
|
|
58
|
+
resetLabel: l.label,
|
|
59
|
+
resetIsoValue: l.isoValue,
|
|
60
|
+
resetAriaLabel: l.ariaLabel
|
|
61
|
+
} : {}
|
|
62
|
+
};
|
|
63
|
+
}, g = () => void 0, _ = (e, t, n, r = g) => ({
|
|
64
|
+
day: h(e, u.day, t, n, r),
|
|
65
|
+
week: h(e, u.week, t, n, r),
|
|
66
|
+
month: h(e, u.month, t, n, r)
|
|
67
|
+
}), v = (e) => ({
|
|
68
|
+
kind: n.Unavailable,
|
|
69
|
+
ariaLabel: e(c.unavailableLabel)
|
|
70
|
+
}), y = (e, t, r) => {
|
|
71
|
+
if (!d(e)) return v(r);
|
|
72
|
+
let a = Math.max(0, e.used), l = o.format(a);
|
|
73
|
+
if (e.total >= i) {
|
|
74
|
+
let e = m(t);
|
|
75
|
+
return {
|
|
76
|
+
kind: n.Unlimited,
|
|
77
|
+
usedLabel: l,
|
|
78
|
+
supportingLabel: r(e ? c.followsCostLimitLabel : c.noLimitLabel),
|
|
79
|
+
ariaLabel: r(e ? c.followsCostLimitAriaLabel : c.unlimitedProgressAriaLabel, { used: s.format(a) })
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
let u = Math.max(e.total, 0), p = o.format(u), h = u > 0 ? a / u * 100 : 100, g = f(h);
|
|
83
|
+
return {
|
|
84
|
+
kind: n.Finite,
|
|
85
|
+
usedLabel: l,
|
|
86
|
+
totalLabel: p,
|
|
87
|
+
usedPercent: h,
|
|
88
|
+
status: g,
|
|
89
|
+
ariaLabel: r(c.progressAriaLabel, {
|
|
90
|
+
used: s.format(a),
|
|
91
|
+
total: s.format(u),
|
|
92
|
+
percent: Math.round(h)
|
|
93
|
+
})
|
|
94
|
+
};
|
|
95
|
+
}, b = (t, r) => {
|
|
96
|
+
if (!d(t)) return v(r);
|
|
97
|
+
let a = Math.max(0, t.used), o = r(c.spentLabel, { amount: e(a) });
|
|
98
|
+
if (t.total >= i) return {
|
|
99
|
+
kind: n.Unlimited,
|
|
100
|
+
usedLabel: o,
|
|
101
|
+
ariaLabel: o
|
|
102
|
+
};
|
|
103
|
+
let s = Math.max(t.total, 0), l = s > 0 ? a / s * 100 : 100;
|
|
104
|
+
return {
|
|
105
|
+
kind: n.Finite,
|
|
106
|
+
usedLabel: o,
|
|
107
|
+
totalLabel: e(s),
|
|
108
|
+
usedPercent: l,
|
|
109
|
+
status: f(l),
|
|
110
|
+
ariaLabel: r(c.progressAriaLabel, {
|
|
111
|
+
used: e(a),
|
|
112
|
+
total: e(s),
|
|
113
|
+
percent: Math.round(l)
|
|
114
|
+
})
|
|
115
|
+
};
|
|
116
|
+
}, x = (e, t, n, r) => ({
|
|
117
|
+
tokens: y(e[t.tokens], n, r),
|
|
118
|
+
cost: b(e[t.cost], r)
|
|
119
|
+
}), S = (e) => e.filter((e) => e.kind === n.Finite).map((e) => e.status), C = (e, t, i) => {
|
|
120
|
+
let a = [
|
|
121
|
+
...S(e),
|
|
122
|
+
...S(t),
|
|
123
|
+
...i
|
|
124
|
+
].filter((e) => e != null && m(e));
|
|
125
|
+
return a.includes(r.LimitReached) ? r.LimitReached : a.includes(r.RunningLow) ? r.RunningLow : a.includes(r.WithinLimits) ? r.WithinLimits : e.some((e) => e.kind === n.Unlimited) || i.includes(r.NoLimit) ? r.NoLimit : r.Unavailable;
|
|
126
|
+
}, w = (e) => e.some((e) => d(e) && e.used > 0), T = (e, n, r, i, a, o) => {
|
|
127
|
+
let s = e?.deployments;
|
|
128
|
+
if (s == null) return [];
|
|
129
|
+
let c = new Map(n.filter((e) => e.type === t.Model).map((e) => [e.id, e])), u = _(e, r, i);
|
|
130
|
+
return Object.keys(s).map((e) => {
|
|
131
|
+
let t = c.get(e), n = t == null ? e : o(t.displayName, r) || t.id, d = s[e], f = a(t?.iconUrl), p = x(d, l.day, u.day.status, i), m = x(d, l.week, u.week.status, i), h = x(d, l.month, u.month.status, i), g = Object.values(l).flatMap(({ cost: e, tokens: t }) => [d[e], d[t]]);
|
|
132
|
+
return {
|
|
133
|
+
row: {
|
|
134
|
+
id: e,
|
|
135
|
+
name: n,
|
|
136
|
+
version: t?.displayVersion,
|
|
137
|
+
avatarSrc: f,
|
|
138
|
+
day: p,
|
|
139
|
+
week: m,
|
|
140
|
+
month: h,
|
|
141
|
+
status: C([
|
|
142
|
+
p.tokens,
|
|
143
|
+
m.tokens,
|
|
144
|
+
h.tokens
|
|
145
|
+
], [
|
|
146
|
+
p.cost,
|
|
147
|
+
m.cost,
|
|
148
|
+
h.cost
|
|
149
|
+
], [
|
|
150
|
+
u.day.status,
|
|
151
|
+
u.week.status,
|
|
152
|
+
u.month.status
|
|
153
|
+
])
|
|
154
|
+
},
|
|
155
|
+
hasUsage: w(g)
|
|
156
|
+
};
|
|
157
|
+
}).filter(({ hasUsage: e }) => e).map(({ row: e }) => e);
|
|
158
|
+
};
|
|
159
|
+
//#endregion
|
|
160
|
+
export { c as USAGE_MODEL_LIMITS_I18N_KEYS, _ as mapOverallCostLimitsToPeriodStatuses, T as mapUserUsageToModelLimits };
|
package/usage.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { DeploymentItemDto } from '@epam/ai-dial-chat-api-client';
|
|
2
|
+
import { ModelLimitPeriodStatuses } from '@epam/ai-dial-usage-dashboard';
|
|
3
|
+
import { ModelLimitRow } from '@epam/ai-dial-usage-dashboard';
|
|
4
|
+
import { UsageLimitCardData } from '@epam/ai-dial-usage-dashboard';
|
|
5
|
+
import { UserLimitStatsResponseDto } from '@epam/ai-dial-chat-api-client';
|
|
6
|
+
|
|
7
|
+
/** Formats a raw `resetsAt` into display strings, or returns `undefined` when it cannot be formatted. */
|
|
8
|
+
export declare type FormatResetTime = (resetsAt: string | undefined) => ResetTimeDisplay | undefined;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Maps the same top-level Cost budgets used by the aggregate cards into table-header state.
|
|
12
|
+
*
|
|
13
|
+
* @param formatResetTime - Formats each period's top-level `resetsAt` into the header's reset trio. Omit it to produce statuses with no reset fields.
|
|
14
|
+
*/
|
|
15
|
+
export declare const mapOverallCostLimitsToPeriodStatuses: (usage: UserLimitStatsResponseDto | undefined, activeLocale: string, t: Translate_2, formatResetTime?: FormatResetTime) => ModelLimitPeriodStatuses;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Maps a `UserLimitStatsResponseDto` into `UsageLimitCardGroup`'s `cards` prop,
|
|
19
|
+
* in Today / This week / This month order. A period is omitted entirely when
|
|
20
|
+
* the response carries no usable stat for it. Each card's reset trio comes from
|
|
21
|
+
* `formatResetTime`, and is absent when that callback returns `undefined`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const mapUsageDataToDashboard: (usage: UserLimitStatsResponseDto | undefined, t: Translate, formatResetTime: FormatResetTime) => UsageLimitCardData[];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Maps `usage.deployments` into `ModelLimitsSection`'s `rows` prop, joined with model identity
|
|
27
|
+
* from `deploymentItems`. Rows are included only when any displayed period stat has nonzero usage.
|
|
28
|
+
* Order follows `Object.keys(deployments)` — `deploymentItems` is enrichment-only.
|
|
29
|
+
*
|
|
30
|
+
* @param resolveIconUrl - Resolves a deployment's raw `iconUrl` to the URL the avatar should load.
|
|
31
|
+
* @param resolveDisplayName - Resolves a localized-text map or plain string to the display name for `activeLocale`.
|
|
32
|
+
*/
|
|
33
|
+
export declare const mapUserUsageToModelLimits: (usage: UserLimitStatsResponseDto | undefined, deploymentItems: DeploymentItemDto[], activeLocale: string, t: Translate_2, resolveIconUrl: ResolveIconUrl, resolveDisplayName: ResolveDisplayName) => ModelLimitRow[];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* One reset time, already parsed and formatted by the host. Declared
|
|
37
|
+
* structurally here so this library never imports an application type; the
|
|
38
|
+
* host passes a value that satisfies this shape (e.g. `apps/chat`'s own
|
|
39
|
+
* `ResetTimeDisplay`).
|
|
40
|
+
*/
|
|
41
|
+
export declare interface ResetTimeDisplay {
|
|
42
|
+
/** Exclusive end of the period as an epoch ms value, for the host's boundary scheduling. */
|
|
43
|
+
resetsAtMs: number;
|
|
44
|
+
/** Machine-readable instant for a `<time dateTime>` attribute. */
|
|
45
|
+
isoValue: string;
|
|
46
|
+
/** Visible reset line. */
|
|
47
|
+
label: string;
|
|
48
|
+
/** Accessible expansion of the reset line. */
|
|
49
|
+
ariaLabel: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** A callback that resolves a display name from a localized-text value. */
|
|
53
|
+
declare type ResolveDisplayName = (name: string | Record<string, string> | undefined | null, locale: string) => string;
|
|
54
|
+
|
|
55
|
+
/** A callback that resolves an icon URL from a deployment's raw `iconUrl` field. */
|
|
56
|
+
declare type ResolveIconUrl = (iconUrl: string | undefined) => string | undefined;
|
|
57
|
+
|
|
58
|
+
/** A translate function compatible with i18next's `TFunction`. */
|
|
59
|
+
declare type Translate = (key: string, options?: Record<string, unknown>) => string;
|
|
60
|
+
|
|
61
|
+
/** A translate function compatible with i18next's `TFunction`. */
|
|
62
|
+
declare type Translate_2 = (key: string, options?: Record<string, unknown>) => string;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* i18n key strings that the consuming app's translation bundle must define for
|
|
66
|
+
* `mapUsageDataToDashboard` to produce correctly translated strings. The
|
|
67
|
+
* values are the default key paths used by AI DIAL Chat.
|
|
68
|
+
*/
|
|
69
|
+
export declare const USAGE_DATA_I18N_KEYS: {
|
|
70
|
+
/** Title for the current-UTC-day card (e.g. `'Today'`). */
|
|
71
|
+
readonly todayTitle: "usage.todayTitle";
|
|
72
|
+
/** Accessible period description for the current-UTC-day card. */
|
|
73
|
+
readonly todayPeriodDescription: "usage.todayPeriodDescription";
|
|
74
|
+
/** Title for the current-UTC-week card (e.g. `'This week'`). */
|
|
75
|
+
readonly thisWeekTitle: "usage.thisWeekTitle";
|
|
76
|
+
/** Accessible period description for the current-UTC-week card. */
|
|
77
|
+
readonly thisWeekPeriodDescription: "usage.thisWeekPeriodDescription";
|
|
78
|
+
/** Title for the current-UTC-month card (e.g. `'This month'`). */
|
|
79
|
+
readonly thisMonthTitle: "usage.thisMonthTitle";
|
|
80
|
+
/** Accessible period description for the current-UTC-month card. */
|
|
81
|
+
readonly thisMonthPeriodDescription: "usage.thisMonthPeriodDescription";
|
|
82
|
+
/** Aria label when there is no limit. Receives `{ used: string }`. */
|
|
83
|
+
readonly unlimitedProgressAriaLabel: "usage.unlimitedProgressAriaLabel";
|
|
84
|
+
/** Aria label for a progress bar with a finite limit. Receives `{ used: string, total: string, percent: number }`. */
|
|
85
|
+
readonly progressAriaLabel: "usage.progressAriaLabel";
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* i18n key strings that the consuming app's translation bundle must define for
|
|
90
|
+
* `mapUserUsageToModelLimits` and `mapOverallCostLimitsToPeriodStatuses` to produce
|
|
91
|
+
* correctly translated strings. The values are the default key paths used by AI DIAL Chat.
|
|
92
|
+
*/
|
|
93
|
+
export declare const USAGE_MODEL_LIMITS_I18N_KEYS: {
|
|
94
|
+
/** Period label used in tooltip text. Receives no interpolation. */
|
|
95
|
+
readonly todayPeriodDescription: "usage.todayPeriodDescription";
|
|
96
|
+
/** Period label used in tooltip text. Receives no interpolation. */
|
|
97
|
+
readonly thisWeekPeriodDescription: "usage.thisWeekPeriodDescription";
|
|
98
|
+
/** Period label used in tooltip text. Receives no interpolation. */
|
|
99
|
+
readonly thisMonthPeriodDescription: "usage.thisMonthPeriodDescription";
|
|
100
|
+
/** Tooltip when the overall cost limit is running low. Receives `{ period: string }`. */
|
|
101
|
+
readonly overallCostLimitRunningLowTooltip: "usage.overallCostLimitRunningLowTooltip";
|
|
102
|
+
/** Tooltip when the overall cost limit is reached. Receives `{ period: string }`. */
|
|
103
|
+
readonly overallCostLimitReachedTooltip: "usage.overallCostLimitReachedTooltip";
|
|
104
|
+
/** Aria label for a metric cell with no data. */
|
|
105
|
+
readonly unavailableLabel: "usage.unavailableLabel";
|
|
106
|
+
/** Supporting label when a token limit follows the cost limit. */
|
|
107
|
+
readonly followsCostLimitLabel: "usage.followsCostLimitLabel";
|
|
108
|
+
/** Supporting label when there is no per-deployment token limit. */
|
|
109
|
+
readonly noLimitLabel: "usage.noLimitLabel";
|
|
110
|
+
/** Aria label when token usage has no limit but follows the cost limit. Receives `{ used: string }`. */
|
|
111
|
+
readonly followsCostLimitAriaLabel: "usage.followsCostLimitAriaLabel";
|
|
112
|
+
/** Aria label when there is no limit. Receives `{ used: string }`. */
|
|
113
|
+
readonly unlimitedProgressAriaLabel: "usage.unlimitedProgressAriaLabel";
|
|
114
|
+
/** Aria label for a progress bar with a finite limit. Receives `{ used: string, total: string, percent: number }`. */
|
|
115
|
+
readonly progressAriaLabel: "usage.progressAriaLabel";
|
|
116
|
+
/** Label for the spent-cost cell. Receives `{ amount: string }`. */
|
|
117
|
+
readonly spentLabel: "usage.spentLabel";
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export { }
|
package/usage.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { USAGE_DATA_I18N_KEYS as e, mapUsageDataToDashboard as t } from "./usage/map-usage-data-to-dashboard.js";
|
|
2
|
+
import { USAGE_MODEL_LIMITS_I18N_KEYS as n, mapOverallCostLimitsToPeriodStatuses as r, mapUserUsageToModelLimits as i } from "./usage/map-user-usage-to-model-limits.js";
|
|
3
|
+
export { e as USAGE_DATA_I18N_KEYS, n as USAGE_MODEL_LIMITS_I18N_KEYS, r as mapOverallCostLimitsToPeriodStatuses, t as mapUsageDataToDashboard, i as mapUserUsageToModelLimits };
|
package/utils.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ import { UserLimitStatsResponseDto } from '@epam/ai-dial-chat-api-client';
|
|
|
10
10
|
|
|
11
11
|
/** Normalized shape returned by {@link getApiErrorDetails}. */
|
|
12
12
|
export declare interface ApiErrorDetails {
|
|
13
|
+
/** Stable domain error code supplied by the API, when present. */
|
|
14
|
+
code?: string;
|
|
13
15
|
/** HTTP status code carried by the error, when available. */
|
|
14
16
|
status?: number;
|
|
15
17
|
/** Resolved human-readable error message, or `null` when none could be resolved. */
|
|
@@ -132,7 +134,7 @@ export declare interface ExportedPrompt {
|
|
|
132
134
|
/** Formats a Unix timestamp (ms) as a locale-formatted calendar date, e.g. `'22/7/2026'`. */
|
|
133
135
|
export declare const formatCalendarDate: (timestampMs: number) => string;
|
|
134
136
|
|
|
135
|
-
/** Normalizes any API error into a `{ status?, message, traceId? }` shape. */
|
|
137
|
+
/** Normalizes any API error into a `{ status?, message, traceId?, code? }` shape. */
|
|
136
138
|
export declare const getApiErrorDetails: (error: unknown) => Promise<ApiErrorDetails>;
|
|
137
139
|
|
|
138
140
|
/** Resolves a human-readable message from an API error's response body, or falls back to `Error.message`. */
|