@abpjs/ui 0.2.0-next.1 → 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 +14 -0
- package/dist/ai.d.ts +3 -2
- package/dist/ai.js +7 -5
- package/dist/ai.js.map +1 -1
- package/dist/index.d.ts +32 -3
- package/dist/index.js +1304 -1081
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
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
|
+
|
|
3
17
|
## 0.2.0-next.1
|
|
4
18
|
|
|
5
19
|
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
|
@@ -376,7 +376,7 @@ interface AiModelRow {
|
|
|
376
376
|
images: boolean;
|
|
377
377
|
structuredOutput: boolean;
|
|
378
378
|
contextTokens: number | null;
|
|
379
|
-
/** Per million tokens; null when
|
|
379
|
+
/** Per million tokens; null when the model costs nothing in and nothing out. */
|
|
380
380
|
inputPrice: number | null;
|
|
381
381
|
outputPrice: number | null;
|
|
382
382
|
priceSetAt: string | null;
|
|
@@ -458,7 +458,8 @@ declare function LimitsEditor({ limits, onSave, onChange, busy, error }: {
|
|
|
458
458
|
/**
|
|
459
459
|
* Models: each connection's, found by asking it, off until enabled, with what they can do and their prices per million
|
|
460
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
|
|
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).
|
|
462
463
|
*/
|
|
463
464
|
declare function ModelsPanel({ scopeId, connections, rows, loading, hostKeeps, onChanged, title, description }: {
|
|
464
465
|
scopeId?: string;
|
package/dist/ai.js
CHANGED
|
@@ -7,7 +7,7 @@ import { PageHeader } from "@abpjs/ui";
|
|
|
7
7
|
// src/areas/ai/AiAdmin.tsx
|
|
8
8
|
import { useMemo as useMemo4 } from "react";
|
|
9
9
|
import { Stack as Stack7, Tabs } from "@chakra-ui/react";
|
|
10
|
-
import { HostSlot as HostSlot3, InlineAlert as InlineAlert5, notify as notify4, Panel as Panel6, useApiAction as useApiAction5, useApiQuery as useApiQuery3, useAreaRequest as useAreaRequest6, useCan, useOptionalHost as
|
|
10
|
+
import { HostSlot as HostSlot3, InlineAlert as InlineAlert5, notify as notify4, Panel as Panel6, useApiAction as useApiAction5, useApiQuery as useApiQuery3, useAreaRequest as useAreaRequest6, useCan, useOptionalHost as useOptionalHost3 } from "@abpjs/ui";
|
|
11
11
|
|
|
12
12
|
// src/areas/ai/AccessPanel.tsx
|
|
13
13
|
import { useEffect, useMemo, useState as useState2 } from "react";
|
|
@@ -420,7 +420,7 @@ function modelRows(connections) {
|
|
|
420
420
|
const price = c.modelPrices?.[model];
|
|
421
421
|
const input = price ? num(price.input) : num(c.inputPrice);
|
|
422
422
|
const output = price ? num(price.output) : num(c.outputPrice);
|
|
423
|
-
const priced =
|
|
423
|
+
const priced = input !== 0 || output !== 0;
|
|
424
424
|
return {
|
|
425
425
|
key: modelKey(c.id, model),
|
|
426
426
|
connectionId: c.id,
|
|
@@ -821,7 +821,7 @@ function ExportsPanel({ scopeId }) {
|
|
|
821
821
|
// src/areas/ai/ModelsPanel.tsx
|
|
822
822
|
import { useState as useState5 } from "react";
|
|
823
823
|
import { HStack as HStack4, Input as Input4, Stack as Stack5, Text as Text5 } from "@chakra-ui/react";
|
|
824
|
-
import { Button as Button5, CheckboxField as CheckboxField2, DataTable as DataTable3, Field as Field4, FormDialog as FormDialog2, HostSlot as HostSlot2, notify as notify3, Panel as Panel4, SelectField as SelectField3, StatusPill as StatusPill2, SwitchField as SwitchField2, errorText as errorText2, useApiAction as useApiAction4, useAreaRequest as useAreaRequest4, useFormatters as useFormatters4 } from "@abpjs/ui";
|
|
824
|
+
import { Button as Button5, CheckboxField as CheckboxField2, DataTable as DataTable3, Field as Field4, FormDialog as FormDialog2, HostSlot as HostSlot2, notify as notify3, Panel as Panel4, SelectField as SelectField3, StatusPill as StatusPill2, SwitchField as SwitchField2, errorText as errorText2, useApiAction as useApiAction4, useAreaRequest as useAreaRequest4, useFormatters as useFormatters4, useOptionalHost as useOptionalHost2 } from "@abpjs/ui";
|
|
825
825
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
826
826
|
function ModelsPanel({ scopeId, connections, rows, loading, hostKeeps, onChanged, title, description }) {
|
|
827
827
|
const t = useAiTexts();
|
|
@@ -834,6 +834,8 @@ function ModelsPanel({ scopeId, connections, rows, loading, hostKeeps, onChanged
|
|
|
834
834
|
const shown = rows ?? (connections ? modelRows(connections) : void 0);
|
|
835
835
|
const source = list.find((c) => c.id === picked) ?? list[0];
|
|
836
836
|
const own = (m) => list.some((c) => c.id === m.connectionId);
|
|
837
|
+
const host = useOptionalHost2();
|
|
838
|
+
const hostSaysCan = hostKeeps && Boolean(host?.slots?.["ai.models.can"]);
|
|
837
839
|
async function discover(c) {
|
|
838
840
|
setFinding(c.id);
|
|
839
841
|
try {
|
|
@@ -893,7 +895,7 @@ function ModelsPanel({ scopeId, connections, rows, loading, hostKeeps, onChanged
|
|
|
893
895
|
{
|
|
894
896
|
id: "can",
|
|
895
897
|
header: t("can"),
|
|
896
|
-
cell: (m) => /* @__PURE__ */ jsxs5(HStack4, { gap: "1", flexWrap: "wrap", children: [
|
|
898
|
+
cell: (m) => hostSaysCan ? /* @__PURE__ */ jsx5(HostSlot2, { name: "ai.models.can", context: { connectionId: m.connectionId, modelId: m.modelId } }) : /* @__PURE__ */ jsxs5(HStack4, { gap: "1", flexWrap: "wrap", children: [
|
|
897
899
|
m.tools && /* @__PURE__ */ jsx5(StatusPill2, { tone: "neutral", dot: false, children: t("tools") }),
|
|
898
900
|
m.images && /* @__PURE__ */ jsx5(StatusPill2, { tone: "neutral", dot: false, children: t("images") }),
|
|
899
901
|
m.structuredOutput && /* @__PURE__ */ jsx5(StatusPill2, { tone: "neutral", dot: false, children: t("structured") })
|
|
@@ -1151,7 +1153,7 @@ function AiAdmin() {
|
|
|
1151
1153
|
const limits = useApiQuery3("ai", "/limits");
|
|
1152
1154
|
const saving = useApiAction5();
|
|
1153
1155
|
const hostKeeps = useHostKeepsConnections(site.data);
|
|
1154
|
-
const tryHere = Boolean(
|
|
1156
|
+
const tryHere = Boolean(useOptionalHost3()?.slots?.["ai.try"]);
|
|
1155
1157
|
const models = useMemo4(() => modelRows(connections.data ?? []), [connections.data]);
|
|
1156
1158
|
async function saveSiteLimits(rows) {
|
|
1157
1159
|
if (await saving.run(() => saveLimits(request, null, limits.data ?? [], rows).then(() => true)) !== void 0) {
|