@epam/ai-dial-usage-dashboard 1.1.0-dev.280 → 1.1.0-dev.281
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 +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +3399 -181
- package/package.json +3 -2
- package/utils/map-usage-data-to-dashboard.d.ts +35 -0
- package/utils/map-usage-data-to-dashboard.d.ts.map +1 -0
- package/utils/map-user-usage-to-model-limits.d.ts +52 -0
- package/utils/map-user-usage-to-model-limits.d.ts.map +1 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-usage-dashboard",
|
|
3
3
|
"description": "Presentational aggregate cost-limit cards for the Usage settings dashboard",
|
|
4
|
-
"version": "1.1.0-dev.
|
|
4
|
+
"version": "1.1.0-dev.281",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@epam/ai-dial-chat-
|
|
19
|
+
"@epam/ai-dial-chat-api-client": "1.1.0-dev.281",
|
|
20
|
+
"@epam/ai-dial-chat-shared": "1.1.0-dev.281",
|
|
20
21
|
"@epam/ai-dial-ui-kit": "^0.14.0-dev.9",
|
|
21
22
|
"@tabler/icons-react": "^3.44.0",
|
|
22
23
|
"react": "^19.2.7"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { UserLimitStatsResponseDto } from '@epam/ai-dial-chat-api-client';
|
|
2
|
+
import { UsageLimitCardData } from '../models/usage-limit-card-props';
|
|
3
|
+
/** A translate function compatible with i18next's `TFunction`. */
|
|
4
|
+
type Translate = (key: string, options?: Record<string, unknown>) => string;
|
|
5
|
+
/**
|
|
6
|
+
* i18n key strings that the consuming app's translation bundle must define for
|
|
7
|
+
* `mapUsageDataToDashboard` to produce correctly translated strings. The
|
|
8
|
+
* values are the default key paths used by AI DIAL Chat.
|
|
9
|
+
*/
|
|
10
|
+
export declare const USAGE_DATA_I18N_KEYS: {
|
|
11
|
+
/** Title for the "today" card (e.g. `'Daily'`). */
|
|
12
|
+
readonly todayTitle: "usage.todayTitle";
|
|
13
|
+
/** Period description for the "today" card (e.g. `'Today'`). */
|
|
14
|
+
readonly todayPeriodDescription: "usage.todayPeriodDescription";
|
|
15
|
+
/** Title for the "this week" card. */
|
|
16
|
+
readonly thisWeekTitle: "usage.thisWeekTitle";
|
|
17
|
+
/** Period description for the "this week" card. */
|
|
18
|
+
readonly thisWeekPeriodDescription: "usage.thisWeekPeriodDescription";
|
|
19
|
+
/** Title for the "this month" card. */
|
|
20
|
+
readonly thisMonthTitle: "usage.thisMonthTitle";
|
|
21
|
+
/** Period description for the "this month" card. */
|
|
22
|
+
readonly thisMonthPeriodDescription: "usage.thisMonthPeriodDescription";
|
|
23
|
+
/** Aria label when there is no limit. Receives `{ used: string }`. */
|
|
24
|
+
readonly unlimitedProgressAriaLabel: "usage.unlimitedProgressAriaLabel";
|
|
25
|
+
/** Aria label for a progress bar with a finite limit. Receives `{ used: string, total: string, percent: number }`. */
|
|
26
|
+
readonly progressAriaLabel: "usage.progressAriaLabel";
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Maps a `UserLimitStatsResponseDto` into `UsageLimitCardGroup`'s `cards` prop,
|
|
30
|
+
* in Today / This week / This month order. A period is omitted entirely when
|
|
31
|
+
* the response carries no usable stat for it.
|
|
32
|
+
*/
|
|
33
|
+
export declare const mapUsageDataToDashboard: (usage: UserLimitStatsResponseDto | undefined, t: Translate) => UsageLimitCardData[];
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=map-usage-data-to-dashboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-usage-data-to-dashboard.d.ts","sourceRoot":"","sources":["../../src/utils/map-usage-data-to-dashboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,yBAAyB,EAC1B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAG3E,kEAAkE;AAClE,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC;AAsE5E;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;IAC/B,mDAAmD;;IAEnD,gEAAgE;;IAEhE,sCAAsC;;IAEtC,mDAAmD;;IAEnD,uCAAuC;;IAEvC,oDAAoD;;IAEpD,sEAAsE;;IAEtE,sHAAsH;;CAE9G,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAClC,OAAO,yBAAyB,GAAG,SAAS,EAC5C,GAAG,SAAS,KACX,kBAAkB,EA4BpB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { DeploymentItemDto, UserLimitStatsResponseDto } from '@epam/ai-dial-chat-api-client';
|
|
2
|
+
import { ModelLimitPeriodStatuses, ModelLimitRow } from '../models/model-limits-props';
|
|
3
|
+
/** A translate function compatible with i18next's `TFunction`. */
|
|
4
|
+
type Translate = (key: string, options?: Record<string, unknown>) => string;
|
|
5
|
+
/** A callback that resolves an icon URL from a deployment's raw `iconUrl` field. */
|
|
6
|
+
type ResolveIconUrl = (iconUrl: string | undefined) => string | undefined;
|
|
7
|
+
/** A callback that resolves a display name from a localized-text value. */
|
|
8
|
+
type ResolveDisplayName = (name: string | Record<string, string> | undefined | null, locale: string) => string;
|
|
9
|
+
/**
|
|
10
|
+
* i18n key strings that the consuming app's translation bundle must define for
|
|
11
|
+
* `mapUserUsageToModelLimits` and `mapOverallCostLimitsToPeriodStatuses` to produce
|
|
12
|
+
* correctly translated strings. The values are the default key paths used by AI DIAL Chat.
|
|
13
|
+
*/
|
|
14
|
+
export declare const USAGE_MODEL_LIMITS_I18N_KEYS: {
|
|
15
|
+
/** Period label used in tooltip text. Receives no interpolation. */
|
|
16
|
+
readonly todayPeriodDescription: "usage.todayPeriodDescription";
|
|
17
|
+
/** Period label used in tooltip text. Receives no interpolation. */
|
|
18
|
+
readonly thisWeekPeriodDescription: "usage.thisWeekPeriodDescription";
|
|
19
|
+
/** Period label used in tooltip text. Receives no interpolation. */
|
|
20
|
+
readonly thisMonthPeriodDescription: "usage.thisMonthPeriodDescription";
|
|
21
|
+
/** Tooltip when the overall cost limit is running low. Receives `{ period: string }`. */
|
|
22
|
+
readonly overallCostLimitRunningLowTooltip: "usage.overallCostLimitRunningLowTooltip";
|
|
23
|
+
/** Tooltip when the overall cost limit is reached. Receives `{ period: string }`. */
|
|
24
|
+
readonly overallCostLimitReachedTooltip: "usage.overallCostLimitReachedTooltip";
|
|
25
|
+
/** Aria label for a metric cell with no data. */
|
|
26
|
+
readonly unavailableLabel: "usage.unavailableLabel";
|
|
27
|
+
/** Supporting label when a token limit follows the cost limit. */
|
|
28
|
+
readonly followsCostLimitLabel: "usage.followsCostLimitLabel";
|
|
29
|
+
/** Supporting label when there is no per-deployment token limit. */
|
|
30
|
+
readonly noLimitLabel: "usage.noLimitLabel";
|
|
31
|
+
/** Aria label when token usage has no limit but follows the cost limit. Receives `{ used: string }`. */
|
|
32
|
+
readonly followsCostLimitAriaLabel: "usage.followsCostLimitAriaLabel";
|
|
33
|
+
/** Aria label when there is no limit. Receives `{ used: string }`. */
|
|
34
|
+
readonly unlimitedProgressAriaLabel: "usage.unlimitedProgressAriaLabel";
|
|
35
|
+
/** Aria label for a progress bar with a finite limit. Receives `{ used: string, total: string, percent: number }`. */
|
|
36
|
+
readonly progressAriaLabel: "usage.progressAriaLabel";
|
|
37
|
+
/** Label for the spent-cost cell. Receives `{ amount: string }`. */
|
|
38
|
+
readonly spentLabel: "usage.spentLabel";
|
|
39
|
+
};
|
|
40
|
+
/** Maps the same top-level Cost budgets used by the aggregate cards into table-header state. */
|
|
41
|
+
export declare const mapOverallCostLimitsToPeriodStatuses: (usage: UserLimitStatsResponseDto | undefined, activeLocale: string, t: Translate) => ModelLimitPeriodStatuses;
|
|
42
|
+
/**
|
|
43
|
+
* Maps `usage.deployments` into `ModelLimitsSection`'s `rows` prop, joined with model identity
|
|
44
|
+
* from `deploymentItems`. Rows are included only when any displayed period stat has nonzero usage.
|
|
45
|
+
* Order follows `Object.keys(deployments)` — `deploymentItems` is enrichment-only.
|
|
46
|
+
*
|
|
47
|
+
* @param resolveIconUrl - Resolves a deployment's raw `iconUrl` to the URL the avatar should load.
|
|
48
|
+
* @param resolveDisplayName - Resolves a localized-text map or plain string to the display name for `activeLocale`.
|
|
49
|
+
*/
|
|
50
|
+
export declare const mapUserUsageToModelLimits: (usage: UserLimitStatsResponseDto | undefined, deploymentItems: DeploymentItemDto[], activeLocale: string, t: Translate, resolveIconUrl: ResolveIconUrl, resolveDisplayName: ResolveDisplayName) => ModelLimitRow[];
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=map-user-usage-to-model-limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-user-usage-to-model-limits.d.ts","sourceRoot":"","sources":["../../src/utils/map-user-usage-to-model-limits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAGjB,yBAAyB,EAC1B,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EAIV,wBAAwB,EACxB,aAAa,EACd,MAAM,8BAA8B,CAAC;AAMtC,kEAAkE;AAClE,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC;AAE5E,oFAAoF;AACpF,KAAK,cAAc,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,KAAK,MAAM,GAAG,SAAS,CAAC;AAE1E,2EAA2E;AAC3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