@smart-cloud/ai-kit-ui 1.1.39 → 1.1.40
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/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/package.json +8 -8
- package/src/ai-feature/AiFeature.tsx +119 -116
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smart-cloud/ai-kit-ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.40",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@emotion/cache": "^11.14.0",
|
|
21
21
|
"@emotion/react": "^11.14.0",
|
|
22
22
|
"@mantine/colors-generator": "^8.3.14",
|
|
23
|
-
"@smart-cloud/ai-kit-core": "^1.1.
|
|
23
|
+
"@smart-cloud/ai-kit-core": "^1.1.20",
|
|
24
24
|
"@smart-cloud/wpsuite-core": "^2.1.2",
|
|
25
25
|
"@tabler/icons-react": "^3.36.1",
|
|
26
26
|
"chroma-js": "^3.2.0",
|
|
@@ -42,27 +42,27 @@
|
|
|
42
42
|
"react-dom": "^18.3.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@eslint/js": "^
|
|
45
|
+
"@eslint/js": "^10.0.1",
|
|
46
46
|
"@mantine/core": "^8.3.14",
|
|
47
47
|
"@mantine/hooks": "^8.3.14",
|
|
48
48
|
"@mantine/modals": "^8.3.14",
|
|
49
|
-
"@types/dom-chromium-ai": "^0.0.
|
|
49
|
+
"@types/dom-chromium-ai": "^0.0.14",
|
|
50
50
|
"@types/jquery": "^3.5.33",
|
|
51
51
|
"@types/react": "^18.3.23",
|
|
52
52
|
"@types/react-dom": "^18.3.7",
|
|
53
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
54
|
-
"@typescript-eslint/parser": "^8.
|
|
53
|
+
"@typescript-eslint/eslint-plugin": "^8.55.0",
|
|
54
|
+
"@typescript-eslint/parser": "^8.55.0",
|
|
55
55
|
"@wordpress/data": "^10.39.0",
|
|
56
56
|
"ajv": "^8.17.1",
|
|
57
57
|
"aws-amplify": "^6.16.0",
|
|
58
|
-
"eslint": "^
|
|
58
|
+
"eslint": "^10.0.0",
|
|
59
59
|
"globals": "^17.3.0",
|
|
60
60
|
"jquery": "^4.0.0",
|
|
61
61
|
"react": "^18.3.1",
|
|
62
62
|
"react-dom": "^18.3.1",
|
|
63
63
|
"tsup": "^8.5.1",
|
|
64
64
|
"typescript": "^5.9.3",
|
|
65
|
-
"typescript-eslint": "^8.
|
|
65
|
+
"typescript-eslint": "^8.55.0"
|
|
66
66
|
},
|
|
67
67
|
"exports": {
|
|
68
68
|
".": {
|
|
@@ -169,51 +169,54 @@ async function parseImageMetadataFromPromptResult(
|
|
|
169
169
|
typeof parsed.alt === "string"
|
|
170
170
|
? outputLang && outputLang !== "en"
|
|
171
171
|
? (
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
172
|
+
await translate(
|
|
173
|
+
{
|
|
174
|
+
text: parsed.alt,
|
|
175
|
+
sourceLanguage: "en",
|
|
176
|
+
targetLanguage: outputLang,
|
|
177
|
+
},
|
|
178
|
+
featureOptions,
|
|
179
|
+
)
|
|
180
|
+
).result
|
|
181
181
|
: parsed.alt
|
|
182
182
|
: "",
|
|
183
183
|
title:
|
|
184
184
|
typeof parsed.title === "string"
|
|
185
185
|
? outputLang && outputLang !== "en"
|
|
186
186
|
? (
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
187
|
+
await translate({
|
|
188
|
+
text: parsed.title,
|
|
189
|
+
sourceLanguage: "en",
|
|
190
|
+
targetLanguage: outputLang,
|
|
191
|
+
},
|
|
192
|
+
featureOptions)
|
|
193
|
+
).result
|
|
193
194
|
: parsed.title
|
|
194
195
|
: "",
|
|
195
196
|
caption:
|
|
196
197
|
typeof parsed.caption === "string"
|
|
197
198
|
? outputLang && outputLang !== "en"
|
|
198
199
|
? (
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
200
|
+
await translate({
|
|
201
|
+
text: parsed.caption,
|
|
202
|
+
sourceLanguage: "en",
|
|
203
|
+
targetLanguage: outputLang,
|
|
204
|
+
},
|
|
205
|
+
featureOptions)
|
|
206
|
+
).result
|
|
205
207
|
: parsed.caption
|
|
206
208
|
: "",
|
|
207
209
|
description:
|
|
208
210
|
typeof parsed.description === "string"
|
|
209
211
|
? outputLang && outputLang !== "en"
|
|
210
212
|
? (
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
await translate({
|
|
214
|
+
text: parsed.description,
|
|
215
|
+
sourceLanguage: "en",
|
|
216
|
+
targetLanguage: outputLang,
|
|
217
|
+
},
|
|
218
|
+
featureOptions)
|
|
219
|
+
).result
|
|
217
220
|
: parsed.description
|
|
218
221
|
: "",
|
|
219
222
|
};
|
|
@@ -241,30 +244,30 @@ async function parsePostMetadataFromPromptResult(
|
|
|
241
244
|
typeof parsed.title === "string"
|
|
242
245
|
? outputLang && outputLang !== "en"
|
|
243
246
|
? (
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
247
|
+
await translate(
|
|
248
|
+
{
|
|
249
|
+
text: parsed.title,
|
|
250
|
+
sourceLanguage: "en",
|
|
251
|
+
targetLanguage: outputLang,
|
|
252
|
+
},
|
|
253
|
+
featureOptions,
|
|
254
|
+
)
|
|
255
|
+
).result
|
|
253
256
|
: parsed.title
|
|
254
257
|
: "",
|
|
255
258
|
excerpt:
|
|
256
259
|
typeof parsed.excerpt === "string"
|
|
257
260
|
? outputLang && outputLang !== "en"
|
|
258
261
|
? (
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
262
|
+
await translate(
|
|
263
|
+
{
|
|
264
|
+
text: parsed.excerpt,
|
|
265
|
+
sourceLanguage: "en",
|
|
266
|
+
targetLanguage: outputLang,
|
|
267
|
+
},
|
|
268
|
+
featureOptions,
|
|
269
|
+
)
|
|
270
|
+
).result
|
|
268
271
|
: parsed.excerpt
|
|
269
272
|
: "",
|
|
270
273
|
};
|
|
@@ -1038,8 +1041,8 @@ Follow these additional instructions: ${instructions}`
|
|
|
1038
1041
|
)?.label;
|
|
1039
1042
|
parts.push(
|
|
1040
1043
|
I18n.get("Output language") +
|
|
1041
|
-
|
|
1042
|
-
|
|
1044
|
+
": " +
|
|
1045
|
+
(lang ? I18n.get(lang) : outputLanguage),
|
|
1043
1046
|
);
|
|
1044
1047
|
}
|
|
1045
1048
|
if (mode === "summarize" && type && allowOverride?.type) {
|
|
@@ -1244,8 +1247,8 @@ Follow these additional instructions: ${instructions}`
|
|
|
1244
1247
|
description={
|
|
1245
1248
|
optionsDisplay !== "horizontal"
|
|
1246
1249
|
? I18n.get(
|
|
1247
|
-
|
|
1248
|
-
|
|
1250
|
+
"The topic or subject for the AI to write about.",
|
|
1251
|
+
)
|
|
1249
1252
|
: undefined
|
|
1250
1253
|
}
|
|
1251
1254
|
value={text || ""}
|
|
@@ -1281,8 +1284,8 @@ Follow these additional instructions: ${instructions}`
|
|
|
1281
1284
|
description={
|
|
1282
1285
|
optionsDisplay !== "horizontal"
|
|
1283
1286
|
? I18n.get(
|
|
1284
|
-
|
|
1285
|
-
|
|
1287
|
+
"Additional instructions to guide the AI.",
|
|
1288
|
+
)
|
|
1286
1289
|
: undefined
|
|
1287
1290
|
}
|
|
1288
1291
|
value={instructions || ""}
|
|
@@ -1314,8 +1317,8 @@ Follow these additional instructions: ${instructions}`
|
|
|
1314
1317
|
description={
|
|
1315
1318
|
optionsDisplay !== "horizontal"
|
|
1316
1319
|
? I18n.get(
|
|
1317
|
-
|
|
1318
|
-
|
|
1320
|
+
"The language of the input text.",
|
|
1321
|
+
)
|
|
1319
1322
|
: undefined
|
|
1320
1323
|
}
|
|
1321
1324
|
data={[
|
|
@@ -1357,17 +1360,17 @@ Follow these additional instructions: ${instructions}`
|
|
|
1357
1360
|
description={
|
|
1358
1361
|
optionsDisplay !== "horizontal"
|
|
1359
1362
|
? I18n.get(
|
|
1360
|
-
|
|
1361
|
-
|
|
1363
|
+
"The language AI-Kit should use for generated text by default (when applicable).",
|
|
1364
|
+
)
|
|
1362
1365
|
: undefined
|
|
1363
1366
|
}
|
|
1364
1367
|
data={[
|
|
1365
1368
|
...([
|
|
1366
1369
|
mode === "rewrite"
|
|
1367
1370
|
? {
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
+
value: "auto",
|
|
1372
|
+
label: I18n.get("Auto-detect"),
|
|
1373
|
+
}
|
|
1371
1374
|
: undefined,
|
|
1372
1375
|
].filter(Boolean) as {
|
|
1373
1376
|
value: string;
|
|
@@ -1457,40 +1460,40 @@ Follow these additional instructions: ${instructions}`
|
|
|
1457
1460
|
description={
|
|
1458
1461
|
optionsDisplay !== "horizontal"
|
|
1459
1462
|
? I18n.get(
|
|
1460
|
-
|
|
1461
|
-
|
|
1463
|
+
"The tone or style for the AI to use.",
|
|
1464
|
+
)
|
|
1462
1465
|
: undefined
|
|
1463
1466
|
}
|
|
1464
1467
|
data={
|
|
1465
1468
|
mode === "write"
|
|
1466
1469
|
? [
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1470
|
+
{
|
|
1471
|
+
value: "neutral",
|
|
1472
|
+
label: I18n.get("Neutral"),
|
|
1473
|
+
},
|
|
1474
|
+
{
|
|
1475
|
+
value: "formal",
|
|
1476
|
+
label: I18n.get("Formal"),
|
|
1477
|
+
},
|
|
1478
|
+
{
|
|
1479
|
+
value: "casual",
|
|
1480
|
+
label: I18n.get("Casual"),
|
|
1481
|
+
},
|
|
1482
|
+
]
|
|
1480
1483
|
: [
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1484
|
+
{
|
|
1485
|
+
value: "as-is",
|
|
1486
|
+
label: I18n.get("As-Is"),
|
|
1487
|
+
},
|
|
1488
|
+
{
|
|
1489
|
+
value: "more-formal",
|
|
1490
|
+
label: I18n.get("More formal"),
|
|
1491
|
+
},
|
|
1492
|
+
{
|
|
1493
|
+
value: "more-casual",
|
|
1494
|
+
label: I18n.get("More casual"),
|
|
1495
|
+
},
|
|
1496
|
+
]
|
|
1494
1497
|
}
|
|
1495
1498
|
value={
|
|
1496
1499
|
tone ||
|
|
@@ -1530,33 +1533,33 @@ Follow these additional instructions: ${instructions}`
|
|
|
1530
1533
|
data={
|
|
1531
1534
|
mode === "write" || mode === "summarize"
|
|
1532
1535
|
? [
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1536
|
+
{
|
|
1537
|
+
value: "short",
|
|
1538
|
+
label: I18n.get("Short"),
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
value: "medium",
|
|
1542
|
+
label: I18n.get("Medium"),
|
|
1543
|
+
},
|
|
1544
|
+
{
|
|
1545
|
+
value: "long",
|
|
1546
|
+
label: I18n.get("Long"),
|
|
1547
|
+
},
|
|
1548
|
+
]
|
|
1546
1549
|
: [
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1550
|
+
{
|
|
1551
|
+
value: "as-is",
|
|
1552
|
+
label: I18n.get("As-Is"),
|
|
1553
|
+
},
|
|
1554
|
+
{
|
|
1555
|
+
value: "shorter",
|
|
1556
|
+
label: I18n.get("Shorter"),
|
|
1557
|
+
},
|
|
1558
|
+
{
|
|
1559
|
+
value: "longer",
|
|
1560
|
+
label: I18n.get("Longer"),
|
|
1561
|
+
},
|
|
1562
|
+
]
|
|
1560
1563
|
}
|
|
1561
1564
|
value={
|
|
1562
1565
|
length ||
|
|
@@ -1594,8 +1597,8 @@ Follow these additional instructions: ${instructions}`
|
|
|
1594
1597
|
description={
|
|
1595
1598
|
optionsDisplay !== "horizontal"
|
|
1596
1599
|
? I18n.get(
|
|
1597
|
-
|
|
1598
|
-
|
|
1600
|
+
"The format for the generated output.",
|
|
1601
|
+
)
|
|
1599
1602
|
: undefined
|
|
1600
1603
|
}
|
|
1601
1604
|
data={[
|
|
@@ -1656,7 +1659,7 @@ Follow these additional instructions: ${instructions}`
|
|
|
1656
1659
|
<Stack mt="md">
|
|
1657
1660
|
{mode === "proofread" &&
|
|
1658
1661
|
((generated as ProofreadResult).corrections.length ===
|
|
1659
|
-
|
|
1662
|
+
0 ? (
|
|
1660
1663
|
<Alert color="green">
|
|
1661
1664
|
{I18n.get(
|
|
1662
1665
|
"No issues found. Your text looks great!",
|
|
@@ -1875,7 +1878,7 @@ Follow these additional instructions: ${instructions}`
|
|
|
1875
1878
|
!generated ||
|
|
1876
1879
|
(mode === "proofread" &&
|
|
1877
1880
|
(generated as ProofreadResult).corrections.length ===
|
|
1878
|
-
|
|
1881
|
+
0)
|
|
1879
1882
|
}
|
|
1880
1883
|
onClick={async () => {
|
|
1881
1884
|
onAccept(
|