@celljs/ta-web 4.15.2 → 4.16.0
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/esm/browser/components/app-view.js +7 -1
- package/esm/browser/components/chat-list.d.ts +3 -1
- package/esm/browser/components/chat-list.js +9 -4
- package/esm/browser/components/chat-seen.d.ts +7 -0
- package/esm/browser/components/chat-seen.js +57 -10
- package/esm/browser/components/environment-view.js +50 -1
- package/esm/browser/components/folder-picker.js +3 -3
- package/esm/browser/components/host-tag.js +2 -2
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/remote-hosts.js +66 -5
- package/esm/browser/extension/icons.js +23 -4
- package/esm/browser/gateway/console-parts.d.ts +3 -1
- package/esm/browser/gateway/console-parts.js +11 -4
- package/esm/browser/gateway/console-tenant.js +1 -1
- package/esm/browser/gateway/console-util.js +2 -2
- package/esm/browser/gateway/console-view.js +10 -2
- package/esm/browser/i18n/locales.d.ts +30 -3
- package/esm/browser/i18n/messages-ja.js +27 -0
- package/esm/browser/i18n/messages-zh-tw.js +27 -0
- package/esm/browser/i18n/messages.d.ts +27 -0
- package/esm/browser/i18n/messages.js +54 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +1 -0
- package/lib/browser/components/app-view.js +7 -1
- package/lib/browser/components/chat-list.d.ts +3 -1
- package/lib/browser/components/chat-list.js +9 -4
- package/lib/browser/components/chat-seen.d.ts +7 -0
- package/lib/browser/components/chat-seen.js +57 -10
- package/lib/browser/components/environment-view.js +49 -0
- package/lib/browser/components/folder-picker.js +2 -2
- package/lib/browser/components/host-tag.js +1 -1
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/remote-hosts.js +65 -4
- package/lib/browser/extension/icons.js +22 -3
- package/lib/browser/gateway/console-parts.d.ts +3 -1
- package/lib/browser/gateway/console-parts.js +11 -4
- package/lib/browser/gateway/console-tenant.js +1 -1
- package/lib/browser/gateway/console-util.js +2 -2
- package/lib/browser/gateway/console-view.js +9 -1
- package/lib/browser/i18n/locales.d.ts +30 -3
- package/lib/browser/i18n/messages-ja.js +27 -0
- package/lib/browser/i18n/messages-zh-tw.js +27 -0
- package/lib/browser/i18n/messages.d.ts +27 -0
- package/lib/browser/i18n/messages.js +54 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +1 -0
- package/package.json +7 -7
|
@@ -49,7 +49,7 @@ export declare function TrendCard({ tenantId, tenants, onTenant }: {
|
|
|
49
49
|
* Limits to change: the gateway's defaults (`nullable` false: a limit is a number or none), or an account's over them
|
|
50
50
|
* (each the default's, none, or its own). Saved as a whole.
|
|
51
51
|
*/
|
|
52
|
-
export declare function LimitsForm({ value, defaults, providers, nullable, readOnly, onSave, }: {
|
|
52
|
+
export declare function LimitsForm({ value, defaults, providers, nullable, readOnly, metered, onSave, }: {
|
|
53
53
|
value: TaGatewayLimits;
|
|
54
54
|
defaults?: TaGatewayLimits;
|
|
55
55
|
providers: {
|
|
@@ -58,6 +58,8 @@ export declare function LimitsForm({ value, defaults, providers, nullable, readO
|
|
|
58
58
|
}[];
|
|
59
59
|
nullable: boolean;
|
|
60
60
|
readOnly?: boolean;
|
|
61
|
+
/** Whether the gateway gives models, so that a limit of tokens holds. */
|
|
62
|
+
metered?: boolean;
|
|
61
63
|
onSave(limits: TaGatewayLimits): Promise<unknown>;
|
|
62
64
|
}): React.JSX.Element;
|
|
63
65
|
//# sourceMappingURL=console-parts.d.ts.map
|
|
@@ -108,7 +108,13 @@ function QuotaMeters({ quota }) {
|
|
|
108
108
|
: `${console_util_1.ConsoleUtil.minutes(minutes.used)} / ${console_util_1.ConsoleUtil.minutes(allowed)}`, share: allowed === undefined ? undefined : console_util_1.ConsoleUtil.share(minutes.used, allowed), hint: [minutes.bonus > 0 ? t('ta.console.bonus', { minutes: minutes.bonus }) : '', t('ta.console.resets', { date: resets })]
|
|
109
109
|
.filter(Boolean)
|
|
110
110
|
.join(' · ') }),
|
|
111
|
-
React.createElement(Meter, { label: t('ta.console.monthTokens'), value: [
|
|
111
|
+
React.createElement(Meter, { label: t('ta.console.monthTokens'), value: [
|
|
112
|
+
tokens.limit === undefined ? console_util_1.ConsoleUtil.count(tokens.used) : `${console_util_1.ConsoleUtil.count(tokens.used)} / ${console_util_1.ConsoleUtil.count(tokens.limit)}`,
|
|
113
|
+
console_util_1.ConsoleUtil.cost(tokens.cost),
|
|
114
|
+
]
|
|
115
|
+
.filter(Boolean)
|
|
116
|
+
.join(' · '), share: tokens.limit === undefined ? undefined : console_util_1.ConsoleUtil.share(tokens.used, tokens.limit), hint: [
|
|
117
|
+
t(tokens.metered ? 'ta.console.tokensMetered' : 'ta.console.tokensReported'),
|
|
112
118
|
quota.promptsPerMinute !== undefined ? t('ta.console.promptsLimit', { count: quota.promptsPerMinute }) : '',
|
|
113
119
|
quota.connections !== undefined ? t('ta.console.connectionsLimit', { count: quota.connections }) : '',
|
|
114
120
|
]
|
|
@@ -259,17 +265,18 @@ function NumberLimit({ label, hint, value, base, nullable, readOnly, onChange, }
|
|
|
259
265
|
* Limits to change: the gateway's defaults (`nullable` false: a limit is a number or none), or an account's over them
|
|
260
266
|
* (each the default's, none, or its own). Saved as a whole.
|
|
261
267
|
*/
|
|
262
|
-
function LimitsForm({ value, defaults, providers, nullable, readOnly, onSave, }) {
|
|
268
|
+
function LimitsForm({ value, defaults, providers, nullable, readOnly, metered, onSave, }) {
|
|
263
269
|
const t = (0, use_t_1.useT)();
|
|
264
270
|
const [draft, setDraft] = React.useState(value);
|
|
265
271
|
const [busy, setBusy] = React.useState(false);
|
|
266
272
|
React.useEffect(() => setDraft(value), [value]);
|
|
267
273
|
const changed = JSON.stringify(draft) !== JSON.stringify(value);
|
|
268
274
|
const set = (change) => setDraft(current => Object.fromEntries(Object.entries({ ...current, ...change }).filter(([, item]) => item !== undefined)));
|
|
269
|
-
const base = (key) =>
|
|
275
|
+
const base = (key) => typeof (defaults === null || defaults === void 0 ? void 0 : defaults[key]) === 'number' ? String(defaults[key]) : undefined;
|
|
270
276
|
const providersMode = draft.providers === null ? 'none' : draft.providers === undefined ? (nullable ? 'inherit' : 'none') : 'set';
|
|
271
277
|
return (React.createElement("div", { className: "ta-console-card ta-console-limits" },
|
|
272
278
|
React.createElement(NumberLimit, { label: t('ta.console.freeMinutes'), hint: t('ta.console.freeMinutesHint'), value: draft.freeMinutes, base: base('freeMinutes'), nullable: nullable, readOnly: readOnly, onChange: freeMinutes => set({ freeMinutes }) }),
|
|
279
|
+
React.createElement(NumberLimit, { label: t('ta.console.monthlyTokens'), hint: t(metered ? 'ta.console.monthlyTokensHint' : 'ta.console.monthlyTokensOff'), value: draft.monthlyTokens, base: base('monthlyTokens'), nullable: nullable, readOnly: readOnly, onChange: monthlyTokens => set({ monthlyTokens }) }),
|
|
273
280
|
React.createElement(NumberLimit, { label: t('ta.console.promptsPerMinute'), hint: t('ta.console.promptsPerMinuteHint'), value: draft.promptsPerMinute, base: base('promptsPerMinute'), nullable: nullable, readOnly: readOnly, onChange: promptsPerMinute => set({ promptsPerMinute }) }),
|
|
274
281
|
React.createElement(NumberLimit, { label: t('ta.console.connectionsMax'), hint: t('ta.console.connectionsMaxHint'), value: draft.connections, base: base('connections'), nullable: nullable, readOnly: readOnly, onChange: connections => set({ connections }) }),
|
|
275
282
|
React.createElement("div", { className: "ta-console-limit" },
|
|
@@ -307,7 +314,7 @@ function LimitsForm({ value, defaults, providers, nullable, readOnly, onSave, })
|
|
|
307
314
|
React.createElement("button", { type: "button", className: "ta-button", disabled: !changed || busy, onClick: () => setDraft(value) }, t('ta.console.reset')),
|
|
308
315
|
React.createElement("button", { type: "button", className: "ta-button ta-primary", disabled: !changed ||
|
|
309
316
|
busy ||
|
|
310
|
-
[draft.freeMinutes, draft.promptsPerMinute, draft.connections].some(item => typeof item === 'number' && Number.isNaN(item)), onClick: () => {
|
|
317
|
+
[draft.freeMinutes, draft.monthlyTokens, draft.promptsPerMinute, draft.connections].some(item => typeof item === 'number' && Number.isNaN(item)), onClick: () => {
|
|
311
318
|
setBusy(true);
|
|
312
319
|
void onSave(draft).finally(() => setBusy(false));
|
|
313
320
|
} }, busy ? React.createElement("span", { className: "ta-spinner" }) : t('ta.console.save'))))));
|
|
@@ -291,7 +291,7 @@ function TenantDetail({ tenant, info, onChanged }) {
|
|
|
291
291
|
t('ta.console.grant')),
|
|
292
292
|
React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => setEditing(!editing) }, t(editing ? 'ta.console.limitsDone' : 'ta.console.limitsEdit')))) : undefined }, t('ta.console.quota')),
|
|
293
293
|
React.createElement(console_parts_1.QuotaMeters, { quota: tenant.quota }),
|
|
294
|
-
editing && manage && (React.createElement(console_parts_1.LimitsForm, { value: (_a = tenant.limits) !== null && _a !== void 0 ? _a : {}, defaults: info.policy.defaults, providers: info.providers, nullable: true, onSave: limits => bench.gateway
|
|
294
|
+
editing && manage && (React.createElement(console_parts_1.LimitsForm, { value: (_a = tenant.limits) !== null && _a !== void 0 ? _a : {}, defaults: info.policy.defaults, providers: info.providers, nullable: true, metered: info.models.length > 0, onSave: limits => bench.gateway
|
|
295
295
|
.setTenantLimits(tenant.id, Object.keys(limits).length ? limits : null)
|
|
296
296
|
.then(() => notices.notify(t('ta.console.saved'), { level: 'success' }))
|
|
297
297
|
.then(onChanged)
|
|
@@ -33,14 +33,14 @@ var ConsoleUtil;
|
|
|
33
33
|
ConsoleUtil.matches = matches;
|
|
34
34
|
function filter(tenant, by) {
|
|
35
35
|
var _a;
|
|
36
|
-
var _b, _c;
|
|
36
|
+
var _b, _c, _d;
|
|
37
37
|
switch (by) {
|
|
38
38
|
case 'running':
|
|
39
39
|
return tenant.environment.status === 'running';
|
|
40
40
|
case 'working':
|
|
41
41
|
return ((_b = (_a = tenant.agents) === null || _a === void 0 ? void 0 : _a.working) !== null && _b !== void 0 ? _b : 0) > 0;
|
|
42
42
|
case 'limited':
|
|
43
|
-
return !!tenant.quota.blocked || ((_c = minutesShare(tenant.quota)) !== null && _c !== void 0 ? _c : 0) >= 80;
|
|
43
|
+
return (!!tenant.quota.blocked || ((_c = minutesShare(tenant.quota)) !== null && _c !== void 0 ? _c : 0) >= 80 || ((_d = share(tenant.quota.tokens.used, tenant.quota.tokens.limit)) !== null && _d !== void 0 ? _d : 0) >= 80);
|
|
44
44
|
case 'admins':
|
|
45
45
|
return tenant.role !== 'member';
|
|
46
46
|
default:
|
|
@@ -189,11 +189,19 @@ function Policy({ info, onChanged }) {
|
|
|
189
189
|
return (React.createElement(React.Fragment, null,
|
|
190
190
|
React.createElement(console_parts_1.SectionTitle, null, t('ta.console.defaults')),
|
|
191
191
|
React.createElement("p", { className: "ta-list-hint" }, t(owner ? 'ta.console.defaultsHint' : 'ta.console.defaultsReadOnly')),
|
|
192
|
-
React.createElement(console_parts_1.LimitsForm, { value: info.policy.defaults, providers: info.providers, nullable: false, readOnly: !owner, onSave: limits => bench.gateway
|
|
192
|
+
React.createElement(console_parts_1.LimitsForm, { value: info.policy.defaults, providers: info.providers, nullable: false, readOnly: !owner, metered: info.models.length > 0, onSave: limits => bench.gateway
|
|
193
193
|
.setDefaultLimits(limits)
|
|
194
194
|
.then(() => notices.notify(t('ta.console.saved'), { level: 'success' }))
|
|
195
195
|
.then(onChanged)
|
|
196
196
|
.catch(error => notices.error(error)) }),
|
|
197
|
+
React.createElement(console_parts_1.SectionTitle, null, t('ta.console.models')),
|
|
198
|
+
info.models.length === 0 ? (React.createElement("p", { className: "ta-list-hint" }, t('ta.console.modelsNone'))) : (React.createElement(React.Fragment, null,
|
|
199
|
+
React.createElement(list_rows_1.ListGroup, null, info.models.map(provider => (React.createElement("div", { key: provider.id, className: "ta-console-provider" },
|
|
200
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.Bot, size: 18, className: "ta-list-icon" }),
|
|
201
|
+
React.createElement("span", { className: "ta-console-tenant-text" },
|
|
202
|
+
React.createElement("span", { className: "ta-console-tenant-name ta-ellipsis" }, provider.name || provider.id),
|
|
203
|
+
React.createElement("span", { className: "ta-console-tenant-state" }, t('ta.console.modelsOf', { api: provider.api, count: provider.models }))))))),
|
|
204
|
+
React.createElement("p", { className: "ta-list-hint" }, t('ta.console.modelsHint')))),
|
|
197
205
|
React.createElement(console_parts_1.SectionTitle, null, t('ta.console.managers')),
|
|
198
206
|
React.createElement("div", { className: "ta-list-group" }, info.policy.admins.map(admin => (React.createElement("div", { key: admin.account, className: "ta-console-audit" },
|
|
199
207
|
React.createElement("span", { className: "ta-console-audit-text ta-ellipsis" },
|