@smart-cloud/ai-kit-ui 1.1.38 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart-cloud/ai-kit-ui",
3
- "version": "1.1.38",
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.18",
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": "^9.39.2",
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.13",
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.0",
54
- "@typescript-eslint/parser": "^8.54.0",
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": "^9.39.2",
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.54.0"
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
- await translate(
173
- {
174
- text: parsed.alt,
175
- sourceLanguage: "en",
176
- targetLanguage: outputLang,
177
- },
178
- featureOptions,
179
- )
180
- ).result
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
- await translate({
188
- text: parsed.title,
189
- sourceLanguage: "en",
190
- targetLanguage: outputLang,
191
- })
192
- ).result
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
- await translate({
200
- text: parsed.caption,
201
- sourceLanguage: "en",
202
- targetLanguage: outputLang,
203
- })
204
- ).result
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
- await translate({
212
- text: parsed.description,
213
- sourceLanguage: "en",
214
- targetLanguage: outputLang,
215
- })
216
- ).result
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
- await translate(
245
- {
246
- text: parsed.title,
247
- sourceLanguage: "en",
248
- targetLanguage: outputLang,
249
- },
250
- featureOptions,
251
- )
252
- ).result
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
- await translate(
260
- {
261
- text: parsed.excerpt,
262
- sourceLanguage: "en",
263
- targetLanguage: outputLang,
264
- },
265
- featureOptions,
266
- )
267
- ).result
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
  };
@@ -525,6 +528,7 @@ const AiFeatureBase: FC<AiFeatureProps & AiKitShellInjectedProps> = (props) => {
525
528
  const res = await ai.run(async ({ signal, onStatus }) => {
526
529
  const expectedInputLanguages: AiKitLanguageCode[] = [];
527
530
  try {
531
+ setState("Detecting input language...");
528
532
  const res = await detectLanguage(
529
533
  { text: text!.trim() },
530
534
  {
@@ -1037,8 +1041,8 @@ Follow these additional instructions: ${instructions}`
1037
1041
  )?.label;
1038
1042
  parts.push(
1039
1043
  I18n.get("Output language") +
1040
- ": " +
1041
- (lang ? I18n.get(lang) : outputLanguage),
1044
+ ": " +
1045
+ (lang ? I18n.get(lang) : outputLanguage),
1042
1046
  );
1043
1047
  }
1044
1048
  if (mode === "summarize" && type && allowOverride?.type) {
@@ -1243,8 +1247,8 @@ Follow these additional instructions: ${instructions}`
1243
1247
  description={
1244
1248
  optionsDisplay !== "horizontal"
1245
1249
  ? I18n.get(
1246
- "The topic or subject for the AI to write about.",
1247
- )
1250
+ "The topic or subject for the AI to write about.",
1251
+ )
1248
1252
  : undefined
1249
1253
  }
1250
1254
  value={text || ""}
@@ -1280,8 +1284,8 @@ Follow these additional instructions: ${instructions}`
1280
1284
  description={
1281
1285
  optionsDisplay !== "horizontal"
1282
1286
  ? I18n.get(
1283
- "Additional instructions to guide the AI.",
1284
- )
1287
+ "Additional instructions to guide the AI.",
1288
+ )
1285
1289
  : undefined
1286
1290
  }
1287
1291
  value={instructions || ""}
@@ -1313,8 +1317,8 @@ Follow these additional instructions: ${instructions}`
1313
1317
  description={
1314
1318
  optionsDisplay !== "horizontal"
1315
1319
  ? I18n.get(
1316
- "The language of the input text.",
1317
- )
1320
+ "The language of the input text.",
1321
+ )
1318
1322
  : undefined
1319
1323
  }
1320
1324
  data={[
@@ -1356,17 +1360,17 @@ Follow these additional instructions: ${instructions}`
1356
1360
  description={
1357
1361
  optionsDisplay !== "horizontal"
1358
1362
  ? I18n.get(
1359
- "The language AI-Kit should use for generated text by default (when applicable).",
1360
- )
1363
+ "The language AI-Kit should use for generated text by default (when applicable).",
1364
+ )
1361
1365
  : undefined
1362
1366
  }
1363
1367
  data={[
1364
1368
  ...([
1365
1369
  mode === "rewrite"
1366
1370
  ? {
1367
- value: "auto",
1368
- label: I18n.get("Auto-detect"),
1369
- }
1371
+ value: "auto",
1372
+ label: I18n.get("Auto-detect"),
1373
+ }
1370
1374
  : undefined,
1371
1375
  ].filter(Boolean) as {
1372
1376
  value: string;
@@ -1456,40 +1460,40 @@ Follow these additional instructions: ${instructions}`
1456
1460
  description={
1457
1461
  optionsDisplay !== "horizontal"
1458
1462
  ? I18n.get(
1459
- "The tone or style for the AI to use.",
1460
- )
1463
+ "The tone or style for the AI to use.",
1464
+ )
1461
1465
  : undefined
1462
1466
  }
1463
1467
  data={
1464
1468
  mode === "write"
1465
1469
  ? [
1466
- {
1467
- value: "neutral",
1468
- label: I18n.get("Neutral"),
1469
- },
1470
- {
1471
- value: "formal",
1472
- label: I18n.get("Formal"),
1473
- },
1474
- {
1475
- value: "casual",
1476
- label: I18n.get("Casual"),
1477
- },
1478
- ]
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
+ ]
1479
1483
  : [
1480
- {
1481
- value: "as-is",
1482
- label: I18n.get("As-Is"),
1483
- },
1484
- {
1485
- value: "more-formal",
1486
- label: I18n.get("More formal"),
1487
- },
1488
- {
1489
- value: "more-casual",
1490
- label: I18n.get("More casual"),
1491
- },
1492
- ]
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
+ ]
1493
1497
  }
1494
1498
  value={
1495
1499
  tone ||
@@ -1529,33 +1533,33 @@ Follow these additional instructions: ${instructions}`
1529
1533
  data={
1530
1534
  mode === "write" || mode === "summarize"
1531
1535
  ? [
1532
- {
1533
- value: "short",
1534
- label: I18n.get("Short"),
1535
- },
1536
- {
1537
- value: "medium",
1538
- label: I18n.get("Medium"),
1539
- },
1540
- {
1541
- value: "long",
1542
- label: I18n.get("Long"),
1543
- },
1544
- ]
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
+ ]
1545
1549
  : [
1546
- {
1547
- value: "as-is",
1548
- label: I18n.get("As-Is"),
1549
- },
1550
- {
1551
- value: "shorter",
1552
- label: I18n.get("Shorter"),
1553
- },
1554
- {
1555
- value: "longer",
1556
- label: I18n.get("Longer"),
1557
- },
1558
- ]
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
+ ]
1559
1563
  }
1560
1564
  value={
1561
1565
  length ||
@@ -1593,8 +1597,8 @@ Follow these additional instructions: ${instructions}`
1593
1597
  description={
1594
1598
  optionsDisplay !== "horizontal"
1595
1599
  ? I18n.get(
1596
- "The format for the generated output.",
1597
- )
1600
+ "The format for the generated output.",
1601
+ )
1598
1602
  : undefined
1599
1603
  }
1600
1604
  data={[
@@ -1655,7 +1659,7 @@ Follow these additional instructions: ${instructions}`
1655
1659
  <Stack mt="md">
1656
1660
  {mode === "proofread" &&
1657
1661
  ((generated as ProofreadResult).corrections.length ===
1658
- 0 ? (
1662
+ 0 ? (
1659
1663
  <Alert color="green">
1660
1664
  {I18n.get(
1661
1665
  "No issues found. Your text looks great!",
@@ -1874,7 +1878,7 @@ Follow these additional instructions: ${instructions}`
1874
1878
  !generated ||
1875
1879
  (mode === "proofread" &&
1876
1880
  (generated as ProofreadResult).corrections.length ===
1877
- 0)
1881
+ 0)
1878
1882
  }
1879
1883
  onClick={async () => {
1880
1884
  onAccept(