@smart-cloud/ai-kit-ui 1.1.36 → 1.1.37

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.36",
3
+ "version": "1.1.37",
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.17",
23
+ "@smart-cloud/ai-kit-core": "^1.1.18",
24
24
  "@smart-cloud/wpsuite-core": "^2.1.2",
25
25
  "@tabler/icons-react": "^3.36.1",
26
26
  "chroma-js": "^3.2.0",
@@ -303,6 +303,7 @@ const AiFeatureBase: FC<AiFeatureProps & AiKitShellInjectedProps> = (props) => {
303
303
  default: defaults,
304
304
  onClose,
305
305
  onAccept,
306
+ onOptionsChanged,
306
307
  language,
307
308
  rootElement,
308
309
  } = props;
@@ -1247,7 +1248,11 @@ Follow these additional instructions: ${instructions}`
1247
1248
  value={text || ""}
1248
1249
  onChange={(
1249
1250
  e: React.ChangeEvent<HTMLInputElement>,
1250
- ) => setText(e.target.value)}
1251
+ ) => {
1252
+ const value = e.target.value;
1253
+ setText(value);
1254
+ onOptionsChanged?.({ text: value });
1255
+ }}
1251
1256
  />
1252
1257
  </Tooltip>
1253
1258
  )}
@@ -1280,7 +1285,11 @@ Follow these additional instructions: ${instructions}`
1280
1285
  value={instructions || ""}
1281
1286
  onChange={(
1282
1287
  e: React.ChangeEvent<HTMLInputElement>,
1283
- ) => setInstructions(e.target.value)}
1288
+ ) => {
1289
+ const value = e.target.value;
1290
+ setInstructions(value);
1291
+ onOptionsChanged?.({ instructions: value });
1292
+ }}
1284
1293
  />
1285
1294
  </Tooltip>
1286
1295
  )}
@@ -1319,9 +1328,11 @@ Follow these additional instructions: ${instructions}`
1319
1328
  ),
1320
1329
  ]}
1321
1330
  value={inputLanguage || "auto"}
1322
- onChange={(value) =>
1323
- setInputLanguage(value as AiKitLanguageCode)
1324
- }
1331
+ onChange={(value) => {
1332
+ const val = value as AiKitLanguageCode;
1333
+ setInputLanguage(val);
1334
+ onOptionsChanged?.({ inputLanguage: val });
1335
+ }}
1325
1336
  />
1326
1337
  </Tooltip>
1327
1338
  )}
@@ -1371,9 +1382,11 @@ Follow these additional instructions: ${instructions}`
1371
1382
  aiKit.settings.defaultOutputLanguage ||
1372
1383
  (mode === "rewrite" ? "auto" : "")
1373
1384
  }
1374
- onChange={(value) =>
1375
- setOutputLanguage(value as AiKitLanguageCode)
1376
- }
1385
+ onChange={(value) => {
1386
+ const val = value as AiKitLanguageCode;
1387
+ setOutputLanguage(val);
1388
+ onOptionsChanged?.({ outputLanguage: val });
1389
+ }}
1377
1390
  />
1378
1391
  </Tooltip>
1379
1392
  )}
@@ -1414,9 +1427,11 @@ Follow these additional instructions: ${instructions}`
1414
1427
  },
1415
1428
  ]}
1416
1429
  value={type || "key-points"}
1417
- onChange={(value) =>
1418
- setType(value as SummarizerType)
1419
- }
1430
+ onChange={(value) => {
1431
+ const val = value as SummarizerType;
1432
+ setType(val);
1433
+ onOptionsChanged?.({ type: val });
1434
+ }}
1420
1435
  />
1421
1436
  </Tooltip>
1422
1437
  )}
@@ -1478,9 +1493,13 @@ Follow these additional instructions: ${instructions}`
1478
1493
  tone ||
1479
1494
  (mode === "write" ? "neutral" : "as-is")
1480
1495
  }
1481
- onChange={(value) =>
1482
- setTone(value as WriterTone | RewriterTone)
1483
- }
1496
+ onChange={(value) => {
1497
+ const val = value as
1498
+ | WriterTone
1499
+ | RewriterTone;
1500
+ setTone(val);
1501
+ onOptionsChanged?.({ tone: val });
1502
+ }}
1484
1503
  />
1485
1504
  </Tooltip>
1486
1505
  )}
@@ -1540,14 +1559,14 @@ Follow these additional instructions: ${instructions}`
1540
1559
  length ||
1541
1560
  (mode === "rewrite" ? "as-is" : "short")
1542
1561
  }
1543
- onChange={(value) =>
1544
- setLength(
1545
- value as
1546
- | WriterLength
1547
- | RewriterLength
1548
- | SummarizerLength,
1549
- )
1550
- }
1562
+ onChange={(value) => {
1563
+ const val = value as
1564
+ | WriterLength
1565
+ | RewriterLength
1566
+ | SummarizerLength;
1567
+ setLength(val);
1568
+ onOptionsChanged?.({ length: val });
1569
+ }}
1551
1570
  />
1552
1571
  </Tooltip>
1553
1572
  )}
@@ -1591,14 +1610,14 @@ Follow these additional instructions: ${instructions}`
1591
1610
  },
1592
1611
  ]}
1593
1612
  value={outputFormat || "markdown"}
1594
- onChange={(value) =>
1595
- setOutputFormat(
1596
- value as
1597
- | "plain-text"
1598
- | "markdown"
1599
- | "html",
1600
- )
1601
- }
1613
+ onChange={(value) => {
1614
+ const val = value as
1615
+ | "plain-text"
1616
+ | "markdown"
1617
+ | "html";
1618
+ setOutputFormat(val);
1619
+ onOptionsChanged?.({ outputFormat: val });
1620
+ }}
1602
1621
  />
1603
1622
  </Tooltip>
1604
1623
  ))}