@abpjs/ui 0.2.0-next.2 → 0.2.0-next.4

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 CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0-next.4
4
+
5
+ A prerelease under npm's `next` tag, for a host's scope page on the `ai` area.
6
+
7
+ - ai: `ai.models.can`'s context names the scope too (`scopeId`), so a host that keeps the connections reads that
8
+ scope's own record of what its models can do on a scope's screen.
9
+ - ai: `AiScopeScreen` takes the host's page `header`, drawn first in its own column, so a host's page keeps one column.
10
+
11
+ ## 0.2.0-next.3
12
+
13
+ A prerelease under npm's `next` tag. The `ai` area now needs **AbpAi.HttpApi 0.8.0** on the server: stay on next.2
14
+ until the server moves.
15
+
16
+ - Area requests stay the same across host objects: `useAreaRequest`, `useAreaEvents` and `useNames` read the host
17
+ through a ref, so a host built afresh on each render no longer makes every query ask again (a tab switch included).
18
+ - `readAbpError` reads a refusal at the top level (`{ code, message, ... }`, AbpAi's 422s) with the rest as its data,
19
+ instead of showing the status.
20
+ - `AppShell` on a phone: the drawer shows the place's card (name, detail, link) and the sidebar's `top` between the
21
+ site's pages and the place's, as the sidebar does, instead of only the place's name as a heading. The drawer is
22
+ named for screen readers (`labels.navigation`).
23
+ - `StepUpDialog`: its explanation fits any protected action ("This action is protected…"), not only rights and secrets.
24
+ - **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
25
+ the models open to it and the aliases and limits from above; the quick call through an alias is the area's own
26
+ (`TryPanel`, `POST try`), so the `ai.try` slot goes; whether the host keeps the connections comes from the server
27
+ (`connectionsKeptByHost`), the host's right only for a server that doesn't say; usage names people as the server
28
+ does, and a call an agent made for someone shows that person first, the agent beside them; the Projects tab asks each
29
+ scope's limits once.
30
+
3
31
  ## 0.2.0-next.2
4
32
 
5
33
  A prerelease under npm's `next` tag.
package/dist/ai.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as react from 'react';
2
+ import { ReactNode } from 'react';
2
3
  import { SettingsPage, HostRequest } from '@abpjs/ui';
3
4
 
4
5
  /** The site's AI page, with its header: what a host's catch-all route draws for `ai.admin`. */
@@ -16,6 +17,29 @@ declare function aiPages(options: {
16
17
  visible?: SettingsPage['visible'];
17
18
  }): SettingsPage[];
18
19
 
20
+ /**
21
+ * Whether the host keeps the connections itself (AbpAi's `IAiConnectionSource`), so the screens don't change them: the
22
+ * server's word (`connectionsKeptByHost`, AbpAi.HttpApi 0.8.0, on the site's settings or a scope's view).
23
+ */
24
+ declare function useHostKeepsConnections(told: boolean | null | undefined, scopeId?: string): boolean;
25
+ /**
26
+ * The site's AI in tabs: the models each connection offers, the site's aliases, what each scope may use and its
27
+ * limits, the site's limits, the usage ledger, a quick call to try an alias, and exports of calls.
28
+ */
29
+ declare function AiAdmin(): react.JSX.Element;
30
+
31
+ /**
32
+ * 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
33
+ * 0.8.0, for whoever administers the scope): what the site and the scopes above open to it, its own connections'
34
+ * models while it may have them, its aliases over the ones from above, its limits inside theirs, its usage, and a
35
+ * quick call through an alias. `header` is the host's page header, drawn first in the screen's own column (and with
36
+ * the error when there's one), so the page reads as one column.
37
+ */
38
+ declare function AiScopeScreen({ scopeId, header }: {
39
+ scopeId: string;
40
+ header?: ReactNode;
41
+ }): react.JSX.Element;
42
+
19
43
  interface components {
20
44
  schemas: {
21
45
  AiAliasInfo: {
@@ -69,6 +93,8 @@ interface components {
69
93
  cost: number | string;
70
94
  /** Format: int32 */
71
95
  durationMs: null | number | string;
96
+ accountName?: null | string;
97
+ onBehalfOfName?: null | string;
72
98
  };
73
99
  AiConnectionInfo: {
74
100
  /** Format: uuid */
@@ -209,6 +235,23 @@ interface components {
209
235
  groupId?: null | string;
210
236
  measure?: string;
211
237
  };
238
+ AiLimitRef: {
239
+ /** Format: uuid */
240
+ limitId: string;
241
+ kind: string;
242
+ /** Format: uuid */
243
+ scopeId: null | string;
244
+ /** Format: uuid */
245
+ accountId: null | string;
246
+ period: string;
247
+ /** Format: double */
248
+ amount: number | string;
249
+ /** Format: double */
250
+ spent: number | string;
251
+ /** Format: date-time */
252
+ freesAt: string;
253
+ measure?: string;
254
+ };
212
255
  AiModelRef: {
213
256
  /** Format: uuid */
214
257
  connectionId: string;
@@ -250,6 +293,11 @@ interface components {
250
293
  count: number | string;
251
294
  states?: null | string[];
252
295
  };
296
+ AiRefusalAnswer: {
297
+ code: string;
298
+ message: string;
299
+ limit?: null | components["schemas"]["AiLimitRef"];
300
+ };
253
301
  AiScopeAccessInfo: {
254
302
  /** Format: uuid */
255
303
  scopeId: string;
@@ -264,6 +312,26 @@ interface components {
264
312
  siteModels: null | components["schemas"]["AiModelRef"][];
265
313
  mayConnect: boolean;
266
314
  };
315
+ AiScopeModel: {
316
+ /** Format: uuid */
317
+ connectionId: string;
318
+ connection: string;
319
+ /** Format: uuid */
320
+ setOnScopeId: null | string;
321
+ model: string;
322
+ settings: components["schemas"]["AiModelSettings"];
323
+ price: components["schemas"]["AiPrice"];
324
+ own: boolean;
325
+ };
326
+ AiScopeView: {
327
+ /** Format: uuid */
328
+ scopeId: string;
329
+ models: components["schemas"]["AiScopeModel"][];
330
+ aliasesFromAbove: components["schemas"]["AiAliasInfo"][];
331
+ limitsFromAbove: components["schemas"]["AiLimitInfo"][];
332
+ mayConnect: boolean;
333
+ connectionsKeptByHost: boolean;
334
+ };
267
335
  AiSiteSettings: {
268
336
  scopesMayConnect: boolean;
269
337
  keepPrompts: boolean;
@@ -272,6 +340,32 @@ interface components {
272
340
  scopeDataClasses: string[];
273
341
  dataClasses: string[];
274
342
  scopeAccess?: null | string;
343
+ connectionsKeptByHost?: boolean;
344
+ };
345
+ AiTryInput: {
346
+ alias: string;
347
+ prompt: string;
348
+ /** Format: uuid */
349
+ scopeId?: null | string;
350
+ dataClass?: null | string;
351
+ };
352
+ AiTryReply: {
353
+ text: string;
354
+ model: string;
355
+ connection: string;
356
+ usage: components["schemas"]["AiUsage"];
357
+ };
358
+ AiUsage: {
359
+ /** Format: int32 */
360
+ inputTokens: number | string;
361
+ /** Format: int32 */
362
+ outputTokens: number | string;
363
+ /** Format: double */
364
+ cost: number | string;
365
+ /** Format: int32 */
366
+ cacheWriteTokens?: number | string;
367
+ /** Format: int32 */
368
+ cacheReadTokens?: number | string;
275
369
  };
276
370
  AiUsageQuery: {
277
371
  /** Format: date-time */
@@ -338,30 +432,13 @@ type AiUsageReport = Schemas['AiUsageReport'];
338
432
  type AiUsageRow = Schemas['AiUsageRow'];
339
433
  type AiCall = Schemas['AiCallRow'];
340
434
  type AiExport = Schemas['AiExportInfo'];
435
+ type AiScopeView = Schemas['AiScopeView'];
436
+ type AiScopeModel = Schemas['AiScopeModel'];
437
+ type AiTryInput = Schemas['AiTryInput'];
438
+ type AiTryReply = Schemas['AiTryReply'];
341
439
  /** A number the API may give as a string (its decimals and 64-bit counts). */
342
440
  declare const num: (value: number | string | null | undefined) => number;
343
441
 
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
442
  /** One model of one connection, as the screens show it: its settings with AbpAi's defaults filled in. */
366
443
  interface AiModelRow {
367
444
  /** `connectionId:model`: what an alias target and a scope's opened models are keyed by. */
@@ -380,10 +457,14 @@ interface AiModelRow {
380
457
  inputPrice: number | null;
381
458
  outputPrice: number | null;
382
459
  priceSetAt: string | null;
460
+ /** From a scope's view: the scope's own connection's model (true), or one the site or a scope above opens to it. */
461
+ own?: boolean;
383
462
  }
384
463
  declare const modelKey: (connectionId: string, model: string | null | undefined) => string;
385
464
  /** Every model of the connections, in their order. A model with no settings is on and takes tools (AbpAi's defaults). */
386
465
  declare function modelRows(connections: readonly AiConnection[]): AiModelRow[];
466
+ /** The models a scope may use, as its view gives them (AbpAi.HttpApi 0.8.0): the ones opened to it, then its own. */
467
+ declare function scopeModelRows(view: AiScopeView): AiModelRow[];
387
468
  /**
388
469
  * The connection as an update with one model's settings and price changed. Everything else goes back as it is; its key
389
470
  * isn't sent, so the server keeps it.
@@ -488,7 +569,16 @@ declare function UsagePanel({ scopeId, by: byOptions }: {
488
569
  by: UsageBy[];
489
570
  }): react.JSX.Element;
490
571
 
572
+ /**
573
+ * A quick call through an alias, as the person: through the same access, limits and data rules as any call, and on
574
+ * the ledger (AbpAi.HttpApi 0.8.0's `try`, for those who administer the site or the scope).
575
+ */
576
+ declare function TryPanel({ scopeId, aliases }: {
577
+ scopeId?: string;
578
+ aliases: string[];
579
+ }): react.JSX.Element;
580
+
491
581
  /** The area's words, in English and Arabic; a host overrides any key through `AbpHost.texts.ai`. */
492
582
  declare const useAiTexts: () => (key: string, values?: Record<string, string | number>) => string;
493
583
 
494
- 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 };
584
+ 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 };