@abpjs/ui 0.1.0 → 0.2.0-next.2
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 +37 -0
- package/dist/ai.d.ts +494 -0
- package/dist/ai.js +1305 -0
- package/dist/ai.js.map +1 -0
- package/dist/index.d.ts +284 -3
- package/dist/index.js +1719 -1005
- package/dist/index.js.map +1 -1
- package/dist/rules.js.map +1 -1
- package/package.json +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0-next.2
|
|
4
|
+
|
|
5
|
+
A prerelease under npm's `next` tag.
|
|
6
|
+
|
|
7
|
+
- `StepUpDialog`: the password again before a sensitive action, plus a code when the person has a second factor (their
|
|
8
|
+
app, a recovery code, or one the site sends), on AbpGuard's `session/step-up` and `me/second-factors`. `AbpProvider`
|
|
9
|
+
draws it when the host gives `paths.guard`. A host with its own dialog sets `stepUpDialog: false`. Its English and
|
|
10
|
+
Arabic texts can be overridden through `AbpHost.texts.stepUp`.
|
|
11
|
+
- `createHostRequest` asks that dialog by default (`requestStepUp`, once however many calls wait). With no dialog, the
|
|
12
|
+
call fails as the server answered. `setStepUpHandler` lets a host register its own.
|
|
13
|
+
- `ai`: a model priced 0 in and 0 out reads as "No price" (AbpAi's prices aren't nullable, and the calls are free
|
|
14
|
+
either way). A new slot, `ai.models.can` `{ connectionId, modelId }`, lets a host that keeps the connections say
|
|
15
|
+
what each model can do. It is temporary, until AbpAi 0.8.0.
|
|
16
|
+
|
|
17
|
+
## 0.2.0-next.1
|
|
18
|
+
|
|
19
|
+
A prerelease under npm's `next` tag: the foundation and the first area, `ai`. More areas (`guard`, `agent`) follow in
|
|
20
|
+
later prereleases before 0.2.0.
|
|
21
|
+
|
|
22
|
+
The foundation for the screens (ADR 0109's amendment in the application it came from): areas under `src/areas`, each
|
|
23
|
+
its own entry, moving to its own package later by import path alone.
|
|
24
|
+
|
|
25
|
+
- The host contract: `AbpProvider`'s `host` (`AbpHost`): the host's `request`, a base path per package, `navigate`,
|
|
26
|
+
`can(right, scopeId?)`, scopes, people's names, languages, text overrides and slots. `createHostRequest` for a host
|
|
27
|
+
without its own (anti-forgery cookie and header, a 401 handed back, one retry after a step-up, files with their names).
|
|
28
|
+
- `useApiQuery`, `useApiAction`, `useApiDownload`, `useAreaRequest`, `useCan`, `useNavigate`, `useNames`,
|
|
29
|
+
`useHostLanguages`, `HostSlot`; `AbpApiError` reads ABP's error shape.
|
|
30
|
+
- `createHostEvents` and `useAreaEvents`: server-sent events resumed from the last id, a refusal thrown before the
|
|
31
|
+
stream; optional, so a host without it gets screens that ask again. `me` and `useMe` for the person signed in.
|
|
32
|
+
- `createAreaTexts` and `formatMessage`: an area's English and Arabic texts with plurals and choices, overridable by
|
|
33
|
+
the host.
|
|
34
|
+
- `FormDialog`, with the labels `formRequired` and `formFix`.
|
|
35
|
+
- `tests/areas-boundary.test.mjs` keeps each area to its boundary; prereleases publish under npm's `next` tag.
|
|
36
|
+
- **`@abpjs/ui/ai`**, AbpAi's screens on AbpAi.HttpApi 0.7.0 (`src/areas/ai`): the site's AI page in tabs (models,
|
|
37
|
+
aliases, each scope's access, limits, usage, exports) as `aiPages` and `AiAdmin`, a scope's AI as `AiScopeScreen`,
|
|
38
|
+
and their panels. Types from AbpAi's OpenAPI document; rights, slots and pages in its README.
|
|
39
|
+
|
|
3
40
|
## 0.1.0
|
|
4
41
|
|
|
5
42
|
The design system as a package of its own (ADR 0109 in the application it came from).
|
package/dist/ai.d.ts
ADDED
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { SettingsPage, HostRequest } from '@abpjs/ui';
|
|
3
|
+
|
|
4
|
+
/** The site's AI page, with its header: what a host's catch-all route draws for `ai.admin`. */
|
|
5
|
+
declare function AiAdminPage(): react.JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* The area's settings pages for a host to file under its sections: `ai.admin`, the site's AI (models, aliases, access,
|
|
8
|
+
* limits, usage, exports). The host gives where it opens and who sees it; the server checks every call anyway.
|
|
9
|
+
*/
|
|
10
|
+
declare function aiPages(options: {
|
|
11
|
+
section: string;
|
|
12
|
+
href: string;
|
|
13
|
+
weight?: number;
|
|
14
|
+
title?: string;
|
|
15
|
+
about?: string;
|
|
16
|
+
visible?: SettingsPage['visible'];
|
|
17
|
+
}): SettingsPage[];
|
|
18
|
+
|
|
19
|
+
interface components {
|
|
20
|
+
schemas: {
|
|
21
|
+
AiAliasInfo: {
|
|
22
|
+
/** Format: uuid */
|
|
23
|
+
id: string;
|
|
24
|
+
/** Format: uuid */
|
|
25
|
+
scopeId: null | string;
|
|
26
|
+
name: string;
|
|
27
|
+
targets: components["schemas"]["AiAliasTarget"][];
|
|
28
|
+
/** Format: date-time */
|
|
29
|
+
updatedAt: string;
|
|
30
|
+
};
|
|
31
|
+
AiAliasTarget: {
|
|
32
|
+
/** Format: uuid */
|
|
33
|
+
connectionId: string;
|
|
34
|
+
model?: null | string;
|
|
35
|
+
};
|
|
36
|
+
AiCallRow: {
|
|
37
|
+
/** Format: uuid */
|
|
38
|
+
id: string;
|
|
39
|
+
/** Format: date-time */
|
|
40
|
+
at: string;
|
|
41
|
+
state: string;
|
|
42
|
+
code: null | string;
|
|
43
|
+
error: null | string;
|
|
44
|
+
/** Format: uuid */
|
|
45
|
+
scopeId: null | string;
|
|
46
|
+
scope: null | string;
|
|
47
|
+
/** Format: uuid */
|
|
48
|
+
accountId: null | string;
|
|
49
|
+
/** Format: uuid */
|
|
50
|
+
onBehalfOf: null | string;
|
|
51
|
+
purpose: string;
|
|
52
|
+
aboutKind: null | string;
|
|
53
|
+
aboutId: null | string;
|
|
54
|
+
alias: string;
|
|
55
|
+
connection: string;
|
|
56
|
+
provider: string;
|
|
57
|
+
model: string;
|
|
58
|
+
dataClass: string;
|
|
59
|
+
streamed: boolean;
|
|
60
|
+
/** Format: int32 */
|
|
61
|
+
inputTokens: number | string;
|
|
62
|
+
/** Format: int32 */
|
|
63
|
+
outputTokens: number | string;
|
|
64
|
+
/** Format: int32 */
|
|
65
|
+
cacheWriteTokens: number | string;
|
|
66
|
+
/** Format: int32 */
|
|
67
|
+
cacheReadTokens: number | string;
|
|
68
|
+
/** Format: double */
|
|
69
|
+
cost: number | string;
|
|
70
|
+
/** Format: int32 */
|
|
71
|
+
durationMs: null | number | string;
|
|
72
|
+
};
|
|
73
|
+
AiConnectionInfo: {
|
|
74
|
+
/** Format: uuid */
|
|
75
|
+
id: string;
|
|
76
|
+
/** Format: uuid */
|
|
77
|
+
scopeId: null | string;
|
|
78
|
+
name: string;
|
|
79
|
+
provider: string;
|
|
80
|
+
endpoint: string;
|
|
81
|
+
hasKey: boolean;
|
|
82
|
+
models: string[];
|
|
83
|
+
dataClasses: string[];
|
|
84
|
+
labels: string[];
|
|
85
|
+
settings: {
|
|
86
|
+
[key: string]: string;
|
|
87
|
+
};
|
|
88
|
+
/** Format: double */
|
|
89
|
+
inputPrice: number | string;
|
|
90
|
+
/** Format: double */
|
|
91
|
+
outputPrice: number | string;
|
|
92
|
+
modelPrices: {
|
|
93
|
+
[key: string]: components["schemas"]["AiPrice"];
|
|
94
|
+
};
|
|
95
|
+
structuredOutput: boolean;
|
|
96
|
+
enabled: boolean;
|
|
97
|
+
modelSettings?: {
|
|
98
|
+
[key: string]: components["schemas"]["AiModelSettings"];
|
|
99
|
+
};
|
|
100
|
+
/** Format: double */
|
|
101
|
+
cacheWritePrice?: null | number | string;
|
|
102
|
+
/** Format: double */
|
|
103
|
+
cacheReadPrice?: null | number | string;
|
|
104
|
+
/** Format: int32 */
|
|
105
|
+
idleTimeoutSeconds?: null | number | string;
|
|
106
|
+
/** Format: int32 */
|
|
107
|
+
totalTimeoutSeconds?: null | number | string;
|
|
108
|
+
type?: null | string;
|
|
109
|
+
test?: null | components["schemas"]["AiConnectionTest"];
|
|
110
|
+
};
|
|
111
|
+
AiConnectionInput: {
|
|
112
|
+
name: string;
|
|
113
|
+
provider: string;
|
|
114
|
+
models: string[];
|
|
115
|
+
dataClasses: string[];
|
|
116
|
+
modelSettings?: null | {
|
|
117
|
+
[key: string]: components["schemas"]["AiModelSettings"];
|
|
118
|
+
};
|
|
119
|
+
endpoint?: null | string;
|
|
120
|
+
apiKey?: null | string;
|
|
121
|
+
labels?: null | string[];
|
|
122
|
+
settings?: null | {
|
|
123
|
+
[key: string]: string;
|
|
124
|
+
};
|
|
125
|
+
/** Format: double */
|
|
126
|
+
inputPrice?: number | string;
|
|
127
|
+
/** Format: double */
|
|
128
|
+
outputPrice?: number | string;
|
|
129
|
+
modelPrices?: null | {
|
|
130
|
+
[key: string]: components["schemas"]["AiPrice"];
|
|
131
|
+
};
|
|
132
|
+
structuredOutput?: boolean;
|
|
133
|
+
enabled?: boolean;
|
|
134
|
+
/** Format: double */
|
|
135
|
+
cacheWritePrice?: null | number | string;
|
|
136
|
+
/** Format: double */
|
|
137
|
+
cacheReadPrice?: null | number | string;
|
|
138
|
+
/** Format: int32 */
|
|
139
|
+
idleTimeoutSeconds?: null | number | string;
|
|
140
|
+
/** Format: int32 */
|
|
141
|
+
totalTimeoutSeconds?: null | number | string;
|
|
142
|
+
test?: boolean;
|
|
143
|
+
};
|
|
144
|
+
AiConnectionTest: {
|
|
145
|
+
ok: boolean;
|
|
146
|
+
model: string;
|
|
147
|
+
/** Format: int32 */
|
|
148
|
+
elapsedMs: number | string;
|
|
149
|
+
/** Format: date-time */
|
|
150
|
+
at: string;
|
|
151
|
+
/** Format: int32 */
|
|
152
|
+
status?: null | number | string;
|
|
153
|
+
reason?: null | string;
|
|
154
|
+
};
|
|
155
|
+
AiExportInfo: {
|
|
156
|
+
/** Format: uuid */
|
|
157
|
+
id: string;
|
|
158
|
+
/** Format: date-time */
|
|
159
|
+
at: string;
|
|
160
|
+
/** Format: uuid */
|
|
161
|
+
actorId: string;
|
|
162
|
+
/** Format: date-time */
|
|
163
|
+
from: string;
|
|
164
|
+
/** Format: date-time */
|
|
165
|
+
to: string;
|
|
166
|
+
/** Format: uuid */
|
|
167
|
+
scopeId: null | string;
|
|
168
|
+
/** Format: int32 */
|
|
169
|
+
calls: number | string;
|
|
170
|
+
/** Format: int32 */
|
|
171
|
+
prompts: number | string;
|
|
172
|
+
truncated: boolean;
|
|
173
|
+
/** Format: int64 */
|
|
174
|
+
bytes: number | string;
|
|
175
|
+
/** Format: date-time */
|
|
176
|
+
expiresAt: string;
|
|
177
|
+
};
|
|
178
|
+
AiExportRequest: {
|
|
179
|
+
/** Format: date-time */
|
|
180
|
+
from: string;
|
|
181
|
+
/** Format: date-time */
|
|
182
|
+
to: string;
|
|
183
|
+
/** Format: uuid */
|
|
184
|
+
scopeId?: null | string;
|
|
185
|
+
};
|
|
186
|
+
AiLimitInfo: {
|
|
187
|
+
/** Format: uuid */
|
|
188
|
+
id: string;
|
|
189
|
+
/** Format: uuid */
|
|
190
|
+
scopeId: null | string;
|
|
191
|
+
kind: string;
|
|
192
|
+
period: string;
|
|
193
|
+
/** Format: double */
|
|
194
|
+
amount: number | string;
|
|
195
|
+
/** Format: uuid */
|
|
196
|
+
accountId: null | string;
|
|
197
|
+
/** Format: uuid */
|
|
198
|
+
groupId: null | string;
|
|
199
|
+
measure?: string;
|
|
200
|
+
};
|
|
201
|
+
AiLimitInput: {
|
|
202
|
+
kind: string;
|
|
203
|
+
period: string;
|
|
204
|
+
/** Format: double */
|
|
205
|
+
amount: number | string;
|
|
206
|
+
/** Format: uuid */
|
|
207
|
+
accountId?: null | string;
|
|
208
|
+
/** Format: uuid */
|
|
209
|
+
groupId?: null | string;
|
|
210
|
+
measure?: string;
|
|
211
|
+
};
|
|
212
|
+
AiModelRef: {
|
|
213
|
+
/** Format: uuid */
|
|
214
|
+
connectionId: string;
|
|
215
|
+
model: string;
|
|
216
|
+
};
|
|
217
|
+
AiModelSettings: {
|
|
218
|
+
name?: null | string;
|
|
219
|
+
enabled?: boolean;
|
|
220
|
+
tools?: boolean;
|
|
221
|
+
images?: boolean;
|
|
222
|
+
structuredOutput?: null | boolean;
|
|
223
|
+
embeds?: boolean;
|
|
224
|
+
/** Format: int32 */
|
|
225
|
+
contextTokens?: null | number | string;
|
|
226
|
+
/** Format: date-time */
|
|
227
|
+
priceSetAt?: null | string;
|
|
228
|
+
};
|
|
229
|
+
AiPrice: {
|
|
230
|
+
/** Format: double */
|
|
231
|
+
input: number | string;
|
|
232
|
+
/** Format: double */
|
|
233
|
+
output: number | string;
|
|
234
|
+
/** Format: double */
|
|
235
|
+
cacheWrite?: null | number | string;
|
|
236
|
+
/** Format: double */
|
|
237
|
+
cacheRead?: null | number | string;
|
|
238
|
+
};
|
|
239
|
+
AiRecentQuery: {
|
|
240
|
+
/** Format: date-time */
|
|
241
|
+
from: string;
|
|
242
|
+
/** Format: date-time */
|
|
243
|
+
to: string;
|
|
244
|
+
/** Format: uuid */
|
|
245
|
+
scopeId?: null | string;
|
|
246
|
+
/**
|
|
247
|
+
* Format: int32
|
|
248
|
+
* @default 50
|
|
249
|
+
*/
|
|
250
|
+
count: number | string;
|
|
251
|
+
states?: null | string[];
|
|
252
|
+
};
|
|
253
|
+
AiScopeAccessInfo: {
|
|
254
|
+
/** Format: uuid */
|
|
255
|
+
scopeId: string;
|
|
256
|
+
/** Format: uuid */
|
|
257
|
+
setOnScopeId: null | string;
|
|
258
|
+
allSiteModels: boolean;
|
|
259
|
+
siteModels: components["schemas"]["AiModelRef"][];
|
|
260
|
+
mayConnect: boolean;
|
|
261
|
+
};
|
|
262
|
+
AiScopeAccessInput: {
|
|
263
|
+
allSiteModels: boolean;
|
|
264
|
+
siteModels: null | components["schemas"]["AiModelRef"][];
|
|
265
|
+
mayConnect: boolean;
|
|
266
|
+
};
|
|
267
|
+
AiSiteSettings: {
|
|
268
|
+
scopesMayConnect: boolean;
|
|
269
|
+
keepPrompts: boolean;
|
|
270
|
+
/** Format: int32 */
|
|
271
|
+
promptDays: number | string;
|
|
272
|
+
scopeDataClasses: string[];
|
|
273
|
+
dataClasses: string[];
|
|
274
|
+
scopeAccess?: null | string;
|
|
275
|
+
};
|
|
276
|
+
AiUsageQuery: {
|
|
277
|
+
/** Format: date-time */
|
|
278
|
+
from: string;
|
|
279
|
+
/** Format: date-time */
|
|
280
|
+
to: string;
|
|
281
|
+
/** Format: uuid */
|
|
282
|
+
scopeId?: null | string;
|
|
283
|
+
/** @default scope */
|
|
284
|
+
groupBy: string;
|
|
285
|
+
/** Format: uuid */
|
|
286
|
+
accountId?: null | string;
|
|
287
|
+
purpose?: null | string;
|
|
288
|
+
model?: null | string;
|
|
289
|
+
states?: null | string[];
|
|
290
|
+
};
|
|
291
|
+
AiUsageReport: {
|
|
292
|
+
query: components["schemas"]["AiUsageQuery"];
|
|
293
|
+
rows: components["schemas"]["AiUsageRow"][];
|
|
294
|
+
total: components["schemas"]["AiUsageRow"];
|
|
295
|
+
};
|
|
296
|
+
AiUsageRow: {
|
|
297
|
+
key: string;
|
|
298
|
+
title: null | string;
|
|
299
|
+
/** Format: int32 */
|
|
300
|
+
calls: number | string;
|
|
301
|
+
/** Format: int64 */
|
|
302
|
+
inputTokens: number | string;
|
|
303
|
+
/** Format: int64 */
|
|
304
|
+
outputTokens: number | string;
|
|
305
|
+
/** Format: double */
|
|
306
|
+
cost: number | string;
|
|
307
|
+
/** Format: int32 */
|
|
308
|
+
failed?: number | string;
|
|
309
|
+
/** Format: int32 */
|
|
310
|
+
refused?: number | string;
|
|
311
|
+
/** Format: int64 */
|
|
312
|
+
cacheWriteTokens?: number | string;
|
|
313
|
+
/** Format: int64 */
|
|
314
|
+
cacheReadTokens?: number | string;
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
responses: never;
|
|
318
|
+
parameters: never;
|
|
319
|
+
requestBodies: never;
|
|
320
|
+
headers: never;
|
|
321
|
+
pathItems: never;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
type Schemas = components['schemas'];
|
|
325
|
+
/** AbpAi.HttpApi's types, as its OpenAPI document gives them (`api.d.ts`). */
|
|
326
|
+
type AiTypes = Schemas;
|
|
327
|
+
type AiSite = Schemas['AiSiteSettings'];
|
|
328
|
+
type AiConnection = Schemas['AiConnectionInfo'];
|
|
329
|
+
type AiConnectionInput = Schemas['AiConnectionInput'];
|
|
330
|
+
type AiModelSettings = Schemas['AiModelSettings'];
|
|
331
|
+
type AiAlias = Schemas['AiAliasInfo'];
|
|
332
|
+
type AiAliasTarget = Schemas['AiAliasTarget'];
|
|
333
|
+
type AiLimit = Schemas['AiLimitInfo'];
|
|
334
|
+
type AiLimitInput = Schemas['AiLimitInput'];
|
|
335
|
+
type AiScopeAccess = Schemas['AiScopeAccessInfo'];
|
|
336
|
+
type AiScopeAccessInput = Schemas['AiScopeAccessInput'];
|
|
337
|
+
type AiUsageReport = Schemas['AiUsageReport'];
|
|
338
|
+
type AiUsageRow = Schemas['AiUsageRow'];
|
|
339
|
+
type AiCall = Schemas['AiCallRow'];
|
|
340
|
+
type AiExport = Schemas['AiExportInfo'];
|
|
341
|
+
/** A number the API may give as a string (its decimals and 64-bit counts). */
|
|
342
|
+
declare const num: (value: number | string | null | undefined) => number;
|
|
343
|
+
|
|
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
|
+
/** One model of one connection, as the screens show it: its settings with AbpAi's defaults filled in. */
|
|
366
|
+
interface AiModelRow {
|
|
367
|
+
/** `connectionId:model`: what an alias target and a scope's opened models are keyed by. */
|
|
368
|
+
key: string;
|
|
369
|
+
connectionId: string;
|
|
370
|
+
connection: string;
|
|
371
|
+
scopeId: string | null;
|
|
372
|
+
modelId: string;
|
|
373
|
+
name: string;
|
|
374
|
+
enabled: boolean;
|
|
375
|
+
tools: boolean;
|
|
376
|
+
images: boolean;
|
|
377
|
+
structuredOutput: boolean;
|
|
378
|
+
contextTokens: number | null;
|
|
379
|
+
/** Per million tokens; null when the model costs nothing in and nothing out. */
|
|
380
|
+
inputPrice: number | null;
|
|
381
|
+
outputPrice: number | null;
|
|
382
|
+
priceSetAt: string | null;
|
|
383
|
+
}
|
|
384
|
+
declare const modelKey: (connectionId: string, model: string | null | undefined) => string;
|
|
385
|
+
/** Every model of the connections, in their order. A model with no settings is on and takes tools (AbpAi's defaults). */
|
|
386
|
+
declare function modelRows(connections: readonly AiConnection[]): AiModelRow[];
|
|
387
|
+
/**
|
|
388
|
+
* The connection as an update with one model's settings and price changed. Everything else goes back as it is; its key
|
|
389
|
+
* isn't sent, so the server keeps it.
|
|
390
|
+
*/
|
|
391
|
+
declare function withModel(c: AiConnection, model: string, settings: AiModelSettings, price: {
|
|
392
|
+
input: number;
|
|
393
|
+
output: number;
|
|
394
|
+
} | null): AiConnectionInput;
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* What each scope may use: none by default; every model of the site's that's on, or some; its own connections; its
|
|
398
|
+
* limits. Every scope the host lists, with the ones AbpAi has settings for that it didn't list named through
|
|
399
|
+
* `scopes.name`. A host adds a column through the `ai.access.cell` slot and fields to the dialog through
|
|
400
|
+
* `ai.access.editor`.
|
|
401
|
+
*/
|
|
402
|
+
declare function AccessPanel({ models }: {
|
|
403
|
+
models: AiModelRow[];
|
|
404
|
+
}): react.JSX.Element;
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Aliases ("fast", "smart"): what skills and steps name. The site's or a scope's own are edited here, each to its first
|
|
408
|
+
* model (the ones after it, if any, stay as they are); a scope also sees the aliases it gets from above that it doesn't
|
|
409
|
+
* replace (`inherited`).
|
|
410
|
+
*/
|
|
411
|
+
declare function AliasesPanel({ scopeId, aliases, inherited, models, onSaved }: {
|
|
412
|
+
scopeId?: string;
|
|
413
|
+
aliases: AiAlias[] | undefined;
|
|
414
|
+
inherited?: AiAlias[];
|
|
415
|
+
models: AiModelRow[];
|
|
416
|
+
onSaved: () => Promise<void> | void;
|
|
417
|
+
}): react.JSX.Element;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Exports of AI calls for support: a period's calls, up to 31 days, one line of JSON each (gzipped), with their prompts
|
|
421
|
+
* and replies only where the site keeps them. Asked for with the password again (the host's step-up); each export and
|
|
422
|
+
* download is in the security log. Kept a week.
|
|
423
|
+
*/
|
|
424
|
+
declare function ExportsPanel({ scopeId }: {
|
|
425
|
+
scopeId?: string;
|
|
426
|
+
}): react.JSX.Element;
|
|
427
|
+
|
|
428
|
+
/** What a row of the editor says: what it counts (`cost`, `tokens`, `requests`) or `call-tokens`, over which period, how much. */
|
|
429
|
+
type LimitRow = {
|
|
430
|
+
kind: string;
|
|
431
|
+
period: string;
|
|
432
|
+
amount: string;
|
|
433
|
+
};
|
|
434
|
+
declare const LIMIT_KINDS: readonly ["cost", "tokens", "requests", "call-tokens"];
|
|
435
|
+
declare const LIMIT_PERIODS: readonly ["minute", "day", "month"];
|
|
436
|
+
/** The limits this editor shows and changes: a scope's (or the site's) totals and its tokens per reply, not a person's or a group's. */
|
|
437
|
+
declare const editableLimit: (l: AiLimit) => boolean;
|
|
438
|
+
declare const limitRow: (l: AiLimit) => LimitRow;
|
|
439
|
+
/**
|
|
440
|
+
* Saves the editor's rows on the site or a scope: the limits no row keeps as they were are deleted, then the new and
|
|
441
|
+
* changed ones are set. A person's and a group's limits are left alone.
|
|
442
|
+
*/
|
|
443
|
+
declare function saveLimits(request: HostRequest, scopeId: string | null | undefined, before: readonly AiLimit[], rows: readonly LimitRow[]): Promise<void>;
|
|
444
|
+
/** "Cost per day: 5", "Tokens per reply: 2,000". */
|
|
445
|
+
declare function useLimitText(): (l: AiLimit) => string;
|
|
446
|
+
/**
|
|
447
|
+
* Limits on a scope or the site: cost, tokens or requests per minute, day or month, and tokens per reply. With `onSave`
|
|
448
|
+
* it has its own Save button; with `onChange` (inside a larger form) it reports every change instead.
|
|
449
|
+
*/
|
|
450
|
+
declare function LimitsEditor({ limits, onSave, onChange, busy, error }: {
|
|
451
|
+
limits: AiLimit[];
|
|
452
|
+
onSave?: (rows: LimitRow[]) => Promise<void> | void;
|
|
453
|
+
onChange?: (rows: LimitRow[]) => void;
|
|
454
|
+
busy?: boolean;
|
|
455
|
+
error?: string | null;
|
|
456
|
+
}): react.JSX.Element;
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Models: each connection's, found by asking it, off until enabled, with what they can do and their prices per million
|
|
460
|
+
* 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`; and what each model can do is the host's to say when
|
|
462
|
+
* it fills `ai.models.can` (its own record of it, where the gateway is told every model takes everything).
|
|
463
|
+
*/
|
|
464
|
+
declare function ModelsPanel({ scopeId, connections, rows, loading, hostKeeps, onChanged, title, description }: {
|
|
465
|
+
scopeId?: string;
|
|
466
|
+
/** The connections whose models are listed and may be changed here. */
|
|
467
|
+
connections: AiConnection[] | undefined;
|
|
468
|
+
/** Rows to list in place of the connections' (a scope's opened models and its own); its own are still changed through `connections`. */
|
|
469
|
+
rows?: AiModelRow[];
|
|
470
|
+
loading?: boolean;
|
|
471
|
+
hostKeeps: boolean;
|
|
472
|
+
onChanged: () => Promise<void> | void;
|
|
473
|
+
title: string;
|
|
474
|
+
description: string;
|
|
475
|
+
}): react.JSX.Element;
|
|
476
|
+
|
|
477
|
+
/** How usage is summed, in the screens' words, and AbpAi's group for each. */
|
|
478
|
+
declare const USAGE_BY: {
|
|
479
|
+
readonly project: "scope";
|
|
480
|
+
readonly model: "model";
|
|
481
|
+
readonly purpose: "purpose";
|
|
482
|
+
readonly account: "account";
|
|
483
|
+
};
|
|
484
|
+
type UsageBy = keyof typeof USAGE_BY;
|
|
485
|
+
/** The usage ledger for the site or a scope: summed by what's asked for, this month or an earlier one, with the latest calls. */
|
|
486
|
+
declare function UsagePanel({ scopeId, by: byOptions }: {
|
|
487
|
+
scopeId?: string;
|
|
488
|
+
by: UsageBy[];
|
|
489
|
+
}): react.JSX.Element;
|
|
490
|
+
|
|
491
|
+
/** The area's words, in English and Arabic; a host overrides any key through `AbpHost.texts.ai`. */
|
|
492
|
+
declare const useAiTexts: () => (key: string, values?: Record<string, string | number>) => string;
|
|
493
|
+
|
|
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 };
|