@abpjs/ui 0.2.0-next.1 → 0.2.0-next.3
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/CHANGELOG.md +34 -0
- package/dist/ai.d.ts +112 -24
- package/dist/ai.js +227 -112
- package/dist/ai.js.map +1 -1
- package/dist/index.d.ts +36 -4
- package/dist/index.js +1341 -1097
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0-next.3
|
|
4
|
+
|
|
5
|
+
A prerelease under npm's `next` tag. The `ai` area now needs **AbpAi.HttpApi 0.8.0** on the server: stay on next.2
|
|
6
|
+
until the server moves.
|
|
7
|
+
|
|
8
|
+
- Area requests stay the same across host objects: `useAreaRequest`, `useAreaEvents` and `useNames` read the host
|
|
9
|
+
through a ref, so a host built afresh on each render no longer makes every query ask again (a tab switch included).
|
|
10
|
+
- `readAbpError` reads a refusal at the top level (`{ code, message, ... }`, AbpAi's 422s) with the rest as its data,
|
|
11
|
+
instead of showing the status.
|
|
12
|
+
- `AppShell` on a phone: the drawer shows the place's card (name, detail, link) and the sidebar's `top` between the
|
|
13
|
+
site's pages and the place's, as the sidebar does, instead of only the place's name as a heading. The drawer is
|
|
14
|
+
named for screen readers (`labels.navigation`).
|
|
15
|
+
- `StepUpDialog`: its explanation fits any protected action ("This action is protected…"), not only rights and secrets.
|
|
16
|
+
- **ai on AbpAi.HttpApi 0.8.0** (its minimum now): a scope's screen reads the scope's view, so a scope's admin sees
|
|
17
|
+
the models open to it and the aliases and limits from above; the quick call through an alias is the area's own
|
|
18
|
+
(`TryPanel`, `POST try`), so the `ai.try` slot goes; whether the host keeps the connections comes from the server
|
|
19
|
+
(`connectionsKeptByHost`), the host's right only for a server that doesn't say; usage names people as the server
|
|
20
|
+
does, and a call an agent made for someone shows that person first, the agent beside them; the Projects tab asks each
|
|
21
|
+
scope's limits once.
|
|
22
|
+
|
|
23
|
+
## 0.2.0-next.2
|
|
24
|
+
|
|
25
|
+
A prerelease under npm's `next` tag.
|
|
26
|
+
|
|
27
|
+
- `StepUpDialog`: the password again before a sensitive action, plus a code when the person has a second factor (their
|
|
28
|
+
app, a recovery code, or one the site sends), on AbpGuard's `session/step-up` and `me/second-factors`. `AbpProvider`
|
|
29
|
+
draws it when the host gives `paths.guard`. A host with its own dialog sets `stepUpDialog: false`. Its English and
|
|
30
|
+
Arabic texts can be overridden through `AbpHost.texts.stepUp`.
|
|
31
|
+
- `createHostRequest` asks that dialog by default (`requestStepUp`, once however many calls wait). With no dialog, the
|
|
32
|
+
call fails as the server answered. `setStepUpHandler` lets a host register its own.
|
|
33
|
+
- `ai`: a model priced 0 in and 0 out reads as "No price" (AbpAi's prices aren't nullable, and the calls are free
|
|
34
|
+
either way). A new slot, `ai.models.can` `{ connectionId, modelId }`, lets a host that keeps the connections say
|
|
35
|
+
what each model can do. It is temporary, until AbpAi 0.8.0.
|
|
36
|
+
|
|
3
37
|
## 0.2.0-next.1
|
|
4
38
|
|
|
5
39
|
A prerelease under npm's `next` tag: the foundation and the first area, `ai`. More areas (`guard`, `agent`) follow in
|
package/dist/ai.d.ts
CHANGED
|
@@ -16,6 +16,27 @@ declare function aiPages(options: {
|
|
|
16
16
|
visible?: SettingsPage['visible'];
|
|
17
17
|
}): SettingsPage[];
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Whether the host keeps the connections itself (AbpAi's `IAiConnectionSource`), so the screens don't change them: the
|
|
21
|
+
* server's word (`connectionsKeptByHost`, AbpAi.HttpApi 0.8.0, on the site's settings or a scope's view).
|
|
22
|
+
*/
|
|
23
|
+
declare function useHostKeepsConnections(told: boolean | null | undefined, scopeId?: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The site's AI in tabs: the models each connection offers, the site's aliases, what each scope may use and its
|
|
26
|
+
* limits, the site's limits, the usage ledger, a quick call to try an alias, and exports of calls.
|
|
27
|
+
*/
|
|
28
|
+
declare function AiAdmin(): react.JSX.Element;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A scope's AI, for a host's own scope settings page (its header is the host's), from the scope's view (AbpAi.HttpApi
|
|
32
|
+
* 0.8.0, for whoever administers the scope): what the site and the scopes above open to it, its own connections'
|
|
33
|
+
* models while it may have them, its aliases over the ones from above, its limits inside theirs, its usage, and a
|
|
34
|
+
* quick call through an alias.
|
|
35
|
+
*/
|
|
36
|
+
declare function AiScopeScreen({ scopeId }: {
|
|
37
|
+
scopeId: string;
|
|
38
|
+
}): react.JSX.Element;
|
|
39
|
+
|
|
19
40
|
interface components {
|
|
20
41
|
schemas: {
|
|
21
42
|
AiAliasInfo: {
|
|
@@ -69,6 +90,8 @@ interface components {
|
|
|
69
90
|
cost: number | string;
|
|
70
91
|
/** Format: int32 */
|
|
71
92
|
durationMs: null | number | string;
|
|
93
|
+
accountName?: null | string;
|
|
94
|
+
onBehalfOfName?: null | string;
|
|
72
95
|
};
|
|
73
96
|
AiConnectionInfo: {
|
|
74
97
|
/** Format: uuid */
|
|
@@ -209,6 +232,23 @@ interface components {
|
|
|
209
232
|
groupId?: null | string;
|
|
210
233
|
measure?: string;
|
|
211
234
|
};
|
|
235
|
+
AiLimitRef: {
|
|
236
|
+
/** Format: uuid */
|
|
237
|
+
limitId: string;
|
|
238
|
+
kind: string;
|
|
239
|
+
/** Format: uuid */
|
|
240
|
+
scopeId: null | string;
|
|
241
|
+
/** Format: uuid */
|
|
242
|
+
accountId: null | string;
|
|
243
|
+
period: string;
|
|
244
|
+
/** Format: double */
|
|
245
|
+
amount: number | string;
|
|
246
|
+
/** Format: double */
|
|
247
|
+
spent: number | string;
|
|
248
|
+
/** Format: date-time */
|
|
249
|
+
freesAt: string;
|
|
250
|
+
measure?: string;
|
|
251
|
+
};
|
|
212
252
|
AiModelRef: {
|
|
213
253
|
/** Format: uuid */
|
|
214
254
|
connectionId: string;
|
|
@@ -250,6 +290,11 @@ interface components {
|
|
|
250
290
|
count: number | string;
|
|
251
291
|
states?: null | string[];
|
|
252
292
|
};
|
|
293
|
+
AiRefusalAnswer: {
|
|
294
|
+
code: string;
|
|
295
|
+
message: string;
|
|
296
|
+
limit?: null | components["schemas"]["AiLimitRef"];
|
|
297
|
+
};
|
|
253
298
|
AiScopeAccessInfo: {
|
|
254
299
|
/** Format: uuid */
|
|
255
300
|
scopeId: string;
|
|
@@ -264,6 +309,26 @@ interface components {
|
|
|
264
309
|
siteModels: null | components["schemas"]["AiModelRef"][];
|
|
265
310
|
mayConnect: boolean;
|
|
266
311
|
};
|
|
312
|
+
AiScopeModel: {
|
|
313
|
+
/** Format: uuid */
|
|
314
|
+
connectionId: string;
|
|
315
|
+
connection: string;
|
|
316
|
+
/** Format: uuid */
|
|
317
|
+
setOnScopeId: null | string;
|
|
318
|
+
model: string;
|
|
319
|
+
settings: components["schemas"]["AiModelSettings"];
|
|
320
|
+
price: components["schemas"]["AiPrice"];
|
|
321
|
+
own: boolean;
|
|
322
|
+
};
|
|
323
|
+
AiScopeView: {
|
|
324
|
+
/** Format: uuid */
|
|
325
|
+
scopeId: string;
|
|
326
|
+
models: components["schemas"]["AiScopeModel"][];
|
|
327
|
+
aliasesFromAbove: components["schemas"]["AiAliasInfo"][];
|
|
328
|
+
limitsFromAbove: components["schemas"]["AiLimitInfo"][];
|
|
329
|
+
mayConnect: boolean;
|
|
330
|
+
connectionsKeptByHost: boolean;
|
|
331
|
+
};
|
|
267
332
|
AiSiteSettings: {
|
|
268
333
|
scopesMayConnect: boolean;
|
|
269
334
|
keepPrompts: boolean;
|
|
@@ -272,6 +337,32 @@ interface components {
|
|
|
272
337
|
scopeDataClasses: string[];
|
|
273
338
|
dataClasses: string[];
|
|
274
339
|
scopeAccess?: null | string;
|
|
340
|
+
connectionsKeptByHost?: boolean;
|
|
341
|
+
};
|
|
342
|
+
AiTryInput: {
|
|
343
|
+
alias: string;
|
|
344
|
+
prompt: string;
|
|
345
|
+
/** Format: uuid */
|
|
346
|
+
scopeId?: null | string;
|
|
347
|
+
dataClass?: null | string;
|
|
348
|
+
};
|
|
349
|
+
AiTryReply: {
|
|
350
|
+
text: string;
|
|
351
|
+
model: string;
|
|
352
|
+
connection: string;
|
|
353
|
+
usage: components["schemas"]["AiUsage"];
|
|
354
|
+
};
|
|
355
|
+
AiUsage: {
|
|
356
|
+
/** Format: int32 */
|
|
357
|
+
inputTokens: number | string;
|
|
358
|
+
/** Format: int32 */
|
|
359
|
+
outputTokens: number | string;
|
|
360
|
+
/** Format: double */
|
|
361
|
+
cost: number | string;
|
|
362
|
+
/** Format: int32 */
|
|
363
|
+
cacheWriteTokens?: number | string;
|
|
364
|
+
/** Format: int32 */
|
|
365
|
+
cacheReadTokens?: number | string;
|
|
275
366
|
};
|
|
276
367
|
AiUsageQuery: {
|
|
277
368
|
/** Format: date-time */
|
|
@@ -338,30 +429,13 @@ type AiUsageReport = Schemas['AiUsageReport'];
|
|
|
338
429
|
type AiUsageRow = Schemas['AiUsageRow'];
|
|
339
430
|
type AiCall = Schemas['AiCallRow'];
|
|
340
431
|
type AiExport = Schemas['AiExportInfo'];
|
|
432
|
+
type AiScopeView = Schemas['AiScopeView'];
|
|
433
|
+
type AiScopeModel = Schemas['AiScopeModel'];
|
|
434
|
+
type AiTryInput = Schemas['AiTryInput'];
|
|
435
|
+
type AiTryReply = Schemas['AiTryReply'];
|
|
341
436
|
/** A number the API may give as a string (its decimals and 64-bit counts). */
|
|
342
437
|
declare const num: (value: number | string | null | undefined) => number;
|
|
343
438
|
|
|
344
|
-
/**
|
|
345
|
-
* Whether the host keeps the connections itself (AbpAi's `IAiConnectionSource`), so the screens don't change them:
|
|
346
|
-
* the site's own word when the server gives it, else the host's `ai.connections.edit` right (AbpAi.HttpApi 0.7.0
|
|
347
|
-
* doesn't say).
|
|
348
|
-
*/
|
|
349
|
-
declare function useHostKeepsConnections(site: AiSite | undefined, scopeId?: string): boolean;
|
|
350
|
-
/**
|
|
351
|
-
* The site's AI in tabs: the models each connection offers, the site's aliases, what each scope may use and its
|
|
352
|
-
* limits, the site's limits, the usage ledger, a quick call to try an alias (the host's `ai.try`), and exports of calls.
|
|
353
|
-
*/
|
|
354
|
-
declare function AiAdmin(): react.JSX.Element;
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* A scope's AI, for a host's own scope settings page (its header is the host's): what the site opens to it, its own
|
|
358
|
-
* connections' models while it may have them, its aliases, its limits inside the site's, its usage, and a quick call
|
|
359
|
-
* through an alias (the host's `ai.try`). The site's models and limits show where the person may read the site's.
|
|
360
|
-
*/
|
|
361
|
-
declare function AiScopeScreen({ scopeId }: {
|
|
362
|
-
scopeId: string;
|
|
363
|
-
}): react.JSX.Element;
|
|
364
|
-
|
|
365
439
|
/** One model of one connection, as the screens show it: its settings with AbpAi's defaults filled in. */
|
|
366
440
|
interface AiModelRow {
|
|
367
441
|
/** `connectionId:model`: what an alias target and a scope's opened models are keyed by. */
|
|
@@ -376,14 +450,18 @@ interface AiModelRow {
|
|
|
376
450
|
images: boolean;
|
|
377
451
|
structuredOutput: boolean;
|
|
378
452
|
contextTokens: number | null;
|
|
379
|
-
/** Per million tokens; null when
|
|
453
|
+
/** Per million tokens; null when the model costs nothing in and nothing out. */
|
|
380
454
|
inputPrice: number | null;
|
|
381
455
|
outputPrice: number | null;
|
|
382
456
|
priceSetAt: string | null;
|
|
457
|
+
/** From a scope's view: the scope's own connection's model (true), or one the site or a scope above opens to it. */
|
|
458
|
+
own?: boolean;
|
|
383
459
|
}
|
|
384
460
|
declare const modelKey: (connectionId: string, model: string | null | undefined) => string;
|
|
385
461
|
/** Every model of the connections, in their order. A model with no settings is on and takes tools (AbpAi's defaults). */
|
|
386
462
|
declare function modelRows(connections: readonly AiConnection[]): AiModelRow[];
|
|
463
|
+
/** The models a scope may use, as its view gives them (AbpAi.HttpApi 0.8.0): the ones opened to it, then its own. */
|
|
464
|
+
declare function scopeModelRows(view: AiScopeView): AiModelRow[];
|
|
387
465
|
/**
|
|
388
466
|
* The connection as an update with one model's settings and price changed. Everything else goes back as it is; its key
|
|
389
467
|
* isn't sent, so the server keeps it.
|
|
@@ -458,7 +536,8 @@ declare function LimitsEditor({ limits, onSave, onChange, busy, error }: {
|
|
|
458
536
|
/**
|
|
459
537
|
* Models: each connection's, found by asking it, off until enabled, with what they can do and their prices per million
|
|
460
538
|
* tokens. Where the host keeps the connections itself (`hostKeeps`), the screen doesn't change them: each row shows the
|
|
461
|
-
* host's `ai.models.edit` and the panel its `ai.models.actions
|
|
539
|
+
* host's `ai.models.edit` and the panel its `ai.models.actions`; and what each model can do is the host's to say when
|
|
540
|
+
* it fills `ai.models.can` (its own record of it, where the gateway is told every model takes everything).
|
|
462
541
|
*/
|
|
463
542
|
declare function ModelsPanel({ scopeId, connections, rows, loading, hostKeeps, onChanged, title, description }: {
|
|
464
543
|
scopeId?: string;
|
|
@@ -487,7 +566,16 @@ declare function UsagePanel({ scopeId, by: byOptions }: {
|
|
|
487
566
|
by: UsageBy[];
|
|
488
567
|
}): react.JSX.Element;
|
|
489
568
|
|
|
569
|
+
/**
|
|
570
|
+
* A quick call through an alias, as the person: through the same access, limits and data rules as any call, and on
|
|
571
|
+
* the ledger (AbpAi.HttpApi 0.8.0's `try`, for those who administer the site or the scope).
|
|
572
|
+
*/
|
|
573
|
+
declare function TryPanel({ scopeId, aliases }: {
|
|
574
|
+
scopeId?: string;
|
|
575
|
+
aliases: string[];
|
|
576
|
+
}): react.JSX.Element;
|
|
577
|
+
|
|
490
578
|
/** The area's words, in English and Arabic; a host overrides any key through `AbpHost.texts.ai`. */
|
|
491
579
|
declare const useAiTexts: () => (key: string, values?: Record<string, string | number>) => string;
|
|
492
580
|
|
|
493
|
-
export { AccessPanel, AiAdmin, AiAdminPage, type AiAlias, type AiAliasTarget, type AiCall, type AiConnection, type AiConnectionInput, type AiExport, type AiLimit, type AiLimitInput, type AiModelRow, type AiModelSettings, type AiScopeAccess, type AiScopeAccessInput, AiScopeScreen, type AiSite, type AiTypes, type AiUsageReport, type AiUsageRow, AliasesPanel, ExportsPanel, LIMIT_KINDS, LIMIT_PERIODS, type LimitRow, LimitsEditor, ModelsPanel, USAGE_BY, type UsageBy, UsagePanel, aiPages, editableLimit, limitRow, modelKey, modelRows, num, saveLimits, useAiTexts, useHostKeepsConnections, useLimitText, withModel };
|
|
581
|
+
export { AccessPanel, AiAdmin, AiAdminPage, type AiAlias, type AiAliasTarget, type AiCall, type AiConnection, type AiConnectionInput, type AiExport, type AiLimit, type AiLimitInput, type AiModelRow, type AiModelSettings, type AiScopeAccess, type AiScopeAccessInput, type AiScopeModel, AiScopeScreen, type AiScopeView, type AiSite, type AiTryInput, type AiTryReply, type AiTypes, type AiUsageReport, type AiUsageRow, AliasesPanel, ExportsPanel, LIMIT_KINDS, LIMIT_PERIODS, type LimitRow, LimitsEditor, ModelsPanel, TryPanel, USAGE_BY, type UsageBy, UsagePanel, aiPages, editableLimit, limitRow, modelKey, modelRows, num, saveLimits, scopeModelRows, useAiTexts, useHostKeepsConnections, useLimitText, withModel };
|