@abpjs/ui 0.0.0-stage → 0.2.0-next.1
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 +39 -0
- package/LICENSE +55 -0
- package/NOTICE +4 -0
- package/README.md +60 -2
- package/dist/ai.d.ts +493 -0
- package/dist/ai.js +1303 -0
- package/dist/ai.js.map +1 -0
- package/dist/index.d.ts +2734 -0
- package/dist/index.js +8955 -0
- package/dist/index.js.map +1 -0
- package/dist/rules.d.ts +119 -0
- package/dist/rules.js +116 -0
- package/dist/rules.js.map +1 -0
- package/package.json +90 -4
package/dist/ai.js
ADDED
|
@@ -0,0 +1,1303 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/areas/ai/pages.tsx
|
|
4
|
+
import { Stack as Stack8 } from "@chakra-ui/react";
|
|
5
|
+
import { PageHeader } from "@abpjs/ui";
|
|
6
|
+
|
|
7
|
+
// src/areas/ai/AiAdmin.tsx
|
|
8
|
+
import { useMemo as useMemo4 } from "react";
|
|
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 useOptionalHost2 } from "@abpjs/ui";
|
|
11
|
+
|
|
12
|
+
// src/areas/ai/AccessPanel.tsx
|
|
13
|
+
import { useEffect, useMemo, useState as useState2 } from "react";
|
|
14
|
+
import { Stack as Stack2, Text as Text2 } from "@chakra-ui/react";
|
|
15
|
+
import { Button as Button2, CheckboxField, DataTable, FormDialog, HostSlot, InlineAlert as InlineAlert2, notify, Panel, SearchInput, StatusPill, SwitchField, useApiAction, useApiQuery, useAreaRequest, useFormatters as useFormatters2, useHost, useNames, useOptionalHost, useSlotSaves } from "@abpjs/ui";
|
|
16
|
+
|
|
17
|
+
// src/areas/ai/LimitsEditor.tsx
|
|
18
|
+
import { useState } from "react";
|
|
19
|
+
import { HStack, Input, Stack, Text } from "@chakra-ui/react";
|
|
20
|
+
import { Trash2 } from "lucide-react";
|
|
21
|
+
import { Button, Field, IconButton, InlineAlert, SelectField, useFormatters } from "@abpjs/ui";
|
|
22
|
+
|
|
23
|
+
// src/areas/ai/texts.ts
|
|
24
|
+
import { createAreaTexts } from "@abpjs/ui";
|
|
25
|
+
|
|
26
|
+
// src/areas/ai/texts/ar.json
|
|
27
|
+
var ar_default = {
|
|
28
|
+
pageTitle: "\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",
|
|
29
|
+
pageSubtitle: "\u0627\u0644\u0646\u0645\u0627\u0630\u062C \u0627\u0644\u062A\u064A \u064A\u0645\u0643\u0646 \u0644{product} \u0627\u0633\u062A\u062F\u0639\u0627\u0624\u0647\u0627\u060C \u0648\u0627\u0644\u0623\u0633\u0645\u0627\u0621 \u0627\u0644\u0645\u0633\u062A\u0639\u0627\u0631\u0629 \u0627\u0644\u062A\u064A \u062A\u0633\u062A\u062E\u062F\u0645\u0647\u0627 \u0627\u0644\u0645\u0647\u0627\u0631\u0627\u062A \u0648\u0627\u0644\u062E\u0637\u0648\u0627\u062A\u060C \u0648\u0645\u0627 \u064A\u0645\u0643\u0646 \u0644\u0643\u0644 \u0645\u0634\u0631\u0648\u0639 \u0627\u0633\u062A\u062E\u062F\u0627\u0645\u0647\u060C \u0648\u0627\u0644\u062D\u062F\u0648\u062F\u060C \u0648\u0643\u0644\u0641\u0629 \u0630\u0644\u0643 \u0643\u0644\u0647. \u0627\u0644\u0645\u0632\u0648\u0651\u062F\u0648\u0646 \u0627\u062A\u0635\u0627\u0644\u0627\u062A.",
|
|
30
|
+
"tabs.models": "\u0627\u0644\u0646\u0645\u0627\u0630\u062C",
|
|
31
|
+
"tabs.aliases": "\u0627\u0644\u0623\u0633\u0645\u0627\u0621 \u0627\u0644\u0645\u0633\u062A\u0639\u0627\u0631\u0629",
|
|
32
|
+
"tabs.access": "\u0627\u0644\u0645\u0634\u0627\u0631\u064A\u0639",
|
|
33
|
+
"tabs.limits": "\u0627\u0644\u062D\u062F\u0648\u062F",
|
|
34
|
+
"tabs.usage": "\u0627\u0644\u0627\u0633\u062A\u062E\u062F\u0627\u0645",
|
|
35
|
+
"tabs.try": "\u062A\u062C\u0631\u0628\u0629",
|
|
36
|
+
"tabs.exports": "\u0627\u0644\u062A\u0635\u062F\u064A\u0631",
|
|
37
|
+
modelsTitle: "\u0627\u0644\u0646\u0645\u0627\u0630\u062C",
|
|
38
|
+
modelsHint: "\u0646\u0645\u0627\u0630\u062C \u0643\u0644 \u0627\u062A\u0635\u0627\u0644 \u0628\u0645\u0632\u0648\u0651\u062F\u060C \u062A\u064F\u0643\u062A\u0634\u0641 \u0628\u0633\u0624\u0627\u0644\u0647. \u064A\u0628\u0642\u0649 \u0627\u0644\u0646\u0645\u0648\u0630\u062C \u0645\u062A\u0648\u0642\u0641\u064B\u0627 \u062D\u062A\u0649 \u062A\u0634\u063A\u0651\u0644\u0647\u061B \u0648\u062D\u062F\u0651\u062F \u0623\u0633\u0639\u0627\u0631\u0647 \u0644\u062A\u0643\u0648\u0646 \u0627\u0644\u062D\u062F\u0648\u062F \u0628\u0627\u0644\u0645\u0627\u0644.",
|
|
39
|
+
noProviders: "\u0644\u0627 \u064A\u0648\u062C\u062F \u0645\u0632\u0648\u0651\u062F \u0646\u0645\u0627\u0630\u062C \u0645\u062A\u0635\u0644 \u0628\u0639\u062F. \u0623\u0636\u0641 \u0627\u062A\u0635\u0627\u0644 Anthropic \u0623\u0648 \u0627\u062A\u0635\u0627\u0644\u064B\u0627 \u0645\u062A\u0648\u0627\u0641\u0642\u064B\u0627 \u0645\u0639 OpenAI \u0645\u0646 \u0627\u0644\u0625\u062F\u0627\u0631\u0629 \u203A \u0627\u0644\u0627\u062A\u0635\u0627\u0644\u0627\u062A.",
|
|
40
|
+
connection: "\u0627\u0644\u0627\u062A\u0635\u0627\u0644",
|
|
41
|
+
findModels: "\u0627\u0643\u062A\u0634\u0627\u0641 \u0646\u0645\u0627\u0630\u062C\u0647",
|
|
42
|
+
found: "\u064A\u0642\u062F\u0651\u0645 {name} {count, plural, zero {\u0644\u0627 \u0646\u0645\u0627\u0630\u062C} one {\u0646\u0645\u0648\u0630\u062C\u064B\u0627 \u0648\u0627\u062D\u062F\u064B\u0627} two {\u0646\u0645\u0648\u0630\u062C\u064A\u0646} few {# \u0646\u0645\u0627\u0630\u062C} many {# \u0646\u0645\u0648\u0630\u062C\u064B\u0627} other {# \u0646\u0645\u0648\u0630\u062C}}.",
|
|
43
|
+
noModels: "\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u0645\u0627\u0630\u062C \u0628\u0639\u062F.",
|
|
44
|
+
noModelsFind: "\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u0645\u0627\u0630\u062C \u0628\u0639\u062F. \u0627\u0643\u062A\u0634\u0641 \u0646\u0645\u0627\u0630\u062C \u0627\u062A\u0635\u0627\u0644 \u0644\u0644\u0628\u062F\u0621.",
|
|
45
|
+
model: "\u0627\u0644\u0646\u0645\u0648\u0630\u062C",
|
|
46
|
+
can: "\u0645\u0627 \u064A\u0633\u062A\u0637\u064A\u0639\u0647",
|
|
47
|
+
tools: "\u0627\u0644\u0623\u062F\u0648\u0627\u062A",
|
|
48
|
+
images: "\u0627\u0644\u0635\u0648\u0631",
|
|
49
|
+
structured: "\u0625\u062C\u0627\u0628\u0627\u062A \u0645\u0646\u0638\u0651\u0645\u0629",
|
|
50
|
+
toolsLong: "\u064A\u0633\u062A\u062F\u0639\u064A \u0627\u0644\u0623\u062F\u0648\u0627\u062A",
|
|
51
|
+
imagesLong: "\u064A\u0642\u0631\u0623 \u0627\u0644\u0635\u0648\u0631",
|
|
52
|
+
structuredLong: "\u064A\u062C\u064A\u0628 \u0628\u0635\u064A\u063A\u0629 JSON \u0645\u062D\u062F\u062F\u0629",
|
|
53
|
+
prices: "\u0627\u0644\u0623\u0633\u0639\u0627\u0631",
|
|
54
|
+
price: "{input} \u0644\u0644\u0625\u062F\u062E\u0627\u0644\u060C {output} \u0644\u0644\u0625\u062E\u0631\u0627\u062C\u060C \u0644\u0643\u0644 \u0645\u0644\u064A\u0648\u0646 \u0631\u0645\u0632",
|
|
55
|
+
noPrice: "\u0628\u0644\u0627 \u0633\u0639\u0631: \u062A\u064F\u062D\u062A\u0633\u0628 \u0627\u0633\u062A\u062F\u0639\u0627\u0621\u0627\u062A\u0647 \u0645\u062C\u0627\u0646\u064A\u0629",
|
|
56
|
+
priceSetAt: "\u062D\u064F\u062F\u0651\u062F \u0641\u064A {at}",
|
|
57
|
+
state: "\u0627\u0644\u062D\u0627\u0644\u0629",
|
|
58
|
+
on: "\u064A\u0639\u0645\u0644",
|
|
59
|
+
off: "\u0645\u062A\u0648\u0642\u0641",
|
|
60
|
+
edit: "\u062A\u0639\u062F\u064A\u0644",
|
|
61
|
+
editModel: "\u0627\u0644\u0646\u0645\u0648\u0630\u062C {name}",
|
|
62
|
+
modelOn: "\u064A\u0639\u0645\u0644: \u064A\u0645\u0643\u0646 \u0644\u0644\u0623\u0633\u0645\u0627\u0621 \u0627\u0644\u0645\u0633\u062A\u0639\u0627\u0631\u0629 \u0627\u0644\u0625\u0634\u0627\u0631\u0629 \u0625\u0644\u064A\u0647 \u0648\u064A\u0645\u0643\u0646 \u0645\u0646\u062D\u0647 \u0644\u0644\u0645\u0634\u0627\u0631\u064A\u0639",
|
|
63
|
+
name: "\u0627\u0644\u0627\u0633\u0645",
|
|
64
|
+
nameHint: "\u0645\u0627 \u064A\u0631\u0627\u0647 \u0627\u0644\u0646\u0627\u0633\u061B \u0645\u0639\u0631\u0651\u0641\u0647 \u0645\u0627 \u0644\u0645 \u062A\u064F\u0639\u0650\u062F \u062A\u0633\u0645\u064A\u062A\u0647.",
|
|
65
|
+
context: "\u062D\u062C\u0645 \u0627\u0644\u0633\u064A\u0627\u0642 (\u0628\u0627\u0644\u0631\u0645\u0648\u0632)",
|
|
66
|
+
optional: "(\u0627\u062E\u062A\u064A\u0627\u0631\u064A)",
|
|
67
|
+
inputPrice: "\u0633\u0639\u0631 \u0627\u0644\u0625\u062F\u062E\u0627\u0644",
|
|
68
|
+
outputPrice: "\u0633\u0639\u0631 \u0627\u0644\u0625\u062E\u0631\u0627\u062C",
|
|
69
|
+
perMillion: "\u0644\u0643\u0644 \u0645\u0644\u064A\u0648\u0646 \u0631\u0645\u0632\u060C \u0628\u0639\u0645\u0644\u0629 \u0627\u0644\u0645\u0648\u0642\u0639.",
|
|
70
|
+
save: "\u062D\u0641\u0638",
|
|
71
|
+
saved: "\u062A\u0645 \u0627\u0644\u062D\u0641\u0638.",
|
|
72
|
+
aliasesTitle: "\u0627\u0644\u0623\u0633\u0645\u0627\u0621 \u0627\u0644\u0645\u0633\u062A\u0639\u0627\u0631\u0629",
|
|
73
|
+
aliasesHint: "\u0645\u0627 \u062A\u0634\u064A\u0631 \u0625\u0644\u064A\u0647 \u0627\u0644\u0645\u0647\u0627\u0631\u0627\u062A \u0648\u062E\u0637\u0648\u0627\u062A \u0633\u064A\u0631 \u0627\u0644\u0639\u0645\u0644\u060C \u0645\u062B\u0644 fast \u0623\u0648 smart. \u062A\u0648\u062C\u064A\u0647 \u0627\u0644\u0627\u0633\u0645 \u0625\u0644\u0649 \u0646\u0645\u0648\u0630\u062C \u0622\u062E\u0631 \u064A\u063A\u064A\u0651\u0631 \u0643\u0644 \u0627\u0633\u062A\u062E\u062F\u0627\u0645\u0627\u062A\u0647 \u062F\u0641\u0639\u0629 \u0648\u0627\u062D\u062F\u0629.",
|
|
74
|
+
aliasesProjectHint: "\u062A\u0623\u062A\u064A \u0623\u0633\u0645\u0627\u0621 \u0647\u0630\u0627 \u0627\u0644\u0645\u0634\u0631\u0648\u0639 \u0623\u0648\u0644\u064B\u0627\u060C \u0648\u062A\u0643\u0645\u0644 \u0623\u0633\u0645\u0627\u0621 \u0627\u0644\u0645\u0648\u0642\u0639 \u0627\u0644\u0628\u0627\u0642\u064A. \u064A\u0634\u064A\u0631 \u0643\u0644 \u0645\u0646\u0647\u0627 \u0625\u0644\u0649 \u0646\u0645\u0648\u0630\u062C \u064A\u0645\u0643\u0646 \u0644\u0644\u0645\u0634\u0631\u0648\u0639 \u0627\u0633\u062A\u062E\u062F\u0627\u0645\u0647.",
|
|
75
|
+
alias: "\u0627\u0644\u0627\u0633\u0645 \u0627\u0644\u0645\u0633\u062A\u0639\u0627\u0631",
|
|
76
|
+
pickModel: "\u0627\u062E\u062A\u0631 \u0646\u0645\u0648\u0630\u062C\u064B\u0627\u2026",
|
|
77
|
+
removeAlias: "\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0627\u0633\u0645 \u0627\u0644\u0645\u0633\u062A\u0639\u0627\u0631 {name}",
|
|
78
|
+
noAliases: "\u0644\u0627 \u0623\u0633\u0645\u0627\u0621 \u0645\u0633\u062A\u0639\u0627\u0631\u0629 \u062E\u0627\u0635\u0629 \u0628\u0647.",
|
|
79
|
+
addAlias: "\u0625\u0636\u0627\u0641\u0629 \u0627\u0633\u0645 \u0645\u0633\u062A\u0639\u0627\u0631",
|
|
80
|
+
noUsable: "\u0644\u0627 \u064A\u0648\u062C\u062F \u0646\u0645\u0648\u0630\u062C \u064A\u0639\u0645\u0644 \u0648\u0645\u0641\u062A\u0648\u062D \u0647\u0646\u0627 \u0628\u0639\u062F.",
|
|
81
|
+
fromSite: "\u0645\u0646 \u0627\u0644\u0645\u0648\u0642\u0639",
|
|
82
|
+
notOpenHere: "\u063A\u064A\u0631 \u0645\u0641\u062A\u0648\u062D \u0644\u0647\u0630\u0627 \u0627\u0644\u0645\u0634\u0631\u0648\u0639\u060C \u0641\u0644\u0627 \u064A\u062C\u064A\u0628 \u0647\u0646\u0627",
|
|
83
|
+
accessTitle: "\u0645\u0627 \u064A\u0645\u0643\u0646 \u0644\u0643\u0644 \u0645\u0634\u0631\u0648\u0639 \u0627\u0633\u062A\u062E\u062F\u0627\u0645\u0647",
|
|
84
|
+
accessHint: "\u0644\u0627 \u064A\u0633\u062A\u062E\u062F\u0645 \u0627\u0644\u0645\u0634\u0631\u0648\u0639 \u0623\u064A \u0646\u0645\u0648\u0630\u062C \u062D\u062A\u0649 \u062A\u0641\u062A\u062D \u0644\u0647 \u0628\u0639\u0636\u0647\u0627. \u0648\u064A\u0645\u0643\u0646\u0643 \u0623\u064A\u0636\u064B\u0627 \u0627\u0644\u0633\u0645\u0627\u062D \u0644\u0645\u0633\u0624\u0648\u0644\u064A\u0647 \u0628\u0625\u0636\u0627\u0641\u0629 \u0627\u062A\u0635\u0627\u0644\u0627\u062A \u062E\u0627\u0635\u0629 \u0628\u0647\u060C \u0648\u0645\u0646\u062D\u0647 \u062D\u062F\u0648\u062F\u064B\u0627 \u0636\u0645\u0646 \u062D\u062F\u0648\u062F \u0627\u0644\u0645\u0648\u0642\u0639.",
|
|
85
|
+
findProject: "\u0627\u0644\u0628\u062D\u062B \u0639\u0646 \u0645\u0634\u0631\u0648\u0639",
|
|
86
|
+
noProjects: "\u0644\u0627 \u062A\u0648\u062C\u062F \u0645\u0634\u0627\u0631\u064A\u0639.",
|
|
87
|
+
project: "\u0627\u0644\u0645\u0634\u0631\u0648\u0639",
|
|
88
|
+
opened: "\u0627\u0644\u0646\u0645\u0627\u0630\u062C",
|
|
89
|
+
allModels: "\u0643\u0644 \u0646\u0645\u0648\u0630\u062C \u064A\u0639\u0645\u0644",
|
|
90
|
+
someModels: "{count, plural, zero {\u0644\u0627 \u0646\u0645\u0627\u0630\u062C} one {\u0646\u0645\u0648\u0630\u062C \u0648\u0627\u062D\u062F} two {\u0646\u0645\u0648\u0630\u062C\u0627\u0646} few {# \u0646\u0645\u0627\u0630\u062C} many {# \u0646\u0645\u0648\u0630\u062C\u064B\u0627} other {# \u0646\u0645\u0648\u0630\u062C}}",
|
|
91
|
+
noModelsOpen: "\u0644\u0627 \u0634\u064A\u0621",
|
|
92
|
+
ownConnections: "\u0627\u062A\u0635\u0627\u0644\u0627\u062A \u062E\u0627\u0635\u0629",
|
|
93
|
+
allowed: "\u0645\u0633\u0645\u0648\u062D",
|
|
94
|
+
notAllowed: "\u063A\u064A\u0631 \u0645\u0633\u0645\u0648\u062D",
|
|
95
|
+
accessFor: "\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A \u0644\u0640 {name}",
|
|
96
|
+
accessDialogHint: "\u0645\u0627 \u064A\u0645\u0643\u0646 \u0644\u0647\u0630\u0627 \u0627\u0644\u0645\u0634\u0631\u0648\u0639 \u0627\u0633\u062A\u062E\u062F\u0627\u0645\u0647\u060C \u0648\u062D\u062F\u0648\u062F\u0647. \u064A\u0631\u0627\u0647\u0627 \u0645\u0633\u0624\u0648\u0644\u0648\u0647 \u0641\u064A \u0635\u0641\u062D\u0629 \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A \u0644\u0644\u0645\u0634\u0631\u0648\u0639.",
|
|
97
|
+
openAll: "\u0643\u0644 \u0646\u0645\u0648\u0630\u062C \u064A\u0639\u0645\u0644\u060C \u0627\u0644\u0622\u0646 \u0648\u0644\u0627\u062D\u0642\u064B\u0627",
|
|
98
|
+
openSome: "\u0647\u0630\u0647 \u0627\u0644\u0646\u0645\u0627\u0630\u062C",
|
|
99
|
+
noModelsOn: "\u0644\u0627 \u064A\u0648\u062C\u062F \u0646\u0645\u0648\u0630\u062C \u064A\u0639\u0645\u0644 \u0628\u0639\u062F.",
|
|
100
|
+
allowOwn: "\u064A\u0645\u0643\u0646 \u0644\u0645\u0633\u0624\u0648\u0644\u064A\u0647 \u0625\u0636\u0627\u0641\u0629 \u0627\u062A\u0635\u0627\u0644\u0627\u062A \u0646\u0645\u0627\u0630\u062C \u062E\u0627\u0635\u0629 \u0628\u0647",
|
|
101
|
+
projectLimits: "\u062D\u062F\u0648\u062F \u0627\u0644\u0645\u0634\u0631\u0648\u0639",
|
|
102
|
+
projectLimitsHint: "\u062A\u0646\u0637\u0628\u0642 \u0636\u0645\u0646 \u062D\u062F\u0648\u062F \u0627\u0644\u0645\u0648\u0642\u0639: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0633\u0639 \u0627\u0644\u0627\u0633\u062A\u062F\u0639\u0627\u0621 \u0644\u0644\u0627\u062B\u0646\u064A\u0646.",
|
|
103
|
+
siteLimitsTitle: "\u062D\u062F\u0648\u062F \u0627\u0644\u0645\u0648\u0642\u0639",
|
|
104
|
+
siteLimitsHint: "\u062A\u0646\u0637\u0628\u0642 \u0639\u0644\u0649 \u0643\u0644 \u0627\u0633\u062A\u062F\u0639\u0627\u0621\u060C \u0628\u0645\u0627 \u0641\u064A \u0630\u0644\u0643 \u0627\u0633\u062A\u062F\u0639\u0627\u0621\u0627\u062A \u0627\u0644\u0645\u0634\u0627\u0631\u064A\u0639. \u064A\u062D\u062C\u0632 \u0627\u0644\u0627\u0633\u062A\u062F\u0639\u0627\u0621 \u0645\u0627 \u0642\u062F \u064A\u0646\u0641\u0642\u0647 \u0642\u0628\u0644 \u062A\u0634\u063A\u064A\u0644\u0647\u060C \u0641\u0644\u0627 \u062A\u062A\u062C\u0627\u0648\u0632 \u0627\u0644\u0627\u0633\u062A\u062F\u0639\u0627\u0621\u0627\u062A \u0627\u0644\u0645\u062A\u0632\u0627\u0645\u0646\u0629 \u0627\u0644\u062D\u062F \u0645\u0639\u064B\u0627.",
|
|
105
|
+
limitKind: "\u0627\u0644\u062D\u062F",
|
|
106
|
+
limitPeriod: "\u0644\u0643\u0644",
|
|
107
|
+
limitAmount: "\u0627\u0644\u0645\u0642\u062F\u0627\u0631",
|
|
108
|
+
perReply: "\u0643\u0644 \u0631\u062F",
|
|
109
|
+
removeLimit: "\u0625\u0632\u0627\u0644\u0629 \u0647\u0630\u0627 \u0627\u0644\u062D\u062F",
|
|
110
|
+
noLimits: "\u0644\u0627 \u062D\u062F\u0648\u062F.",
|
|
111
|
+
addLimit: "\u0625\u0636\u0627\u0641\u0629 \u062D\u062F",
|
|
112
|
+
"kinds.cost": "\u0627\u0644\u0643\u0644\u0641\u0629",
|
|
113
|
+
"kinds.tokens": "\u0627\u0644\u0631\u0645\u0648\u0632",
|
|
114
|
+
"kinds.requests": "\u0627\u0644\u0637\u0644\u0628\u0627\u062A",
|
|
115
|
+
"kinds.call-tokens": "\u0627\u0644\u0631\u0645\u0648\u0632 \u0644\u0643\u0644 \u0631\u062F",
|
|
116
|
+
"periods.minute": "\u062F\u0642\u064A\u0642\u0629",
|
|
117
|
+
"periods.day": "\u064A\u0648\u0645",
|
|
118
|
+
"periods.month": "\u0634\u0647\u0631",
|
|
119
|
+
limitText: "{kind} \u0644\u0643\u0644 {period}: {amount}",
|
|
120
|
+
limitCallTokens: "\u0627\u0644\u0631\u0645\u0648\u0632 \u0644\u0643\u0644 \u0631\u062F: {amount}",
|
|
121
|
+
usageTitle: "\u0627\u0644\u0627\u0633\u062A\u062E\u062F\u0627\u0645",
|
|
122
|
+
usageTotal: "\u0627\u0644\u0643\u0644\u0641\u0629 \u0627\u0644\u0625\u062C\u0645\u0627\u0644\u064A\u0629: {cost}",
|
|
123
|
+
by: "\u0627\u0644\u062A\u062C\u0645\u064A\u0639 \u062D\u0633\u0628",
|
|
124
|
+
"byOptions.project": "\u0627\u0644\u0645\u0634\u0631\u0648\u0639",
|
|
125
|
+
"byOptions.model": "\u0627\u0644\u0646\u0645\u0648\u0630\u062C",
|
|
126
|
+
"byOptions.purpose": "\u0627\u0644\u063A\u0631\u0636",
|
|
127
|
+
"byOptions.account": "\u0627\u0644\u0634\u062E\u0635",
|
|
128
|
+
month: "\u0627\u0644\u0634\u0647\u0631",
|
|
129
|
+
noUsage: "\u0644\u0627 \u0627\u0633\u062A\u062F\u0639\u0627\u0621\u0627\u062A \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u0634\u0647\u0631.",
|
|
130
|
+
siteCalls: "\u0627\u0644\u0645\u0648\u0642\u0639 (\u0628\u0644\u0627 \u0645\u0634\u0631\u0648\u0639)",
|
|
131
|
+
calls: "\u0627\u0644\u0627\u0633\u062A\u062F\u0639\u0627\u0621\u0627\u062A",
|
|
132
|
+
tokensIn: "\u0631\u0645\u0648\u0632 \u0627\u0644\u0625\u062F\u062E\u0627\u0644",
|
|
133
|
+
tokensOut: "\u0631\u0645\u0648\u0632 \u0627\u0644\u0625\u062E\u0631\u0627\u062C",
|
|
134
|
+
cost: "\u0627\u0644\u0643\u0644\u0641\u0629",
|
|
135
|
+
refused: "\u0645\u0631\u0641\u0648\u0636\u0629",
|
|
136
|
+
failed: "\u0641\u0627\u0634\u0644\u0629",
|
|
137
|
+
recentTitle: "\u0623\u062D\u062F\u062B \u0627\u0644\u0627\u0633\u062A\u062F\u0639\u0627\u0621\u0627\u062A",
|
|
138
|
+
at: "\u0627\u0644\u0648\u0642\u062A",
|
|
139
|
+
who: "\u0645\u0646",
|
|
140
|
+
purpose: "\u0627\u0644\u063A\u0631\u0636",
|
|
141
|
+
tokens: "\u0627\u0644\u0631\u0645\u0648\u0632 \u0625\u062F\u062E\u0627\u0644 / \u0625\u062E\u0631\u0627\u062C",
|
|
142
|
+
outcome: "\u0627\u0644\u0646\u062A\u064A\u062C\u0629",
|
|
143
|
+
"outcomes.ok": "\u0623\u064F\u062C\u064A\u0628",
|
|
144
|
+
"outcomes.refused": "\u0631\u064F\u0641\u0636",
|
|
145
|
+
"outcomes.failed": "\u0641\u0634\u0644",
|
|
146
|
+
"outcomes.reserved": "\u0642\u064A\u062F \u0627\u0644\u062A\u0634\u063A\u064A\u0644",
|
|
147
|
+
tryTitle: "\u062A\u062C\u0631\u0628\u0629 \u0627\u0633\u0645 \u0645\u0633\u062A\u0639\u0627\u0631",
|
|
148
|
+
tryHint: "\u0627\u0633\u062A\u062F\u0639\u0627\u0621 \u0642\u0635\u064A\u0631 \u0628\u0627\u0633\u0645\u0643\u060C \u0639\u0628\u0631 \u0627\u0644\u0635\u0644\u0627\u062D\u064A\u0627\u062A \u0648\u0627\u0644\u062D\u062F\u0648\u062F \u0646\u0641\u0633\u0647\u0627 \u0644\u0623\u064A \u0627\u0633\u062A\u062F\u0639\u0627\u0621. \u0648\u064A\u064F\u0633\u062C\u064E\u0651\u0644 \u0641\u064A \u0627\u0644\u0633\u062C\u0644.",
|
|
149
|
+
prompt: "\u0627\u0644\u0637\u0644\u0628",
|
|
150
|
+
run: "\u0627\u0633\u0623\u0644",
|
|
151
|
+
answered: "{model} \xB7 {input} \u0631\u0645\u0632 \u0625\u062F\u062E\u0627\u0644\u060C {output} \u0625\u062E\u0631\u0627\u062C \xB7 \u0627\u0644\u0643\u0644\u0641\u0629 {cost}",
|
|
152
|
+
projectSubtitle: "\u0627\u0644\u0646\u0645\u0627\u0630\u062C \u0627\u0644\u062A\u064A \u064A\u0645\u0643\u0646 \u0644\u0647\u0630\u0627 \u0627\u0644\u0645\u0634\u0631\u0648\u0639 \u0627\u0633\u062A\u062E\u062F\u0627\u0645\u0647\u0627\u060C \u0648\u0623\u0633\u0645\u0627\u0624\u0647 \u0627\u0644\u0645\u0633\u062A\u0639\u0627\u0631\u0629\u060C \u0648\u062D\u062F\u0648\u062F\u0647\u060C \u0648\u0643\u0644\u0641\u0629 \u0627\u0633\u062A\u062F\u0639\u0627\u0621\u0627\u062A\u0647.",
|
|
153
|
+
projectAccessTitle: "\u0645\u0627 \u064A\u0633\u0645\u062D \u0628\u0647 \u0627\u0644\u0645\u0648\u0642\u0639",
|
|
154
|
+
projectAccessHint: "\u064A\u0641\u062A\u062D \u0645\u0633\u0624\u0648\u0644 \u0627\u0644\u0645\u0648\u0642\u0639 \u0627\u0644\u0646\u0645\u0627\u0630\u062C \u0644\u0644\u0645\u0634\u0631\u0648\u0639 \u0648\u064A\u062D\u062F\u062F \u062D\u062F\u0648\u062F\u0647.",
|
|
155
|
+
ownAllowed: "\u064A\u0645\u0643\u0646 \u0644\u0645\u0633\u0624\u0648\u0644\u064A\u0647 \u0625\u0636\u0627\u0641\u0629 \u0627\u062A\u0635\u0627\u0644\u0627\u062A \u0646\u0645\u0627\u0630\u062C \u062E\u0627\u0635\u0629 \u0628\u0647 (\u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0645\u0634\u0631\u0648\u0639 \u203A \u0627\u0644\u0627\u062A\u0635\u0627\u0644\u0627\u062A).",
|
|
156
|
+
ownNotAllowed: "\u0644\u0627 \u064A\u0645\u0643\u0646\u0647 \u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0627\u062A\u0635\u0627\u0644\u0627\u062A \u0646\u0645\u0627\u0630\u062C \u062E\u0627\u0635\u0629 \u0628\u0647.",
|
|
157
|
+
projectModelsTitle: "\u0627\u0644\u0646\u0645\u0627\u0630\u062C \u0627\u0644\u0645\u062A\u0627\u062D\u0629 \u0644\u0647",
|
|
158
|
+
projectModelsHint: "\u0646\u0645\u0627\u0630\u062C \u0627\u0644\u0645\u0648\u0642\u0639 \u0627\u0644\u0645\u0641\u062A\u0648\u062D\u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u0645\u0634\u0631\u0648\u0639.",
|
|
159
|
+
projectModelsOwnHint: "\u0646\u0645\u0627\u0630\u062C \u0627\u0644\u0645\u0648\u0642\u0639 \u0627\u0644\u0645\u0641\u062A\u0648\u062D\u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u0645\u0634\u0631\u0648\u0639\u060C \u0648\u0646\u0645\u0627\u0630\u062C \u0627\u062A\u0635\u0627\u0644\u0627\u062A\u0647 \u0627\u0644\u062E\u0627\u0635\u0629 \u0627\u0644\u062A\u064A \u062A\u0634\u063A\u0651\u0644\u0647\u0627 \u0648\u062A\u0633\u0639\u0651\u0631\u0647\u0627 \u0647\u0646\u0627.",
|
|
160
|
+
projectLimitsReadHint: "\u064A\u062D\u062F\u062F\u0647\u0627 \u0645\u0633\u0624\u0648\u0644\u0648 \u0627\u0644\u0645\u0648\u0642\u0639. \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0633\u0639 \u0627\u0644\u0627\u0633\u062A\u062F\u0639\u0627\u0621 \u0644\u062D\u062F\u0648\u062F \u0647\u0630\u0627 \u0627\u0644\u0645\u0634\u0631\u0648\u0639 \u0648\u062D\u062F\u0648\u062F \u0627\u0644\u0645\u0648\u0642\u0639.",
|
|
161
|
+
thisProject: "\u0647\u0630\u0627 \u0627\u0644\u0645\u0634\u0631\u0648\u0639",
|
|
162
|
+
theSite: "\u0627\u0644\u0645\u0648\u0642\u0639",
|
|
163
|
+
allowOwnSkills: "\u064A\u0645\u0643\u0646 \u0644\u0645\u0633\u0624\u0648\u0644\u064A\u0647 \u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0645\u0633\u062A\u0648\u062F\u0639 \u0645\u0647\u0627\u0631\u0627\u062A \u062E\u0627\u0635 \u0628\u0647\u0645",
|
|
164
|
+
ownSkills: "\u0645\u0647\u0627\u0631\u0627\u062A \u062E\u0627\u0635\u0629",
|
|
165
|
+
exportsTitle: "\u062A\u0635\u062F\u064A\u0631 \u0644\u0644\u062F\u0639\u0645",
|
|
166
|
+
exportsHint: "\u0627\u0633\u062A\u062F\u0639\u0627\u0621\u0627\u062A \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A \u0641\u064A \u0645\u062F\u0629 \u0645\u0627\u060C \u0644\u0625\u0631\u0633\u0627\u0644\u0647\u0627 \u0625\u0644\u0649 \u0627\u0644\u062F\u0639\u0645 \u062D\u064A\u0646 \u062A\u062E\u0637\u0626 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A: \u0633\u0637\u0631 \u0644\u0643\u0644 \u0627\u0633\u062A\u062F\u0639\u0627\u0621\u060C \u0645\u0639 \u0637\u0644\u0628\u0647 \u0648\u0631\u062F\u0651\u0647 \u062D\u064A\u062B \u064A\u062D\u062A\u0641\u0638 \u0628\u0647\u0645\u0627 \u0647\u0630\u0627 \u0627\u0644\u0645\u0648\u0642\u0639. \u0633\u062A\u064F\u0633\u0623\u0644 \u0639\u0646 \u0643\u0644\u0645\u0629 \u0645\u0631\u0648\u0631\u0643\u060C \u0648\u064A\u064F\u0633\u062C\u064E\u0651\u0644 \u0630\u0644\u0643 \u0641\u064A \u0633\u062C\u0644 \u0627\u0644\u0623\u0645\u0627\u0646\u060C \u0648\u064A\u064F\u062D\u0630\u0641 \u0643\u0644 \u062A\u0635\u062F\u064A\u0631 \u0628\u0639\u062F \u0623\u0633\u0628\u0648\u0639.",
|
|
167
|
+
exportFrom: "\u0645\u0646",
|
|
168
|
+
exportTo: "\u0625\u0644\u0649",
|
|
169
|
+
exportCreate: "\u062A\u0635\u062F\u064A\u0631",
|
|
170
|
+
exportPeriodHint: "\u064A\u063A\u0637\u064A \u0627\u0644\u062A\u0635\u062F\u064A\u0631 \u0645\u0646 \u064A\u0648\u0645 \u0625\u0644\u0649 31 \u064A\u0648\u0645\u064B\u0627.",
|
|
171
|
+
noExports: "\u0644\u0627 \u064A\u0648\u062C\u062F \u062A\u0635\u062F\u064A\u0631 \u0645\u062D\u0641\u0648\u0638.",
|
|
172
|
+
exportPeriod: "\u0627\u0644\u0645\u062F\u0629",
|
|
173
|
+
exportPrompts: "{count, plural, =0 {\u0628\u0644\u0627 \u0637\u0644\u0628\u0627\u062A} one {# \u0645\u0639 \u0637\u0644\u0628\u0647} other {# \u0645\u0639 \u0637\u0644\u0628\u0627\u062A\u0647\u0627}}",
|
|
174
|
+
exportTruncated: "\u062A\u0648\u0642\u0651\u0641 \u0639\u0646\u062F \u0623\u0642\u0635\u0649 \u0645\u0627 \u064A\u062A\u0651\u0633\u0639 \u0644\u0647 \u0627\u0644\u062A\u0635\u062F\u064A\u0631",
|
|
175
|
+
exportMade: "\u0623\u064F\u0646\u0634\u0626",
|
|
176
|
+
exportExpires: "\u064A\u064F\u062D\u0630\u0641",
|
|
177
|
+
exportDownload: "\u062A\u0646\u0632\u064A\u0644",
|
|
178
|
+
exportDelete: "\u062D\u0630\u0641",
|
|
179
|
+
exportDeleteTitle: "\u0623\u062A\u062D\u0630\u0641 \u0647\u0630\u0627 \u0627\u0644\u062A\u0635\u062F\u064A\u0631\u061F",
|
|
180
|
+
exportDeleteHint: "\u064A\u064F\u062D\u0630\u0641 \u0645\u0644\u0641\u0647 \u0627\u0644\u0622\u0646\u060C \u0642\u0628\u0644 \u0627\u0646\u0642\u0636\u0627\u0621 \u0623\u0633\u0628\u0648\u0639\u0647."
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
// src/areas/ai/texts/en.json
|
|
184
|
+
var en_default = {
|
|
185
|
+
pageTitle: "AI",
|
|
186
|
+
pageSubtitle: "The models {product} may call, the aliases skills and steps name, what each project may use, limits, and what it all costs. Providers are connections.",
|
|
187
|
+
"tabs.models": "Models",
|
|
188
|
+
"tabs.aliases": "Aliases",
|
|
189
|
+
"tabs.access": "Projects",
|
|
190
|
+
"tabs.limits": "Limits",
|
|
191
|
+
"tabs.usage": "Usage",
|
|
192
|
+
"tabs.try": "Try",
|
|
193
|
+
"tabs.exports": "Exports",
|
|
194
|
+
modelsTitle: "Models",
|
|
195
|
+
modelsHint: "Each provider connection's models, found by asking it. A model is off until you turn it on; give it prices so limits can be in money.",
|
|
196
|
+
noProviders: "No model provider is connected yet. Add an Anthropic or OpenAI-compatible connection under Administration \u203A Connections.",
|
|
197
|
+
connection: "Connection",
|
|
198
|
+
findModels: "Find its models",
|
|
199
|
+
found: "{name} offers {count, plural, one {# model} other {# models}}.",
|
|
200
|
+
noModels: "No models yet.",
|
|
201
|
+
noModelsFind: "No models yet. Find a connection's models to start.",
|
|
202
|
+
model: "Model",
|
|
203
|
+
can: "What it can do",
|
|
204
|
+
tools: "Tools",
|
|
205
|
+
images: "Images",
|
|
206
|
+
structured: "Structured answers",
|
|
207
|
+
toolsLong: "Calls tools",
|
|
208
|
+
imagesLong: "Reads images",
|
|
209
|
+
structuredLong: "Answers in a given JSON shape",
|
|
210
|
+
prices: "Prices",
|
|
211
|
+
price: "{input} in, {output} out, per million tokens",
|
|
212
|
+
noPrice: "No price: its calls count as free",
|
|
213
|
+
priceSetAt: "Set {at}",
|
|
214
|
+
state: "State",
|
|
215
|
+
on: "On",
|
|
216
|
+
off: "Off",
|
|
217
|
+
edit: "Edit",
|
|
218
|
+
editModel: "Model {name}",
|
|
219
|
+
modelOn: "On: aliases may name it and projects may be given it",
|
|
220
|
+
name: "Name",
|
|
221
|
+
nameHint: "What people see; its id unless you rename it.",
|
|
222
|
+
context: "Context size (tokens)",
|
|
223
|
+
optional: "(optional)",
|
|
224
|
+
inputPrice: "Input price",
|
|
225
|
+
outputPrice: "Output price",
|
|
226
|
+
perMillion: "Per million tokens, in the site's currency.",
|
|
227
|
+
save: "Save",
|
|
228
|
+
saved: "Saved.",
|
|
229
|
+
aliasesTitle: "Aliases",
|
|
230
|
+
aliasesHint: "What skills and workflow steps name, such as fast or smart. Pointing an alias at another model changes every use at once.",
|
|
231
|
+
aliasesProjectHint: "This project's own aliases come first; the site's fill in the rest. Each names a model the project may use.",
|
|
232
|
+
alias: "Alias",
|
|
233
|
+
pickModel: "Choose a model\u2026",
|
|
234
|
+
removeAlias: "Remove alias {name}",
|
|
235
|
+
noAliases: "No aliases of its own.",
|
|
236
|
+
addAlias: "Add an alias",
|
|
237
|
+
noUsable: "No model is on and open here yet.",
|
|
238
|
+
fromSite: "From the site",
|
|
239
|
+
notOpenHere: "not open to this project, so it doesn't answer here",
|
|
240
|
+
accessTitle: "What each project may use",
|
|
241
|
+
accessHint: "A project uses no model until you open some to it. You can also let its admins add connections of their own, and give it limits inside the site's.",
|
|
242
|
+
findProject: "Find a project",
|
|
243
|
+
noProjects: "No projects.",
|
|
244
|
+
project: "Project",
|
|
245
|
+
opened: "Models",
|
|
246
|
+
allModels: "Every model that's on",
|
|
247
|
+
someModels: "{count, plural, one {# model} other {# models}}",
|
|
248
|
+
noModelsOpen: "None",
|
|
249
|
+
ownConnections: "Own connections",
|
|
250
|
+
allowed: "Allowed",
|
|
251
|
+
notAllowed: "Not allowed",
|
|
252
|
+
accessFor: "AI for {name}",
|
|
253
|
+
accessDialogHint: "What this project may use, and its limits. Its admins see these on the project's AI page.",
|
|
254
|
+
openAll: "Every model that's on, now and later",
|
|
255
|
+
openSome: "These models",
|
|
256
|
+
noModelsOn: "No model is on yet.",
|
|
257
|
+
allowOwn: "Its admins may add model connections of their own",
|
|
258
|
+
projectLimits: "The project's limits",
|
|
259
|
+
projectLimitsHint: "They apply inside the site's: a call has to fit both.",
|
|
260
|
+
siteLimitsTitle: "The site's limits",
|
|
261
|
+
siteLimitsHint: "They apply to every call, a project's included. A call reserves what it may spend before it runs, so calls at once can't go over together.",
|
|
262
|
+
limitKind: "Limit",
|
|
263
|
+
limitPeriod: "Per",
|
|
264
|
+
limitAmount: "Amount",
|
|
265
|
+
perReply: "Each reply",
|
|
266
|
+
removeLimit: "Remove this limit",
|
|
267
|
+
noLimits: "No limits.",
|
|
268
|
+
addLimit: "Add a limit",
|
|
269
|
+
"kinds.cost": "Cost",
|
|
270
|
+
"kinds.tokens": "Tokens",
|
|
271
|
+
"kinds.requests": "Requests",
|
|
272
|
+
"kinds.call-tokens": "Tokens per reply",
|
|
273
|
+
"periods.minute": "minute",
|
|
274
|
+
"periods.day": "day",
|
|
275
|
+
"periods.month": "month",
|
|
276
|
+
limitText: "{kind} per {period}: {amount}",
|
|
277
|
+
limitCallTokens: "Tokens per reply: {amount}",
|
|
278
|
+
usageTitle: "Usage",
|
|
279
|
+
usageTotal: "Total cost: {cost}",
|
|
280
|
+
by: "Sum by",
|
|
281
|
+
"byOptions.project": "Project",
|
|
282
|
+
"byOptions.model": "Model",
|
|
283
|
+
"byOptions.purpose": "Purpose",
|
|
284
|
+
"byOptions.account": "Person",
|
|
285
|
+
month: "Month",
|
|
286
|
+
noUsage: "No calls in this month.",
|
|
287
|
+
siteCalls: "The site (no project)",
|
|
288
|
+
calls: "Calls",
|
|
289
|
+
tokensIn: "Tokens in",
|
|
290
|
+
tokensOut: "Tokens out",
|
|
291
|
+
cost: "Cost",
|
|
292
|
+
refused: "Refused",
|
|
293
|
+
failed: "Failed",
|
|
294
|
+
recentTitle: "Latest calls",
|
|
295
|
+
at: "When",
|
|
296
|
+
who: "Who",
|
|
297
|
+
purpose: "Purpose",
|
|
298
|
+
tokens: "Tokens in / out",
|
|
299
|
+
outcome: "Outcome",
|
|
300
|
+
"outcomes.ok": "Answered",
|
|
301
|
+
"outcomes.refused": "Refused",
|
|
302
|
+
"outcomes.failed": "Failed",
|
|
303
|
+
"outcomes.reserved": "Running",
|
|
304
|
+
tryTitle: "Try an alias",
|
|
305
|
+
tryHint: "A short call as you, through the same access and limits as any call. It's on the ledger.",
|
|
306
|
+
prompt: "Prompt",
|
|
307
|
+
run: "Ask",
|
|
308
|
+
answered: "{model} \xB7 {input} tokens in, {output} out \xB7 cost {cost}",
|
|
309
|
+
projectSubtitle: "The models this project may use, its aliases, its limits and what its calls cost.",
|
|
310
|
+
projectAccessTitle: "What the site allows",
|
|
311
|
+
projectAccessHint: "A site admin opens models to the project and sets its limits.",
|
|
312
|
+
ownAllowed: "Its admins may add model connections of their own (Project settings \u203A Connections).",
|
|
313
|
+
ownNotAllowed: "It may not use model connections of its own.",
|
|
314
|
+
projectModelsTitle: "Models it may use",
|
|
315
|
+
projectModelsHint: "The site's models opened to this project.",
|
|
316
|
+
projectModelsOwnHint: "The site's models opened to this project, and its own connections' models, which you turn on and price here.",
|
|
317
|
+
projectLimitsReadHint: "Set by site admins. A call has to fit this project's limits and the site's.",
|
|
318
|
+
thisProject: "This project",
|
|
319
|
+
theSite: "The site",
|
|
320
|
+
allowOwnSkills: "Its admins may use a skills repository of their own",
|
|
321
|
+
ownSkills: "Own skills",
|
|
322
|
+
exportsTitle: "Exports for support",
|
|
323
|
+
exportsHint: "A period's AI calls, to send to support when answers go wrong: one line each, with its prompt and reply where this site keeps them. You'll be asked for your password, it's in the security log, and each export is deleted after a week.",
|
|
324
|
+
exportFrom: "From",
|
|
325
|
+
exportTo: "To",
|
|
326
|
+
exportCreate: "Export",
|
|
327
|
+
exportPeriodHint: "An export covers 1 to 31 days.",
|
|
328
|
+
noExports: "No exports kept.",
|
|
329
|
+
exportPeriod: "Period",
|
|
330
|
+
exportPrompts: "{count, plural, =0 {no prompts} one {# with its prompt} other {# with their prompts}}",
|
|
331
|
+
exportTruncated: "Stopped at the most one export holds",
|
|
332
|
+
exportMade: "Made",
|
|
333
|
+
exportExpires: "Deleted",
|
|
334
|
+
exportDownload: "Download",
|
|
335
|
+
exportDelete: "Delete",
|
|
336
|
+
exportDeleteTitle: "Delete this export?",
|
|
337
|
+
exportDeleteHint: "Its file goes now, before its week is up."
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
// src/areas/ai/texts.ts
|
|
341
|
+
var useAiTexts = createAreaTexts("ai", { en: en_default, ar: ar_default });
|
|
342
|
+
|
|
343
|
+
// src/areas/ai/types.ts
|
|
344
|
+
var num = (value) => value == null || value === "" ? 0 : typeof value === "number" ? value : Number(value);
|
|
345
|
+
var scopeQuery = (scopeId, joiner = "?") => scopeId ? `${joiner}scopeId=${encodeURIComponent(scopeId)}` : "";
|
|
346
|
+
|
|
347
|
+
// src/areas/ai/LimitsEditor.tsx
|
|
348
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
349
|
+
var LIMIT_KINDS = ["cost", "tokens", "requests", "call-tokens"];
|
|
350
|
+
var LIMIT_PERIODS = ["minute", "day", "month"];
|
|
351
|
+
var editableLimit = (l) => (l.kind === "total" || l.kind === "call-tokens") && !l.accountId && !l.groupId;
|
|
352
|
+
var limitRow = (l) => l.kind === "call-tokens" ? { kind: "call-tokens", period: "", amount: String(num(l.amount)) } : { kind: l.measure ?? "cost", period: l.period || "day", amount: String(num(l.amount)) };
|
|
353
|
+
var limitInput = (r) => r.kind === "call-tokens" ? { kind: "call-tokens", period: "", measure: "tokens", amount: Number(r.amount || 0) } : { kind: "total", period: r.period || "day", measure: r.kind, amount: Number(r.amount || 0) };
|
|
354
|
+
async function saveLimits(request, scopeId, before, rows) {
|
|
355
|
+
const same = (a, b) => a.kind === b.kind && a.period === b.period && Number(a.amount || 0) === Number(b.amount || 0);
|
|
356
|
+
const left = [...rows];
|
|
357
|
+
const gone = [];
|
|
358
|
+
for (const l of before.filter(editableLimit)) {
|
|
359
|
+
const i = left.findIndex((r) => same(r, limitRow(l)));
|
|
360
|
+
if (i >= 0) left.splice(i, 1);
|
|
361
|
+
else gone.push(l);
|
|
362
|
+
}
|
|
363
|
+
for (const l of gone) await request(`/limits/${encodeURIComponent(l.id)}`, { method: "DELETE" });
|
|
364
|
+
for (const r of left) await request(`/limits${scopeQuery(scopeId)}`, { method: "POST", body: limitInput(r) });
|
|
365
|
+
}
|
|
366
|
+
function useLimitText() {
|
|
367
|
+
const t = useAiTexts();
|
|
368
|
+
const fmt = useFormatters();
|
|
369
|
+
return (l) => {
|
|
370
|
+
const r = limitRow(l);
|
|
371
|
+
return r.kind === "call-tokens" ? t("limitCallTokens", { amount: fmt.number(num(l.amount)) }) : t("limitText", { kind: t(`kinds.${r.kind}`), period: t(`periods.${r.period}`), amount: fmt.number(num(l.amount), { maximumFractionDigits: 6 }) });
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function LimitsEditor({ limits, onSave, onChange, busy, error }) {
|
|
375
|
+
const t = useAiTexts();
|
|
376
|
+
const [draft, setDraftRows] = useState(null);
|
|
377
|
+
const rows = draft ?? limits.filter(editableLimit).map(limitRow);
|
|
378
|
+
const kinds = LIMIT_KINDS.map((k) => ({ value: k, label: t(`kinds.${k}`) }));
|
|
379
|
+
const periods = LIMIT_PERIODS.map((p) => ({ value: p, label: t(`periods.${p}`) }));
|
|
380
|
+
const setDraft = (next) => {
|
|
381
|
+
setDraftRows(next);
|
|
382
|
+
onChange?.(next);
|
|
383
|
+
};
|
|
384
|
+
const set = (i, change) => setDraft(rows.map((x, j) => j === i ? { ...x, ...change } : x));
|
|
385
|
+
async function save() {
|
|
386
|
+
if (!onSave) return;
|
|
387
|
+
await onSave(rows);
|
|
388
|
+
setDraftRows(null);
|
|
389
|
+
}
|
|
390
|
+
return /* @__PURE__ */ jsxs(Stack, { gap: "3", "data-testid": "ai-limits", children: [
|
|
391
|
+
/* @__PURE__ */ jsx(InlineAlert, { tone: "danger", children: error }),
|
|
392
|
+
rows.map((r, i) => /* @__PURE__ */ jsxs(HStack, { gap: "2", alignItems: "end", children: [
|
|
393
|
+
/* @__PURE__ */ jsx(Field, { label: i === 0 ? t("limitKind") : void 0, flex: "2", children: /* @__PURE__ */ jsx(
|
|
394
|
+
SelectField,
|
|
395
|
+
{
|
|
396
|
+
value: r.kind,
|
|
397
|
+
options: kinds,
|
|
398
|
+
"aria-label": t("limitKind"),
|
|
399
|
+
onChange: (e) => set(i, { kind: e.target.value, period: e.target.value === "call-tokens" ? "" : r.period || "day" })
|
|
400
|
+
}
|
|
401
|
+
) }),
|
|
402
|
+
/* @__PURE__ */ jsx(Field, { label: i === 0 ? t("limitPeriod") : void 0, flex: "1", children: r.kind === "call-tokens" ? /* @__PURE__ */ jsx(Text, { textStyle: "sm", color: "fg.muted", py: "2", children: t("perReply") }) : /* @__PURE__ */ jsx(SelectField, { value: r.period, options: periods, "aria-label": t("limitPeriod"), onChange: (e) => set(i, { period: e.target.value }) }) }),
|
|
403
|
+
/* @__PURE__ */ jsx(Field, { label: i === 0 ? t("limitAmount") : void 0, flex: "1", children: /* @__PURE__ */ jsx(Input, { type: "number", min: 0, step: "any", value: r.amount, dir: "ltr", "aria-label": t("limitAmount"), onChange: (e) => set(i, { amount: e.target.value }) }) }),
|
|
404
|
+
/* @__PURE__ */ jsx(IconButton, { "aria-label": t("removeLimit"), size: "sm", onClick: () => setDraft(rows.filter((_, j) => j !== i)), children: /* @__PURE__ */ jsx(Trash2, {}) })
|
|
405
|
+
] }, i)),
|
|
406
|
+
rows.length === 0 && /* @__PURE__ */ jsx(Text, { textStyle: "sm", color: "fg.muted", children: t("noLimits") }),
|
|
407
|
+
/* @__PURE__ */ jsxs(HStack, { children: [
|
|
408
|
+
/* @__PURE__ */ jsx(Button, { size: "sm", variant: "secondary", onClick: () => setDraft([...rows, { kind: "cost", period: "day", amount: "" }]), children: t("addLimit") }),
|
|
409
|
+
onSave && /* @__PURE__ */ jsx(Button, { size: "sm", loading: busy, disabled: draft === null, onClick: () => void save(), children: t("save") })
|
|
410
|
+
] })
|
|
411
|
+
] });
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// src/areas/ai/models.ts
|
|
415
|
+
var modelKey = (connectionId, model) => `${connectionId}:${model ?? ""}`;
|
|
416
|
+
function modelRows(connections) {
|
|
417
|
+
return connections.flatMap(
|
|
418
|
+
(c) => c.models.map((model) => {
|
|
419
|
+
const settings = c.modelSettings?.[model] ?? {};
|
|
420
|
+
const price = c.modelPrices?.[model];
|
|
421
|
+
const input = price ? num(price.input) : num(c.inputPrice);
|
|
422
|
+
const output = price ? num(price.output) : num(c.outputPrice);
|
|
423
|
+
const priced = price != null || input !== 0 || output !== 0;
|
|
424
|
+
return {
|
|
425
|
+
key: modelKey(c.id, model),
|
|
426
|
+
connectionId: c.id,
|
|
427
|
+
connection: c.name,
|
|
428
|
+
scopeId: c.scopeId ?? null,
|
|
429
|
+
modelId: model,
|
|
430
|
+
name: settings.name || model,
|
|
431
|
+
enabled: settings.enabled ?? true,
|
|
432
|
+
tools: settings.tools ?? true,
|
|
433
|
+
images: settings.images ?? false,
|
|
434
|
+
structuredOutput: settings.structuredOutput ?? c.structuredOutput,
|
|
435
|
+
contextTokens: settings.contextTokens == null ? null : num(settings.contextTokens),
|
|
436
|
+
inputPrice: priced ? input : null,
|
|
437
|
+
outputPrice: priced ? output : null,
|
|
438
|
+
priceSetAt: settings.priceSetAt ?? null
|
|
439
|
+
};
|
|
440
|
+
})
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
function withModel(c, model, settings, price) {
|
|
444
|
+
const modelPrices = { ...c.modelPrices ?? {} };
|
|
445
|
+
if (price) modelPrices[model] = { ...modelPrices[model], input: price.input, output: price.output };
|
|
446
|
+
else delete modelPrices[model];
|
|
447
|
+
return {
|
|
448
|
+
name: c.name,
|
|
449
|
+
provider: c.provider,
|
|
450
|
+
models: c.models,
|
|
451
|
+
dataClasses: c.dataClasses,
|
|
452
|
+
modelSettings: { ...c.modelSettings ?? {}, [model]: settings },
|
|
453
|
+
endpoint: c.endpoint,
|
|
454
|
+
labels: c.labels,
|
|
455
|
+
settings: c.settings,
|
|
456
|
+
inputPrice: c.inputPrice,
|
|
457
|
+
outputPrice: c.outputPrice,
|
|
458
|
+
modelPrices,
|
|
459
|
+
structuredOutput: c.structuredOutput,
|
|
460
|
+
enabled: c.enabled,
|
|
461
|
+
cacheWritePrice: c.cacheWritePrice,
|
|
462
|
+
cacheReadPrice: c.cacheReadPrice
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// src/areas/ai/AccessPanel.tsx
|
|
467
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
468
|
+
function useAllScopes() {
|
|
469
|
+
const host = useHost();
|
|
470
|
+
const [scopes, setScopes] = useState2(void 0);
|
|
471
|
+
const [error, setError] = useState2(null);
|
|
472
|
+
useEffect(() => {
|
|
473
|
+
let alive = true;
|
|
474
|
+
if (!host.scopes) {
|
|
475
|
+
setScopes([]);
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
host.scopes.search("").then((found) => alive && setScopes(found), (e) => alive && setError(e instanceof Error ? e.message : String(e)));
|
|
479
|
+
return () => {
|
|
480
|
+
alive = false;
|
|
481
|
+
};
|
|
482
|
+
}, [host]);
|
|
483
|
+
return { scopes, error };
|
|
484
|
+
}
|
|
485
|
+
function AccessPanel({ models }) {
|
|
486
|
+
const t = useAiTexts();
|
|
487
|
+
const list = useApiQuery("ai", "/scopes/access");
|
|
488
|
+
const { scopes, error: scopesError } = useAllScopes();
|
|
489
|
+
const extraCell = Boolean(useOptionalHost()?.slots?.["ai.access.cell"]);
|
|
490
|
+
const [search, setSearch] = useState2("");
|
|
491
|
+
const [editing, setEditing] = useState2(null);
|
|
492
|
+
const unnamed = useMemo(() => (list.data ?? []).map((a) => a.scopeId).filter((id) => !(scopes ?? []).some((s) => s.id === id)), [list.data, scopes]);
|
|
493
|
+
const names = useNames("scopes", unnamed);
|
|
494
|
+
const rows = useMemo(() => {
|
|
495
|
+
if (!list.data || !scopes) return void 0;
|
|
496
|
+
const access = new Map(list.data.map((a) => [a.scopeId, a]));
|
|
497
|
+
const listed = scopes.map((s) => ({ scopeId: s.id, name: s.name, code: s.code, access: access.get(s.id) }));
|
|
498
|
+
const more = unnamed.map((id) => ({ scopeId: id, name: names[id] ?? id, access: access.get(id) }));
|
|
499
|
+
return [...listed, ...more];
|
|
500
|
+
}, [list.data, scopes, unnamed, names]);
|
|
501
|
+
const needle = search.trim().toLowerCase();
|
|
502
|
+
const shown = rows?.filter((p) => !needle || `${p.name} ${p.code ?? ""}`.toLowerCase().includes(needle));
|
|
503
|
+
const opened = (a) => a?.allSiteModels ? t("allModels") : a?.siteModels.length ? t("someModels", { count: a.siteModels.length }) : t("noModelsOpen");
|
|
504
|
+
return /* @__PURE__ */ jsxs2(
|
|
505
|
+
Panel,
|
|
506
|
+
{
|
|
507
|
+
title: t("accessTitle"),
|
|
508
|
+
description: t("accessHint"),
|
|
509
|
+
flush: true,
|
|
510
|
+
"data-testid": "ai-access",
|
|
511
|
+
actions: /* @__PURE__ */ jsx2(SearchInput, { size: "sm", value: search, onChange: (e) => setSearch(e.target.value), placeholder: t("findProject"), "aria-label": t("findProject") }),
|
|
512
|
+
children: [
|
|
513
|
+
/* @__PURE__ */ jsx2(InlineAlert2, { tone: "danger", children: list.error ?? scopesError }),
|
|
514
|
+
/* @__PURE__ */ jsx2(
|
|
515
|
+
DataTable,
|
|
516
|
+
{
|
|
517
|
+
"aria-label": t("accessTitle"),
|
|
518
|
+
rows: shown,
|
|
519
|
+
loading: list.loading || scopes === void 0,
|
|
520
|
+
getRowId: (p) => p.scopeId,
|
|
521
|
+
empty: t("noProjects"),
|
|
522
|
+
columns: [
|
|
523
|
+
{
|
|
524
|
+
id: "project",
|
|
525
|
+
header: t("project"),
|
|
526
|
+
cell: (p) => /* @__PURE__ */ jsxs2(Stack2, { gap: "0", children: [
|
|
527
|
+
/* @__PURE__ */ jsx2(Text2, { fontWeight: "medium", children: p.name }),
|
|
528
|
+
p.code && /* @__PURE__ */ jsx2(Text2, { textStyle: "caption", color: "fg.muted", dir: "ltr", children: p.code })
|
|
529
|
+
] })
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
id: "models",
|
|
533
|
+
header: t("opened"),
|
|
534
|
+
cell: (p) => /* @__PURE__ */ jsx2(StatusPill, { tone: p.access?.allSiteModels || p.access?.siteModels.length ? "success" : "neutral", children: opened(p.access) })
|
|
535
|
+
},
|
|
536
|
+
{ id: "own", header: t("ownConnections"), cell: (p) => p.access?.mayConnect ? t("allowed") : t("notAllowed") },
|
|
537
|
+
...extraCell ? [{ id: "host", header: t("ownSkills"), cell: (p) => /* @__PURE__ */ jsx2(HostSlot, { name: "ai.access.cell", context: { scopeId: p.scopeId } }) }] : [],
|
|
538
|
+
{ id: "limits", header: t("tabs.limits"), numeric: true, cell: (p) => /* @__PURE__ */ jsx2(LimitCount, { scopeId: p.scopeId }) },
|
|
539
|
+
{ id: "edit", header: /* @__PURE__ */ jsx2(Text2, { srOnly: true, children: t("edit") }), align: "end", cell: (p) => /* @__PURE__ */ jsx2(Button2, { size: "sm", variant: "ghost", onClick: () => setEditing(p), children: t("edit") }) }
|
|
540
|
+
]
|
|
541
|
+
}
|
|
542
|
+
),
|
|
543
|
+
editing && /* @__PURE__ */ jsx2(AccessEditor, { scope: editing, models, onClose: () => setEditing(null), onSaved: async () => {
|
|
544
|
+
setEditing(null);
|
|
545
|
+
await list.reload();
|
|
546
|
+
} })
|
|
547
|
+
]
|
|
548
|
+
}
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
function LimitCount({ scopeId }) {
|
|
552
|
+
const fmt = useFormatters2();
|
|
553
|
+
const limits = useApiQuery("ai", `/limits${scopeQuery(scopeId)}`);
|
|
554
|
+
return /* @__PURE__ */ jsx2(Fragment, { children: limits.data ? fmt.number(limits.data.length) : "" });
|
|
555
|
+
}
|
|
556
|
+
function AccessEditor({ scope, models, onClose, onSaved }) {
|
|
557
|
+
const t = useAiTexts();
|
|
558
|
+
const request = useAreaRequest("ai");
|
|
559
|
+
const action = useApiAction();
|
|
560
|
+
const slots = useSlotSaves();
|
|
561
|
+
const limits = useApiQuery("ai", `/limits${scopeQuery(scope.scopeId)}`);
|
|
562
|
+
const usable = models.filter((m) => m.enabled);
|
|
563
|
+
const [all, setAll] = useState2(scope.access?.allSiteModels ?? false);
|
|
564
|
+
const [picked, setPicked] = useState2((scope.access?.siteModels ?? []).map((m) => modelKey(m.connectionId, m.model)));
|
|
565
|
+
const [own, setOwn] = useState2(scope.access?.mayConnect ?? false);
|
|
566
|
+
const [nextLimits, setNextLimits] = useState2(null);
|
|
567
|
+
async function save() {
|
|
568
|
+
const done = await action.run(async () => {
|
|
569
|
+
const body = {
|
|
570
|
+
allSiteModels: all,
|
|
571
|
+
siteModels: all ? [] : usable.filter((m) => picked.includes(m.key)).map((m) => ({ connectionId: m.connectionId, model: m.modelId })),
|
|
572
|
+
mayConnect: own
|
|
573
|
+
};
|
|
574
|
+
await request(`/scopes/${encodeURIComponent(scope.scopeId)}/access`, { method: "PUT", body });
|
|
575
|
+
if (nextLimits && limits.data) await saveLimits(request, scope.scopeId, limits.data, nextLimits);
|
|
576
|
+
await slots.run();
|
|
577
|
+
return true;
|
|
578
|
+
});
|
|
579
|
+
if (done) {
|
|
580
|
+
notify.success(t("saved"));
|
|
581
|
+
await onSaved();
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return /* @__PURE__ */ jsxs2(
|
|
585
|
+
FormDialog,
|
|
586
|
+
{
|
|
587
|
+
open: true,
|
|
588
|
+
onOpenChange: (open) => !open && onClose(),
|
|
589
|
+
title: t("accessFor", { name: scope.name }),
|
|
590
|
+
description: t("accessDialogHint"),
|
|
591
|
+
submitLabel: t("save"),
|
|
592
|
+
onSubmit: save,
|
|
593
|
+
busy: action.busy,
|
|
594
|
+
error: action.error,
|
|
595
|
+
size: "lg",
|
|
596
|
+
children: [
|
|
597
|
+
/* @__PURE__ */ jsx2(SwitchField, { label: t("openAll"), checked: all, onCheckedChange: setAll }),
|
|
598
|
+
!all && /* @__PURE__ */ jsxs2(Stack2, { gap: "1.5", role: "group", "aria-labelledby": "ai-access-models", children: [
|
|
599
|
+
/* @__PURE__ */ jsx2(Text2, { id: "ai-access-models", textStyle: "sm", fontWeight: "medium", children: t("openSome") }),
|
|
600
|
+
usable.map((m) => /* @__PURE__ */ jsx2(
|
|
601
|
+
CheckboxField,
|
|
602
|
+
{
|
|
603
|
+
label: `${m.name} \xB7 ${m.connection}`,
|
|
604
|
+
checked: picked.includes(m.key),
|
|
605
|
+
onCheckedChange: (c) => setPicked(c ? [...picked, m.key] : picked.filter((x) => x !== m.key))
|
|
606
|
+
},
|
|
607
|
+
m.key
|
|
608
|
+
)),
|
|
609
|
+
usable.length === 0 && /* @__PURE__ */ jsx2(Text2, { textStyle: "sm", color: "fg.muted", children: t("noModelsOn") })
|
|
610
|
+
] }),
|
|
611
|
+
/* @__PURE__ */ jsx2(SwitchField, { label: t("allowOwn"), checked: own, onCheckedChange: setOwn }),
|
|
612
|
+
/* @__PURE__ */ jsx2(HostSlot, { name: "ai.access.editor", context: { scopeId: scope.scopeId, register: slots.register } }),
|
|
613
|
+
/* @__PURE__ */ jsxs2(Stack2, { gap: "2", children: [
|
|
614
|
+
/* @__PURE__ */ jsx2(Text2, { textStyle: "sm", fontWeight: "medium", children: t("projectLimits") }),
|
|
615
|
+
/* @__PURE__ */ jsx2(Text2, { textStyle: "sm", color: "fg.muted", children: t("projectLimitsHint") }),
|
|
616
|
+
limits.data && /* @__PURE__ */ jsx2(LimitsEditor, { limits: limits.data, onChange: setNextLimits, error: limits.error })
|
|
617
|
+
] })
|
|
618
|
+
]
|
|
619
|
+
}
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// src/areas/ai/AliasesPanel.tsx
|
|
624
|
+
import { useMemo as useMemo2, useState as useState3 } from "react";
|
|
625
|
+
import { HStack as HStack2, Input as Input2, Stack as Stack3, Text as Text3 } from "@chakra-ui/react";
|
|
626
|
+
import { Trash2 as Trash22 } from "lucide-react";
|
|
627
|
+
import { Button as Button3, Field as Field2, IconButton as IconButton2, InlineAlert as InlineAlert3, notify as notify2, Panel as Panel2, SelectField as SelectField2, useApiAction as useApiAction2, useAreaRequest as useAreaRequest2 } from "@abpjs/ui";
|
|
628
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
629
|
+
var target = (key) => {
|
|
630
|
+
const at = key.indexOf(":");
|
|
631
|
+
const model = key.slice(at + 1);
|
|
632
|
+
return { connectionId: key.slice(0, at), model: model || null };
|
|
633
|
+
};
|
|
634
|
+
function AliasesPanel({ scopeId, aliases, inherited, models, onSaved }) {
|
|
635
|
+
const t = useAiTexts();
|
|
636
|
+
const request = useAreaRequest2("ai");
|
|
637
|
+
const action = useApiAction2();
|
|
638
|
+
const own = useMemo2(
|
|
639
|
+
() => (aliases ?? []).map((a) => ({ name: a.name, key: a.targets[0] ? modelKey(a.targets[0].connectionId, a.targets[0].model) : "", rest: a.targets.slice(1) })),
|
|
640
|
+
[aliases]
|
|
641
|
+
);
|
|
642
|
+
const [draft, setDraft] = useState3(null);
|
|
643
|
+
const rows = draft ?? own;
|
|
644
|
+
const usable = models.filter((m) => m.enabled);
|
|
645
|
+
const label = (key) => usable.find((m) => m.key === key) ?? models.find((m) => m.key === key);
|
|
646
|
+
const options = [{ value: "", label: t("pickModel") }, ...usable.map((m) => ({ value: m.key, label: `${m.name} \xB7 ${m.connection}` }))];
|
|
647
|
+
const shownInherited = (inherited ?? []).filter((a) => !rows.some((r) => r.name.trim().toLowerCase() === a.name));
|
|
648
|
+
async function save() {
|
|
649
|
+
const next = rows.map((r) => ({ ...r, name: r.name.trim().toLowerCase() }));
|
|
650
|
+
const done = await action.run(async () => {
|
|
651
|
+
for (const a of own) {
|
|
652
|
+
if (!next.some((r) => r.name === a.name)) await request(`/aliases/${encodeURIComponent(a.name)}${scopeQuery(scopeId)}`, { method: "DELETE" });
|
|
653
|
+
}
|
|
654
|
+
for (const r of next) {
|
|
655
|
+
const before = own.find((a) => a.name === r.name);
|
|
656
|
+
if (before && before.key === r.key) continue;
|
|
657
|
+
await request(`/aliases/${encodeURIComponent(r.name)}${scopeQuery(scopeId)}`, { method: "PUT", body: [target(r.key), ...r.rest] });
|
|
658
|
+
}
|
|
659
|
+
return true;
|
|
660
|
+
});
|
|
661
|
+
if (done) {
|
|
662
|
+
notify2.success(t("saved"));
|
|
663
|
+
setDraft(null);
|
|
664
|
+
await onSaved();
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
return /* @__PURE__ */ jsx3(
|
|
668
|
+
Panel2,
|
|
669
|
+
{
|
|
670
|
+
title: t("aliasesTitle"),
|
|
671
|
+
description: scopeId ? t("aliasesProjectHint") : t("aliasesHint"),
|
|
672
|
+
"data-testid": "ai-aliases",
|
|
673
|
+
actions: /* @__PURE__ */ jsx3(Button3, { size: "sm", onClick: () => void save(), loading: action.busy, disabled: draft === null, children: t("save") }),
|
|
674
|
+
children: /* @__PURE__ */ jsxs3(Stack3, { gap: "3", children: [
|
|
675
|
+
/* @__PURE__ */ jsx3(InlineAlert3, { tone: "danger", children: action.error }),
|
|
676
|
+
rows.map((r, i) => /* @__PURE__ */ jsxs3(HStack2, { gap: "2", alignItems: "end", children: [
|
|
677
|
+
/* @__PURE__ */ jsx3(Field2, { label: i === 0 ? t("alias") : void 0, flex: "1", children: /* @__PURE__ */ jsx3(
|
|
678
|
+
Input2,
|
|
679
|
+
{
|
|
680
|
+
value: r.name,
|
|
681
|
+
dir: "ltr",
|
|
682
|
+
maxLength: 40,
|
|
683
|
+
placeholder: "fast",
|
|
684
|
+
"aria-label": t("alias"),
|
|
685
|
+
onChange: (e) => setDraft(rows.map((x, j) => j === i ? { ...x, name: e.target.value } : x))
|
|
686
|
+
}
|
|
687
|
+
) }),
|
|
688
|
+
/* @__PURE__ */ jsx3(Field2, { label: i === 0 ? t("model") : void 0, flex: "2", children: /* @__PURE__ */ jsx3(
|
|
689
|
+
SelectField2,
|
|
690
|
+
{
|
|
691
|
+
value: r.key,
|
|
692
|
+
options,
|
|
693
|
+
"aria-label": t("model"),
|
|
694
|
+
onChange: (e) => setDraft(rows.map((x, j) => j === i ? { ...x, key: e.target.value } : x))
|
|
695
|
+
}
|
|
696
|
+
) }),
|
|
697
|
+
/* @__PURE__ */ jsx3(IconButton2, { "aria-label": t("removeAlias", { name: r.name || "\u2026" }), size: "sm", onClick: () => setDraft(rows.filter((_, j) => j !== i)), children: /* @__PURE__ */ jsx3(Trash22, {}) })
|
|
698
|
+
] }, i)),
|
|
699
|
+
rows.length === 0 && /* @__PURE__ */ jsx3(Text3, { textStyle: "sm", color: "fg.muted", children: t("noAliases") }),
|
|
700
|
+
/* @__PURE__ */ jsxs3(HStack2, { children: [
|
|
701
|
+
/* @__PURE__ */ jsx3(Button3, { size: "sm", variant: "secondary", onClick: () => setDraft([...rows, { name: "", key: usable[0]?.key ?? "", rest: [] }]), disabled: usable.length === 0, children: t("addAlias") }),
|
|
702
|
+
usable.length === 0 && /* @__PURE__ */ jsx3(Text3, { textStyle: "sm", color: "fg.muted", children: t("noUsable") })
|
|
703
|
+
] }),
|
|
704
|
+
shownInherited.length > 0 && /* @__PURE__ */ jsxs3(Stack3, { gap: "1", children: [
|
|
705
|
+
/* @__PURE__ */ jsx3(Text3, { textStyle: "sm", fontWeight: "medium", children: t("fromSite") }),
|
|
706
|
+
shownInherited.map((a) => {
|
|
707
|
+
const first = a.targets[0] ? modelKey(a.targets[0].connectionId, a.targets[0].model) : "";
|
|
708
|
+
const m = label(first);
|
|
709
|
+
return /* @__PURE__ */ jsxs3(Text3, { textStyle: "sm", children: [
|
|
710
|
+
/* @__PURE__ */ jsx3(Text3, { as: "span", fontFamily: "mono", dir: "ltr", children: a.name }),
|
|
711
|
+
" \u2192 ",
|
|
712
|
+
m?.name ?? a.targets[0]?.model ?? "",
|
|
713
|
+
!usable.some((u) => u.key === first) && /* @__PURE__ */ jsxs3(Text3, { as: "span", color: "fg.muted", children: [
|
|
714
|
+
" (",
|
|
715
|
+
t("notOpenHere"),
|
|
716
|
+
")"
|
|
717
|
+
] })
|
|
718
|
+
] }, a.name);
|
|
719
|
+
})
|
|
720
|
+
] })
|
|
721
|
+
] })
|
|
722
|
+
}
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
// src/areas/ai/ExportsPanel.tsx
|
|
727
|
+
import { useState as useState4 } from "react";
|
|
728
|
+
import { HStack as HStack3, Input as Input3, Stack as Stack4, Text as Text4 } from "@chakra-ui/react";
|
|
729
|
+
import { Button as Button4, DataTable as DataTable2, Field as Field3, InlineAlert as InlineAlert4, Panel as Panel3, errorText, useApiAction as useApiAction3, useApiDownload, useApiQuery as useApiQuery2, useAreaRequest as useAreaRequest3, useConfirm, useFormatters as useFormatters3 } from "@abpjs/ui";
|
|
730
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
731
|
+
var day = (d) => d.toISOString().slice(0, 10);
|
|
732
|
+
function ExportsPanel({ scopeId }) {
|
|
733
|
+
const t = useAiTexts();
|
|
734
|
+
const fmt = useFormatters3();
|
|
735
|
+
const confirm = useConfirm();
|
|
736
|
+
const request = useAreaRequest3("ai");
|
|
737
|
+
const downloadFile = useApiDownload("ai");
|
|
738
|
+
const exports = useApiQuery2("ai", "/exports");
|
|
739
|
+
const action = useApiAction3();
|
|
740
|
+
const today = /* @__PURE__ */ new Date();
|
|
741
|
+
const [from, setFrom] = useState4(day(new Date(today.getTime() - 864e5)));
|
|
742
|
+
const [to, setTo] = useState4(day(today));
|
|
743
|
+
const [fetching, setFetching] = useState4(null);
|
|
744
|
+
const [error, setError] = useState4(null);
|
|
745
|
+
const days = (Date.parse(to) - Date.parse(from)) / 864e5 + 1;
|
|
746
|
+
const valid = Number.isFinite(days) && days >= 1 && days <= 31;
|
|
747
|
+
async function create(e) {
|
|
748
|
+
e.preventDefault();
|
|
749
|
+
if (!valid) return;
|
|
750
|
+
const end = new Date(Date.parse(to) + 864e5).toISOString();
|
|
751
|
+
const made = await action.run(() => request("/exports", { method: "POST", body: { from: `${from}T00:00:00Z`, to: end, scopeId: scopeId ?? null } }));
|
|
752
|
+
if (made) await exports.reload();
|
|
753
|
+
}
|
|
754
|
+
async function download(x) {
|
|
755
|
+
setFetching(x.id);
|
|
756
|
+
setError(null);
|
|
757
|
+
try {
|
|
758
|
+
await downloadFile(`/exports/${encodeURIComponent(x.id)}/file`, { method: "POST" }, `ai-calls-${day(new Date(x.from))}.jsonl.gz`);
|
|
759
|
+
} catch (err) {
|
|
760
|
+
setError(errorText(err));
|
|
761
|
+
} finally {
|
|
762
|
+
setFetching(null);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
async function remove(x) {
|
|
766
|
+
if (!await confirm({ title: t("exportDeleteTitle"), description: t("exportDeleteHint"), confirmLabel: t("exportDelete"), danger: true })) return;
|
|
767
|
+
const done = await action.run(async () => {
|
|
768
|
+
await request(`/exports/${encodeURIComponent(x.id)}`, { method: "DELETE" });
|
|
769
|
+
return true;
|
|
770
|
+
});
|
|
771
|
+
if (done) await exports.reload();
|
|
772
|
+
}
|
|
773
|
+
const period = (x) => `${fmt.dateTime(x.from, { dateStyle: "medium", timeZone: "UTC" })} \u2013 ${fmt.dateTime(new Date(Date.parse(x.to) - 1).toISOString(), { dateStyle: "medium", timeZone: "UTC" })}`;
|
|
774
|
+
return /* @__PURE__ */ jsxs4(Panel3, { title: t("exportsTitle"), description: t("exportsHint"), flush: true, "data-testid": "ai-exports", children: [
|
|
775
|
+
/* @__PURE__ */ jsxs4(Stack4, { gap: "4", px: "5", py: "4", borderBottomWidth: "1px", children: [
|
|
776
|
+
/* @__PURE__ */ jsx4("form", { onSubmit: create, children: /* @__PURE__ */ jsxs4(HStack3, { gap: "3", align: "end", flexWrap: "wrap", children: [
|
|
777
|
+
/* @__PURE__ */ jsx4(Field3, { label: t("exportFrom"), w: "11rem", children: /* @__PURE__ */ jsx4(Input3, { type: "date", value: from, max: to, onChange: (e) => setFrom(e.target.value) }) }),
|
|
778
|
+
/* @__PURE__ */ jsx4(Field3, { label: t("exportTo"), w: "11rem", children: /* @__PURE__ */ jsx4(Input3, { type: "date", value: to, min: from, max: day(today), onChange: (e) => setTo(e.target.value) }) }),
|
|
779
|
+
/* @__PURE__ */ jsx4(Button4, { type: "submit", disabled: !valid, loading: action.busy, children: t("exportCreate") })
|
|
780
|
+
] }) }),
|
|
781
|
+
!valid && /* @__PURE__ */ jsx4(Text4, { textStyle: "sm", color: "fg.muted", children: t("exportPeriodHint") }),
|
|
782
|
+
(action.error || error) && /* @__PURE__ */ jsx4(InlineAlert4, { tone: "danger", children: action.error ?? error })
|
|
783
|
+
] }),
|
|
784
|
+
/* @__PURE__ */ jsx4(
|
|
785
|
+
DataTable2,
|
|
786
|
+
{
|
|
787
|
+
"aria-label": t("exportsTitle"),
|
|
788
|
+
rows: exports.data,
|
|
789
|
+
loading: exports.loading,
|
|
790
|
+
error: exports.error,
|
|
791
|
+
getRowId: (x) => x.id,
|
|
792
|
+
empty: t("noExports"),
|
|
793
|
+
columns: [
|
|
794
|
+
{ id: "period", header: t("exportPeriod"), cell: (x) => /* @__PURE__ */ jsx4(Text4, { children: period(x) }) },
|
|
795
|
+
{
|
|
796
|
+
id: "calls",
|
|
797
|
+
header: t("calls"),
|
|
798
|
+
numeric: true,
|
|
799
|
+
cell: (x) => /* @__PURE__ */ jsxs4(Stack4, { gap: "0", align: "end", children: [
|
|
800
|
+
/* @__PURE__ */ jsx4(Text4, { children: fmt.number(num(x.calls)) }),
|
|
801
|
+
/* @__PURE__ */ jsx4(Text4, { textStyle: "caption", color: "fg.muted", children: t("exportPrompts", { count: num(x.prompts) }) }),
|
|
802
|
+
x.truncated && /* @__PURE__ */ jsx4(Text4, { textStyle: "caption", color: "fg.warning", children: t("exportTruncated") })
|
|
803
|
+
] })
|
|
804
|
+
},
|
|
805
|
+
{ id: "made", header: t("exportMade"), nowrap: true, cell: (x) => fmt.dateTime(x.at, { dateStyle: "short", timeStyle: "short" }) },
|
|
806
|
+
{ id: "expires", header: t("exportExpires"), nowrap: true, cell: (x) => fmt.dateTime(x.expiresAt, { dateStyle: "short", timeStyle: "short" }) },
|
|
807
|
+
{
|
|
808
|
+
id: "actions",
|
|
809
|
+
header: "",
|
|
810
|
+
cell: (x) => /* @__PURE__ */ jsxs4(HStack3, { gap: "2", justify: "end", children: [
|
|
811
|
+
/* @__PURE__ */ jsx4(Button4, { size: "sm", variant: "secondary", loading: fetching === x.id, onClick: () => download(x), children: t("exportDownload") }),
|
|
812
|
+
/* @__PURE__ */ jsx4(Button4, { size: "sm", variant: "ghost", onClick: () => remove(x), children: t("exportDelete") })
|
|
813
|
+
] })
|
|
814
|
+
}
|
|
815
|
+
]
|
|
816
|
+
}
|
|
817
|
+
)
|
|
818
|
+
] });
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
// src/areas/ai/ModelsPanel.tsx
|
|
822
|
+
import { useState as useState5 } from "react";
|
|
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";
|
|
825
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
826
|
+
function ModelsPanel({ scopeId, connections, rows, loading, hostKeeps, onChanged, title, description }) {
|
|
827
|
+
const t = useAiTexts();
|
|
828
|
+
const fmt = useFormatters4();
|
|
829
|
+
const request = useAreaRequest4("ai");
|
|
830
|
+
const [editing, setEditing] = useState5(null);
|
|
831
|
+
const [finding, setFinding] = useState5(null);
|
|
832
|
+
const [picked, setPicked] = useState5(null);
|
|
833
|
+
const list = connections ?? [];
|
|
834
|
+
const shown = rows ?? (connections ? modelRows(connections) : void 0);
|
|
835
|
+
const source = list.find((c) => c.id === picked) ?? list[0];
|
|
836
|
+
const own = (m) => list.some((c) => c.id === m.connectionId);
|
|
837
|
+
async function discover(c) {
|
|
838
|
+
setFinding(c.id);
|
|
839
|
+
try {
|
|
840
|
+
const found = await request(`/connections/${encodeURIComponent(c.id)}/discover`, { method: "POST" });
|
|
841
|
+
notify3.success(t("found", { count: found.models.length, name: c.name }));
|
|
842
|
+
await onChanged();
|
|
843
|
+
} catch (e) {
|
|
844
|
+
notify3.error(errorText2(e));
|
|
845
|
+
} finally {
|
|
846
|
+
setFinding(null);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
const price = (m) => m.inputPrice == null && m.outputPrice == null ? t("noPrice") : t("price", { input: fmt.number(m.inputPrice ?? 0, { maximumFractionDigits: 4 }), output: fmt.number(m.outputPrice ?? 0, { maximumFractionDigits: 4 }) });
|
|
850
|
+
return /* @__PURE__ */ jsxs5(
|
|
851
|
+
Panel4,
|
|
852
|
+
{
|
|
853
|
+
title,
|
|
854
|
+
description,
|
|
855
|
+
flush: true,
|
|
856
|
+
"data-testid": "ai-models",
|
|
857
|
+
actions: hostKeeps ? /* @__PURE__ */ jsx5(HostSlot2, { name: "ai.models.actions", context: { scopeId, onChanged } }) : list.length > 0 && /* @__PURE__ */ jsxs5(HStack4, { gap: "2", children: [
|
|
858
|
+
/* @__PURE__ */ jsx5(
|
|
859
|
+
SelectField3,
|
|
860
|
+
{
|
|
861
|
+
size: "sm",
|
|
862
|
+
width: "auto",
|
|
863
|
+
value: source?.id ?? "",
|
|
864
|
+
"aria-label": t("connection"),
|
|
865
|
+
options: list.map((c) => ({ value: c.id, label: c.name })),
|
|
866
|
+
onChange: (e) => setPicked(e.target.value)
|
|
867
|
+
}
|
|
868
|
+
),
|
|
869
|
+
/* @__PURE__ */ jsx5(Button5, { size: "sm", variant: "secondary", loading: finding !== null, disabled: !source, onClick: () => source && void discover(source), children: t("findModels") })
|
|
870
|
+
] }),
|
|
871
|
+
children: [
|
|
872
|
+
/* @__PURE__ */ jsx5(
|
|
873
|
+
DataTable3,
|
|
874
|
+
{
|
|
875
|
+
"aria-label": title,
|
|
876
|
+
rows: shown,
|
|
877
|
+
loading,
|
|
878
|
+
getRowId: (m) => m.key,
|
|
879
|
+
empty: list.length ? t("noModelsFind") : t("noModels"),
|
|
880
|
+
columns: [
|
|
881
|
+
{
|
|
882
|
+
id: "model",
|
|
883
|
+
header: t("model"),
|
|
884
|
+
cell: (m) => /* @__PURE__ */ jsxs5(Stack5, { gap: "0.5", children: [
|
|
885
|
+
/* @__PURE__ */ jsx5(Text5, { fontWeight: "medium", children: m.name }),
|
|
886
|
+
/* @__PURE__ */ jsxs5(Text5, { textStyle: "caption", color: "fg.muted", children: [
|
|
887
|
+
/* @__PURE__ */ jsx5(Text5, { as: "span", fontFamily: "mono", dir: "ltr", children: m.modelId }),
|
|
888
|
+
" \xB7 ",
|
|
889
|
+
m.connection
|
|
890
|
+
] })
|
|
891
|
+
] })
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
id: "can",
|
|
895
|
+
header: t("can"),
|
|
896
|
+
cell: (m) => /* @__PURE__ */ jsxs5(HStack4, { gap: "1", flexWrap: "wrap", children: [
|
|
897
|
+
m.tools && /* @__PURE__ */ jsx5(StatusPill2, { tone: "neutral", dot: false, children: t("tools") }),
|
|
898
|
+
m.images && /* @__PURE__ */ jsx5(StatusPill2, { tone: "neutral", dot: false, children: t("images") }),
|
|
899
|
+
m.structuredOutput && /* @__PURE__ */ jsx5(StatusPill2, { tone: "neutral", dot: false, children: t("structured") })
|
|
900
|
+
] })
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
id: "price",
|
|
904
|
+
header: t("prices"),
|
|
905
|
+
cell: (m) => /* @__PURE__ */ jsxs5(Stack5, { gap: "0.5", children: [
|
|
906
|
+
/* @__PURE__ */ jsx5(Text5, { textStyle: "sm", children: price(m) }),
|
|
907
|
+
m.priceSetAt && /* @__PURE__ */ jsx5(Text5, { textStyle: "caption", color: "fg.muted", children: t("priceSetAt", { at: fmt.dateTime(m.priceSetAt, { dateStyle: "medium" }) }) })
|
|
908
|
+
] })
|
|
909
|
+
},
|
|
910
|
+
{ id: "on", header: t("state"), nowrap: true, cell: (m) => /* @__PURE__ */ jsx5(StatusPill2, { tone: m.enabled ? "success" : "neutral", children: m.enabled ? t("on") : t("off") }) },
|
|
911
|
+
{
|
|
912
|
+
id: "edit",
|
|
913
|
+
header: /* @__PURE__ */ jsx5(Text5, { srOnly: true, children: t("edit") }),
|
|
914
|
+
align: "end",
|
|
915
|
+
cell: (m) => !own(m) ? null : hostKeeps ? /* @__PURE__ */ jsx5(HostSlot2, { name: "ai.models.edit", context: { connectionId: m.connectionId, modelId: m.modelId, scopeId, onSaved: onChanged } }) : /* @__PURE__ */ jsx5(Button5, { size: "sm", variant: "ghost", onClick: () => setEditing(m), children: t("edit") })
|
|
916
|
+
}
|
|
917
|
+
]
|
|
918
|
+
}
|
|
919
|
+
),
|
|
920
|
+
editing && /* @__PURE__ */ jsx5(
|
|
921
|
+
ModelEditor,
|
|
922
|
+
{
|
|
923
|
+
connection: list.find((c) => c.id === editing.connectionId),
|
|
924
|
+
model: editing,
|
|
925
|
+
onClose: () => setEditing(null),
|
|
926
|
+
onSaved: async () => {
|
|
927
|
+
setEditing(null);
|
|
928
|
+
await onChanged();
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
)
|
|
932
|
+
]
|
|
933
|
+
}
|
|
934
|
+
);
|
|
935
|
+
}
|
|
936
|
+
function ModelEditor({ connection, model, onClose, onSaved }) {
|
|
937
|
+
const t = useAiTexts();
|
|
938
|
+
const request = useAreaRequest4("ai");
|
|
939
|
+
const action = useApiAction4();
|
|
940
|
+
const [name, setName] = useState5(model.name === model.modelId ? "" : model.name);
|
|
941
|
+
const [enabled, setEnabled] = useState5(model.enabled);
|
|
942
|
+
const [tools, setTools] = useState5(model.tools);
|
|
943
|
+
const [images, setImages] = useState5(model.images);
|
|
944
|
+
const [structured, setStructured] = useState5(model.structuredOutput);
|
|
945
|
+
const [context, setContext] = useState5(model.contextTokens == null ? "" : String(model.contextTokens));
|
|
946
|
+
const [input, setInput] = useState5(model.inputPrice == null ? "" : String(model.inputPrice));
|
|
947
|
+
const [output, setOutput] = useState5(model.outputPrice == null ? "" : String(model.outputPrice));
|
|
948
|
+
const number = (v) => v.trim() === "" ? null : Number(v);
|
|
949
|
+
async function save() {
|
|
950
|
+
const settings = {
|
|
951
|
+
...connection.modelSettings?.[model.modelId],
|
|
952
|
+
name: name.trim() || null,
|
|
953
|
+
enabled,
|
|
954
|
+
tools,
|
|
955
|
+
images,
|
|
956
|
+
structuredOutput: structured,
|
|
957
|
+
contextTokens: number(context)
|
|
958
|
+
};
|
|
959
|
+
const price = input.trim() === "" && output.trim() === "" ? null : { input: number(input) ?? 0, output: number(output) ?? 0 };
|
|
960
|
+
const body = withModel(connection, model.modelId, settings, price);
|
|
961
|
+
if (await action.run(() => request(`/connections/${encodeURIComponent(connection.id)}`, { method: "PUT", body })) !== void 0) await onSaved();
|
|
962
|
+
}
|
|
963
|
+
return /* @__PURE__ */ jsxs5(
|
|
964
|
+
FormDialog2,
|
|
965
|
+
{
|
|
966
|
+
open: true,
|
|
967
|
+
onOpenChange: (open) => !open && onClose(),
|
|
968
|
+
title: t("editModel", { name: model.modelId }),
|
|
969
|
+
submitLabel: t("save"),
|
|
970
|
+
onSubmit: save,
|
|
971
|
+
busy: action.busy,
|
|
972
|
+
error: action.error,
|
|
973
|
+
children: [
|
|
974
|
+
/* @__PURE__ */ jsx5(SwitchField2, { label: t("modelOn"), checked: enabled, onCheckedChange: setEnabled }),
|
|
975
|
+
/* @__PURE__ */ jsx5(Field4, { label: t("name"), helperText: t("nameHint"), children: /* @__PURE__ */ jsx5(Input4, { value: name, maxLength: 200, onChange: (e) => setName(e.target.value) }) }),
|
|
976
|
+
/* @__PURE__ */ jsxs5(Stack5, { gap: "1.5", role: "group", "aria-labelledby": "ai-model-can", children: [
|
|
977
|
+
/* @__PURE__ */ jsx5(Text5, { id: "ai-model-can", textStyle: "sm", fontWeight: "medium", children: t("can") }),
|
|
978
|
+
/* @__PURE__ */ jsx5(CheckboxField2, { label: t("toolsLong"), checked: tools, onCheckedChange: setTools }),
|
|
979
|
+
/* @__PURE__ */ jsx5(CheckboxField2, { label: t("imagesLong"), checked: images, onCheckedChange: setImages }),
|
|
980
|
+
/* @__PURE__ */ jsx5(CheckboxField2, { label: t("structuredLong"), checked: structured, onCheckedChange: setStructured })
|
|
981
|
+
] }),
|
|
982
|
+
/* @__PURE__ */ jsx5(Field4, { label: t("context"), optionalText: t("optional"), children: /* @__PURE__ */ jsx5(Input4, { type: "number", min: 1, value: context, dir: "ltr", onChange: (e) => setContext(e.target.value) }) }),
|
|
983
|
+
/* @__PURE__ */ jsxs5(HStack4, { gap: "3", alignItems: "start", children: [
|
|
984
|
+
/* @__PURE__ */ jsx5(Field4, { label: t("inputPrice"), helperText: t("perMillion"), children: /* @__PURE__ */ jsx5(Input4, { type: "number", min: 0, step: "any", value: input, dir: "ltr", onChange: (e) => setInput(e.target.value) }) }),
|
|
985
|
+
/* @__PURE__ */ jsx5(Field4, { label: t("outputPrice"), helperText: t("perMillion"), children: /* @__PURE__ */ jsx5(Input4, { type: "number", min: 0, step: "any", value: output, dir: "ltr", onChange: (e) => setOutput(e.target.value) }) })
|
|
986
|
+
] })
|
|
987
|
+
]
|
|
988
|
+
}
|
|
989
|
+
);
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
// src/areas/ai/UsagePanel.tsx
|
|
993
|
+
import { useMemo as useMemo3, useState as useState7 } from "react";
|
|
994
|
+
import { HStack as HStack5, Stack as Stack6, Text as Text6 } from "@chakra-ui/react";
|
|
995
|
+
import { DataTable as DataTable4, EMPTY_VALUE, Panel as Panel5, SelectField as SelectField4, StatusPill as StatusPill3, useFormatters as useFormatters5, useNames as useNames2 } from "@abpjs/ui";
|
|
996
|
+
|
|
997
|
+
// src/areas/ai/usePostQuery.ts
|
|
998
|
+
import { useCallback, useEffect as useEffect2, useRef, useState as useState6 } from "react";
|
|
999
|
+
import { errorText as errorText3, useAreaRequest as useAreaRequest5 } from "@abpjs/ui";
|
|
1000
|
+
function usePostQuery(path, body) {
|
|
1001
|
+
const request = useAreaRequest5("ai");
|
|
1002
|
+
const key = JSON.stringify(body);
|
|
1003
|
+
const [data, setData] = useState6(void 0);
|
|
1004
|
+
const [error, setError] = useState6(null);
|
|
1005
|
+
const [loading, setLoading] = useState6(true);
|
|
1006
|
+
const seq = useRef(0);
|
|
1007
|
+
const reload = useCallback(async () => {
|
|
1008
|
+
const id = ++seq.current;
|
|
1009
|
+
setLoading(true);
|
|
1010
|
+
try {
|
|
1011
|
+
const answer = await request(path, { method: "POST", body: JSON.parse(key) });
|
|
1012
|
+
if (id === seq.current) {
|
|
1013
|
+
setData(answer);
|
|
1014
|
+
setError(null);
|
|
1015
|
+
}
|
|
1016
|
+
} catch (e) {
|
|
1017
|
+
if (id === seq.current) setError(errorText3(e));
|
|
1018
|
+
} finally {
|
|
1019
|
+
if (id === seq.current) setLoading(false);
|
|
1020
|
+
}
|
|
1021
|
+
}, [request, path, key]);
|
|
1022
|
+
useEffect2(() => {
|
|
1023
|
+
void reload();
|
|
1024
|
+
}, [reload]);
|
|
1025
|
+
return { data, error, loading, reload };
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
// src/areas/ai/UsagePanel.tsx
|
|
1029
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1030
|
+
var USAGE_BY = { project: "scope", model: "model", purpose: "purpose", account: "account" };
|
|
1031
|
+
var outcomeOf = (state) => state === "done" ? "ok" : state;
|
|
1032
|
+
var OUTCOME_TONES = { ok: "success", refused: "warning", failed: "danger", reserved: "info" };
|
|
1033
|
+
function monthRange(offset) {
|
|
1034
|
+
const now = /* @__PURE__ */ new Date();
|
|
1035
|
+
const from = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth() - offset, 1));
|
|
1036
|
+
const to = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth() - offset + 1, 1));
|
|
1037
|
+
return { from: from.toISOString(), to: to.toISOString() };
|
|
1038
|
+
}
|
|
1039
|
+
function UsagePanel({ scopeId, by: byOptions }) {
|
|
1040
|
+
const t = useAiTexts();
|
|
1041
|
+
const fmt = useFormatters5();
|
|
1042
|
+
const [by, setBy] = useState7(byOptions[0]);
|
|
1043
|
+
const [month, setMonth] = useState7(0);
|
|
1044
|
+
const { from, to } = monthRange(month);
|
|
1045
|
+
const usage = usePostQuery("/usage", { from, to, scopeId: scopeId ?? null, groupBy: USAGE_BY[by] });
|
|
1046
|
+
const recent = usePostQuery("/usage/recent", { from, to, scopeId: scopeId ?? null, count: 50 });
|
|
1047
|
+
const rows = usage.data?.rows;
|
|
1048
|
+
const people = useNames2("people", useMemo3(() => [
|
|
1049
|
+
...by === "account" ? (rows ?? []).filter((r) => !r.title && r.key).map((r) => r.key) : [],
|
|
1050
|
+
...(recent.data ?? []).flatMap((c) => c.accountId ? [c.accountId] : [])
|
|
1051
|
+
], [by, rows, recent.data]));
|
|
1052
|
+
const scopes = useNames2("scopes", useMemo3(() => by === "project" ? (rows ?? []).filter((r) => !r.title && r.key).map((r) => r.key) : [], [by, rows]));
|
|
1053
|
+
const months = [0, 1, 2, 3, 4, 5].map((m) => ({ value: String(m), label: fmt.dateTime(monthRange(m).from, { year: "numeric", month: "long", timeZone: "UTC" }) }));
|
|
1054
|
+
const total = (rows ?? []).reduce((sum, r) => sum + num(r.cost), 0);
|
|
1055
|
+
const money = (v) => fmt.number(num(v), { maximumFractionDigits: 6 });
|
|
1056
|
+
const label = (key, title) => key === "" && by === "project" ? t("siteCalls") : title || (by === "account" ? people[key] : by === "project" ? scopes[key] : void 0) || key;
|
|
1057
|
+
return /* @__PURE__ */ jsxs6(Stack6, { gap: "section", children: [
|
|
1058
|
+
/* @__PURE__ */ jsx6(
|
|
1059
|
+
Panel5,
|
|
1060
|
+
{
|
|
1061
|
+
title: t("usageTitle"),
|
|
1062
|
+
description: t("usageTotal", { cost: money(total) }),
|
|
1063
|
+
flush: true,
|
|
1064
|
+
"data-testid": "ai-usage",
|
|
1065
|
+
actions: /* @__PURE__ */ jsxs6(HStack5, { gap: "2", children: [
|
|
1066
|
+
/* @__PURE__ */ jsx6(
|
|
1067
|
+
SelectField4,
|
|
1068
|
+
{
|
|
1069
|
+
size: "sm",
|
|
1070
|
+
width: "auto",
|
|
1071
|
+
value: by,
|
|
1072
|
+
"aria-label": t("by"),
|
|
1073
|
+
options: byOptions.map((b) => ({ value: b, label: t(`byOptions.${b}`) })),
|
|
1074
|
+
onChange: (e) => setBy(e.target.value)
|
|
1075
|
+
}
|
|
1076
|
+
),
|
|
1077
|
+
/* @__PURE__ */ jsx6(SelectField4, { size: "sm", width: "auto", value: String(month), "aria-label": t("month"), options: months, onChange: (e) => setMonth(Number(e.target.value)) })
|
|
1078
|
+
] }),
|
|
1079
|
+
children: /* @__PURE__ */ jsx6(
|
|
1080
|
+
DataTable4,
|
|
1081
|
+
{
|
|
1082
|
+
"aria-label": t("usageTitle"),
|
|
1083
|
+
rows,
|
|
1084
|
+
loading: usage.loading,
|
|
1085
|
+
error: usage.error,
|
|
1086
|
+
getRowId: (r) => r.key,
|
|
1087
|
+
empty: t("noUsage"),
|
|
1088
|
+
columns: [
|
|
1089
|
+
{ id: "label", header: t(`byOptions.${by}`), cell: (r) => /* @__PURE__ */ jsx6(Text6, { dir: "auto", children: label(r.key, r.title) }) },
|
|
1090
|
+
{ id: "calls", header: t("calls"), numeric: true, cell: (r) => fmt.number(num(r.calls)) },
|
|
1091
|
+
{ id: "in", header: t("tokensIn"), numeric: true, cell: (r) => fmt.number(num(r.inputTokens)) },
|
|
1092
|
+
{ id: "out", header: t("tokensOut"), numeric: true, cell: (r) => fmt.number(num(r.outputTokens)) },
|
|
1093
|
+
{ id: "cost", header: t("cost"), numeric: true, cell: (r) => money(r.cost) },
|
|
1094
|
+
{ id: "refused", header: t("refused"), numeric: true, cell: (r) => fmt.number(num(r.refused)) },
|
|
1095
|
+
{ id: "failed", header: t("failed"), numeric: true, cell: (r) => fmt.number(num(r.failed)) }
|
|
1096
|
+
]
|
|
1097
|
+
}
|
|
1098
|
+
)
|
|
1099
|
+
}
|
|
1100
|
+
),
|
|
1101
|
+
/* @__PURE__ */ jsx6(Panel5, { title: t("recentTitle"), flush: true, "data-testid": "ai-recent", children: /* @__PURE__ */ jsx6(
|
|
1102
|
+
DataTable4,
|
|
1103
|
+
{
|
|
1104
|
+
"aria-label": t("recentTitle"),
|
|
1105
|
+
rows: recent.data,
|
|
1106
|
+
loading: recent.loading,
|
|
1107
|
+
error: recent.error,
|
|
1108
|
+
getRowId: (u) => u.id,
|
|
1109
|
+
empty: t("noUsage"),
|
|
1110
|
+
columns: [
|
|
1111
|
+
{ id: "at", header: t("at"), nowrap: true, cell: (u) => fmt.dateTime(u.at, { dateStyle: "short", timeStyle: "medium" }) },
|
|
1112
|
+
{
|
|
1113
|
+
id: "who",
|
|
1114
|
+
header: t("who"),
|
|
1115
|
+
cell: (u) => /* @__PURE__ */ jsxs6(Stack6, { gap: "0", children: [
|
|
1116
|
+
/* @__PURE__ */ jsx6(Text6, { children: u.accountId && people[u.accountId] || u.accountId || EMPTY_VALUE }),
|
|
1117
|
+
u.scope && /* @__PURE__ */ jsx6(Text6, { textStyle: "caption", color: "fg.muted", dir: "ltr", children: u.scope })
|
|
1118
|
+
] })
|
|
1119
|
+
},
|
|
1120
|
+
{ id: "purpose", header: t("purpose"), cell: (u) => /* @__PURE__ */ jsx6(Text6, { fontFamily: "mono", textStyle: "sm", dir: "ltr", children: u.purpose || EMPTY_VALUE }) },
|
|
1121
|
+
{ id: "model", header: t("model"), cell: (u) => /* @__PURE__ */ jsx6(Text6, { fontFamily: "mono", textStyle: "sm", dir: "ltr", children: u.model }) },
|
|
1122
|
+
{ id: "tokens", header: t("tokens"), numeric: true, cell: (u) => `${fmt.number(num(u.inputTokens))} / ${fmt.number(num(u.outputTokens))}` },
|
|
1123
|
+
{ id: "cost", header: t("cost"), numeric: true, cell: (u) => money(u.cost) },
|
|
1124
|
+
{
|
|
1125
|
+
id: "outcome",
|
|
1126
|
+
header: t("outcome"),
|
|
1127
|
+
cell: (u) => /* @__PURE__ */ jsxs6(Stack6, { gap: "0.5", children: [
|
|
1128
|
+
/* @__PURE__ */ jsx6(StatusPill3, { tone: OUTCOME_TONES[outcomeOf(u.state)] ?? "neutral", children: t(`outcomes.${outcomeOf(u.state)}`) }),
|
|
1129
|
+
u.error && /* @__PURE__ */ jsx6(Text6, { textStyle: "caption", color: "fg.muted", lineClamp: 2, title: u.error, children: u.error })
|
|
1130
|
+
] })
|
|
1131
|
+
}
|
|
1132
|
+
]
|
|
1133
|
+
}
|
|
1134
|
+
) })
|
|
1135
|
+
] });
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
// src/areas/ai/AiAdmin.tsx
|
|
1139
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1140
|
+
function useHostKeepsConnections(site, scopeId) {
|
|
1141
|
+
const can = useCan();
|
|
1142
|
+
const told = site?.connectionsKeptByHost;
|
|
1143
|
+
return told ?? !can("ai.connections.edit", scopeId);
|
|
1144
|
+
}
|
|
1145
|
+
function AiAdmin() {
|
|
1146
|
+
const t = useAiTexts();
|
|
1147
|
+
const request = useAreaRequest6("ai");
|
|
1148
|
+
const site = useApiQuery3("ai", "/site");
|
|
1149
|
+
const connections = useApiQuery3("ai", "/connections");
|
|
1150
|
+
const aliases = useApiQuery3("ai", "/aliases");
|
|
1151
|
+
const limits = useApiQuery3("ai", "/limits");
|
|
1152
|
+
const saving = useApiAction5();
|
|
1153
|
+
const hostKeeps = useHostKeepsConnections(site.data);
|
|
1154
|
+
const tryHere = Boolean(useOptionalHost2()?.slots?.["ai.try"]);
|
|
1155
|
+
const models = useMemo4(() => modelRows(connections.data ?? []), [connections.data]);
|
|
1156
|
+
async function saveSiteLimits(rows) {
|
|
1157
|
+
if (await saving.run(() => saveLimits(request, null, limits.data ?? [], rows).then(() => true)) !== void 0) {
|
|
1158
|
+
notify4.success(t("saved"));
|
|
1159
|
+
await limits.reload();
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
return /* @__PURE__ */ jsxs7(Tabs.Root, { defaultValue: "models", variant: "line", lazyMount: true, children: [
|
|
1163
|
+
/* @__PURE__ */ jsxs7(Tabs.List, { mb: "section", overflowX: "auto", overflowY: "hidden", children: [
|
|
1164
|
+
/* @__PURE__ */ jsx7(Tabs.Trigger, { value: "models", children: t("tabs.models") }),
|
|
1165
|
+
/* @__PURE__ */ jsx7(Tabs.Trigger, { value: "aliases", children: t("tabs.aliases") }),
|
|
1166
|
+
/* @__PURE__ */ jsx7(Tabs.Trigger, { value: "access", children: t("tabs.access") }),
|
|
1167
|
+
/* @__PURE__ */ jsx7(Tabs.Trigger, { value: "limits", children: t("tabs.limits") }),
|
|
1168
|
+
/* @__PURE__ */ jsx7(Tabs.Trigger, { value: "usage", children: t("tabs.usage") }),
|
|
1169
|
+
tryHere && /* @__PURE__ */ jsx7(Tabs.Trigger, { value: "try", children: t("tabs.try") }),
|
|
1170
|
+
/* @__PURE__ */ jsx7(Tabs.Trigger, { value: "exports", children: t("tabs.exports") })
|
|
1171
|
+
] }),
|
|
1172
|
+
/* @__PURE__ */ jsx7(Tabs.Content, { value: "models", children: /* @__PURE__ */ jsxs7(Stack7, { gap: "section", children: [
|
|
1173
|
+
/* @__PURE__ */ jsx7(InlineAlert5, { tone: "danger", children: connections.error }),
|
|
1174
|
+
connections.data && connections.data.length === 0 && /* @__PURE__ */ jsx7(InlineAlert5, { tone: "info", children: t("noProviders") }),
|
|
1175
|
+
/* @__PURE__ */ jsx7(
|
|
1176
|
+
ModelsPanel,
|
|
1177
|
+
{
|
|
1178
|
+
connections: connections.data,
|
|
1179
|
+
loading: connections.loading,
|
|
1180
|
+
hostKeeps,
|
|
1181
|
+
onChanged: () => Promise.all([connections.reload(), aliases.reload()]).then(() => void 0),
|
|
1182
|
+
title: t("modelsTitle"),
|
|
1183
|
+
description: t("modelsHint")
|
|
1184
|
+
}
|
|
1185
|
+
)
|
|
1186
|
+
] }) }),
|
|
1187
|
+
/* @__PURE__ */ jsx7(Tabs.Content, { value: "aliases", children: /* @__PURE__ */ jsx7(AliasesPanel, { aliases: aliases.data, models, onSaved: aliases.reload }) }),
|
|
1188
|
+
/* @__PURE__ */ jsx7(Tabs.Content, { value: "access", children: /* @__PURE__ */ jsx7(AccessPanel, { models }) }),
|
|
1189
|
+
/* @__PURE__ */ jsx7(Tabs.Content, { value: "limits", children: /* @__PURE__ */ jsx7(Panel6, { title: t("siteLimitsTitle"), description: t("siteLimitsHint"), children: limits.data && /* @__PURE__ */ jsx7(LimitsEditor, { limits: limits.data, onSave: saveSiteLimits, busy: saving.busy, error: saving.error ?? limits.error }) }) }),
|
|
1190
|
+
/* @__PURE__ */ jsx7(Tabs.Content, { value: "usage", children: /* @__PURE__ */ jsx7(UsagePanel, { by: ["project", "model", "purpose", "account"] }) }),
|
|
1191
|
+
tryHere && /* @__PURE__ */ jsx7(Tabs.Content, { value: "try", children: /* @__PURE__ */ jsx7(HostSlot3, { name: "ai.try", context: { scopeId: void 0, aliases: (aliases.data ?? []).map((a) => a.name) } }) }),
|
|
1192
|
+
/* @__PURE__ */ jsx7(Tabs.Content, { value: "exports", children: /* @__PURE__ */ jsx7(ExportsPanel, {}) })
|
|
1193
|
+
] });
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
// src/areas/ai/pages.tsx
|
|
1197
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1198
|
+
function AiAdminPage() {
|
|
1199
|
+
const t = useAiTexts();
|
|
1200
|
+
return /* @__PURE__ */ jsxs8(Stack8, { gap: "section", children: [
|
|
1201
|
+
/* @__PURE__ */ jsx8(PageHeader, { title: t("pageTitle"), description: t("pageSubtitle") }),
|
|
1202
|
+
/* @__PURE__ */ jsx8(AiAdmin, {})
|
|
1203
|
+
] });
|
|
1204
|
+
}
|
|
1205
|
+
function aiPages(options) {
|
|
1206
|
+
return [
|
|
1207
|
+
{
|
|
1208
|
+
id: "ai.admin",
|
|
1209
|
+
section: options.section,
|
|
1210
|
+
weight: options.weight ?? 100,
|
|
1211
|
+
title: options.title ?? "AI models and usage",
|
|
1212
|
+
href: options.href,
|
|
1213
|
+
about: options.about,
|
|
1214
|
+
plugin: "ai",
|
|
1215
|
+
visible: options.visible,
|
|
1216
|
+
component: AiAdminPage
|
|
1217
|
+
}
|
|
1218
|
+
];
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
// src/areas/ai/AiScopeScreen.tsx
|
|
1222
|
+
import { useMemo as useMemo5 } from "react";
|
|
1223
|
+
import { Stack as Stack9, Text as Text7 } from "@chakra-ui/react";
|
|
1224
|
+
import { HostSlot as HostSlot4, InlineAlert as InlineAlert6, Loading, Panel as Panel7, StatusPill as StatusPill4, TextBone, TextSlot, useApiQuery as useApiQuery4 } from "@abpjs/ui";
|
|
1225
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1226
|
+
function AiScopeScreen({ scopeId }) {
|
|
1227
|
+
const t = useAiTexts();
|
|
1228
|
+
const limitText = useLimitText();
|
|
1229
|
+
const access = useApiQuery4("ai", `/scopes/${encodeURIComponent(scopeId)}/access`);
|
|
1230
|
+
const own = useApiQuery4("ai", access.data?.mayConnect ? `/connections${scopeQuery(scopeId)}` : null);
|
|
1231
|
+
const site = useApiQuery4("ai", "/connections");
|
|
1232
|
+
const aliases = useApiQuery4("ai", `/aliases${scopeQuery(scopeId)}`);
|
|
1233
|
+
const limits = useApiQuery4("ai", `/limits${scopeQuery(scopeId)}`);
|
|
1234
|
+
const siteLimits = useApiQuery4("ai", "/limits");
|
|
1235
|
+
const hostKeeps = useHostKeepsConnections(void 0, scopeId);
|
|
1236
|
+
const a = access.data;
|
|
1237
|
+
const rows = useMemo5(() => {
|
|
1238
|
+
const opened2 = new Set((a?.siteModels ?? []).map((m) => modelKey(m.connectionId, m.model)));
|
|
1239
|
+
const fromSite = modelRows(site.data ?? []).filter((m) => m.enabled && (a?.allSiteModels || opened2.has(m.key)));
|
|
1240
|
+
return [...fromSite, ...modelRows(own.data ?? [])];
|
|
1241
|
+
}, [a, site.data, own.data]);
|
|
1242
|
+
if (access.error && !a) return /* @__PURE__ */ jsx9(InlineAlert6, { tone: "danger", children: access.error });
|
|
1243
|
+
const opened = a && (a.allSiteModels ? t("allModels") : a.siteModels.length ? t("someModels", { count: a.siteModels.length }) : t("noModelsOpen"));
|
|
1244
|
+
const lines = (list) => !list ? /* @__PURE__ */ jsx9(Text7, { textStyle: "sm", children: /* @__PURE__ */ jsx9(TextBone, { width: 24 }) }) : list.length ? list.map((l) => /* @__PURE__ */ jsx9(Text7, { textStyle: "sm", children: limitText(l) }, l.id)) : /* @__PURE__ */ jsx9(Text7, { textStyle: "sm", color: "fg.muted", children: t("noLimits") });
|
|
1245
|
+
return /* @__PURE__ */ jsx9(Loading, { when: !a, children: /* @__PURE__ */ jsxs9(Stack9, { gap: "section", children: [
|
|
1246
|
+
/* @__PURE__ */ jsx9(Panel7, { title: t("projectAccessTitle"), description: t("projectAccessHint"), "data-testid": "ai-project-access", children: /* @__PURE__ */ jsxs9(Stack9, { gap: "2", children: [
|
|
1247
|
+
/* @__PURE__ */ jsx9(Text7, { children: /* @__PURE__ */ jsx9(StatusPill4, { tone: a?.allSiteModels || a?.siteModels.length ? "success" : "neutral", children: opened }) }),
|
|
1248
|
+
/* @__PURE__ */ jsx9(Text7, { textStyle: "sm", children: /* @__PURE__ */ jsx9(TextSlot, { width: 44, children: a && (a.mayConnect ? t("ownAllowed") : t("ownNotAllowed")) }) })
|
|
1249
|
+
] }) }),
|
|
1250
|
+
/* @__PURE__ */ jsx9(
|
|
1251
|
+
ModelsPanel,
|
|
1252
|
+
{
|
|
1253
|
+
scopeId,
|
|
1254
|
+
connections: a?.mayConnect ? own.data ?? [] : [],
|
|
1255
|
+
rows,
|
|
1256
|
+
loading: own.loading,
|
|
1257
|
+
hostKeeps,
|
|
1258
|
+
onChanged: () => Promise.all([own.reload(), aliases.reload()]).then(() => void 0),
|
|
1259
|
+
title: t("projectModelsTitle"),
|
|
1260
|
+
description: a?.mayConnect ? t("projectModelsOwnHint") : t("projectModelsHint")
|
|
1261
|
+
}
|
|
1262
|
+
),
|
|
1263
|
+
/* @__PURE__ */ jsx9(AliasesPanel, { scopeId, aliases: aliases.data, models: rows, onSaved: aliases.reload }),
|
|
1264
|
+
/* @__PURE__ */ jsx9(Panel7, { title: t("tabs.limits"), description: t("projectLimitsReadHint"), "data-testid": "ai-project-limits", children: /* @__PURE__ */ jsxs9(Stack9, { gap: "3", children: [
|
|
1265
|
+
/* @__PURE__ */ jsxs9(Stack9, { gap: "1", children: [
|
|
1266
|
+
/* @__PURE__ */ jsx9(Text7, { textStyle: "sm", fontWeight: "medium", children: t("thisProject") }),
|
|
1267
|
+
lines(limits.data)
|
|
1268
|
+
] }),
|
|
1269
|
+
!siteLimits.error && /* @__PURE__ */ jsxs9(Stack9, { gap: "1", children: [
|
|
1270
|
+
/* @__PURE__ */ jsx9(Text7, { textStyle: "sm", fontWeight: "medium", children: t("theSite") }),
|
|
1271
|
+
lines(siteLimits.data)
|
|
1272
|
+
] })
|
|
1273
|
+
] }) }),
|
|
1274
|
+
/* @__PURE__ */ jsx9(UsagePanel, { scopeId, by: ["model", "purpose", "account"] }),
|
|
1275
|
+
/* @__PURE__ */ jsx9(HostSlot4, { name: "ai.try", context: { scopeId, aliases: (aliases.data ?? []).map((x) => x.name) } })
|
|
1276
|
+
] }) });
|
|
1277
|
+
}
|
|
1278
|
+
export {
|
|
1279
|
+
AccessPanel,
|
|
1280
|
+
AiAdmin,
|
|
1281
|
+
AiAdminPage,
|
|
1282
|
+
AiScopeScreen,
|
|
1283
|
+
AliasesPanel,
|
|
1284
|
+
ExportsPanel,
|
|
1285
|
+
LIMIT_KINDS,
|
|
1286
|
+
LIMIT_PERIODS,
|
|
1287
|
+
LimitsEditor,
|
|
1288
|
+
ModelsPanel,
|
|
1289
|
+
USAGE_BY,
|
|
1290
|
+
UsagePanel,
|
|
1291
|
+
aiPages,
|
|
1292
|
+
editableLimit,
|
|
1293
|
+
limitRow,
|
|
1294
|
+
modelKey,
|
|
1295
|
+
modelRows,
|
|
1296
|
+
num,
|
|
1297
|
+
saveLimits,
|
|
1298
|
+
useAiTexts,
|
|
1299
|
+
useHostKeepsConnections,
|
|
1300
|
+
useLimitText,
|
|
1301
|
+
withModel
|
|
1302
|
+
};
|
|
1303
|
+
//# sourceMappingURL=ai.js.map
|