@smart-cloud/ai-kit-ui 1.1.36 → 1.1.38
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 +9 -9
- package/dist/index.d.cts +3 -10
- package/dist/index.d.ts +3 -10
- package/dist/index.js +9 -9
- package/package.json +2 -2
- package/src/ai-feature/AiFeature.tsx +55 -34
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.38",
|
|
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.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;
|
|
@@ -335,7 +336,7 @@ const AiFeatureBase: FC<AiFeatureProps & AiKitShellInjectedProps> = (props) => {
|
|
|
335
336
|
|
|
336
337
|
const [state, setState] = useState<string>();
|
|
337
338
|
const [featureOpen, setFeatureOpen] = useState<boolean>(!showOpenButton);
|
|
338
|
-
const [optionsOpen, setOptionsOpen] = useState<boolean>();
|
|
339
|
+
const [optionsOpen, setOptionsOpen] = useState<boolean>(false);
|
|
339
340
|
const [backendConfigured, setBackendConfigured] = useState(false);
|
|
340
341
|
const [error, setError] = useState<string | null>(null);
|
|
341
342
|
const [generated, setGenerated] = useState<never | null>(null);
|
|
@@ -969,7 +970,6 @@ Follow these additional instructions: ${instructions}`
|
|
|
969
970
|
|
|
970
971
|
useEffect(() => {
|
|
971
972
|
if (
|
|
972
|
-
optionsOpen !== false ||
|
|
973
973
|
!featureOpen ||
|
|
974
974
|
!autoRun ||
|
|
975
975
|
!canGenerate ||
|
|
@@ -997,7 +997,10 @@ Follow these additional instructions: ${instructions}`
|
|
|
997
997
|
useEffect(() => {
|
|
998
998
|
if (!allowOverrideParameters) return;
|
|
999
999
|
if (mode === "proofread") return;
|
|
1000
|
-
if (!canGenerate)
|
|
1000
|
+
if (!canGenerate) {
|
|
1001
|
+
setOptionsOpen(true);
|
|
1002
|
+
autoRunOnceRef.current = true;
|
|
1003
|
+
}
|
|
1001
1004
|
}, [allowOverrideParameters, canGenerate, mode]);
|
|
1002
1005
|
|
|
1003
1006
|
useEffect(() => {
|
|
@@ -1219,7 +1222,7 @@ Follow these additional instructions: ${instructions}`
|
|
|
1219
1222
|
)}
|
|
1220
1223
|
</Group>
|
|
1221
1224
|
|
|
1222
|
-
<CollapseComponent in={optionsOpen
|
|
1225
|
+
<CollapseComponent in={optionsOpen}>
|
|
1223
1226
|
{optionsDisplay === "collapse" && <Divider my="sm" />}
|
|
1224
1227
|
<OptionsComponent gap="xs" justify="space-between">
|
|
1225
1228
|
{/* TOPIC */}
|
|
@@ -1247,7 +1250,11 @@ Follow these additional instructions: ${instructions}`
|
|
|
1247
1250
|
value={text || ""}
|
|
1248
1251
|
onChange={(
|
|
1249
1252
|
e: React.ChangeEvent<HTMLInputElement>,
|
|
1250
|
-
) =>
|
|
1253
|
+
) => {
|
|
1254
|
+
const value = e.target.value;
|
|
1255
|
+
setText(value);
|
|
1256
|
+
onOptionsChanged?.({ text: value });
|
|
1257
|
+
}}
|
|
1251
1258
|
/>
|
|
1252
1259
|
</Tooltip>
|
|
1253
1260
|
)}
|
|
@@ -1280,7 +1287,11 @@ Follow these additional instructions: ${instructions}`
|
|
|
1280
1287
|
value={instructions || ""}
|
|
1281
1288
|
onChange={(
|
|
1282
1289
|
e: React.ChangeEvent<HTMLInputElement>,
|
|
1283
|
-
) =>
|
|
1290
|
+
) => {
|
|
1291
|
+
const value = e.target.value;
|
|
1292
|
+
setInstructions(value);
|
|
1293
|
+
onOptionsChanged?.({ instructions: value });
|
|
1294
|
+
}}
|
|
1284
1295
|
/>
|
|
1285
1296
|
</Tooltip>
|
|
1286
1297
|
)}
|
|
@@ -1319,9 +1330,11 @@ Follow these additional instructions: ${instructions}`
|
|
|
1319
1330
|
),
|
|
1320
1331
|
]}
|
|
1321
1332
|
value={inputLanguage || "auto"}
|
|
1322
|
-
onChange={(value) =>
|
|
1323
|
-
|
|
1324
|
-
|
|
1333
|
+
onChange={(value) => {
|
|
1334
|
+
const val = value as AiKitLanguageCode;
|
|
1335
|
+
setInputLanguage(val);
|
|
1336
|
+
onOptionsChanged?.({ inputLanguage: val });
|
|
1337
|
+
}}
|
|
1325
1338
|
/>
|
|
1326
1339
|
</Tooltip>
|
|
1327
1340
|
)}
|
|
@@ -1371,9 +1384,11 @@ Follow these additional instructions: ${instructions}`
|
|
|
1371
1384
|
aiKit.settings.defaultOutputLanguage ||
|
|
1372
1385
|
(mode === "rewrite" ? "auto" : "")
|
|
1373
1386
|
}
|
|
1374
|
-
onChange={(value) =>
|
|
1375
|
-
|
|
1376
|
-
|
|
1387
|
+
onChange={(value) => {
|
|
1388
|
+
const val = value as AiKitLanguageCode;
|
|
1389
|
+
setOutputLanguage(val);
|
|
1390
|
+
onOptionsChanged?.({ outputLanguage: val });
|
|
1391
|
+
}}
|
|
1377
1392
|
/>
|
|
1378
1393
|
</Tooltip>
|
|
1379
1394
|
)}
|
|
@@ -1414,9 +1429,11 @@ Follow these additional instructions: ${instructions}`
|
|
|
1414
1429
|
},
|
|
1415
1430
|
]}
|
|
1416
1431
|
value={type || "key-points"}
|
|
1417
|
-
onChange={(value) =>
|
|
1418
|
-
|
|
1419
|
-
|
|
1432
|
+
onChange={(value) => {
|
|
1433
|
+
const val = value as SummarizerType;
|
|
1434
|
+
setType(val);
|
|
1435
|
+
onOptionsChanged?.({ type: val });
|
|
1436
|
+
}}
|
|
1420
1437
|
/>
|
|
1421
1438
|
</Tooltip>
|
|
1422
1439
|
)}
|
|
@@ -1478,9 +1495,13 @@ Follow these additional instructions: ${instructions}`
|
|
|
1478
1495
|
tone ||
|
|
1479
1496
|
(mode === "write" ? "neutral" : "as-is")
|
|
1480
1497
|
}
|
|
1481
|
-
onChange={(value) =>
|
|
1482
|
-
|
|
1483
|
-
|
|
1498
|
+
onChange={(value) => {
|
|
1499
|
+
const val = value as
|
|
1500
|
+
| WriterTone
|
|
1501
|
+
| RewriterTone;
|
|
1502
|
+
setTone(val);
|
|
1503
|
+
onOptionsChanged?.({ tone: val });
|
|
1504
|
+
}}
|
|
1484
1505
|
/>
|
|
1485
1506
|
</Tooltip>
|
|
1486
1507
|
)}
|
|
@@ -1540,14 +1561,14 @@ Follow these additional instructions: ${instructions}`
|
|
|
1540
1561
|
length ||
|
|
1541
1562
|
(mode === "rewrite" ? "as-is" : "short")
|
|
1542
1563
|
}
|
|
1543
|
-
onChange={(value) =>
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
)
|
|
1550
|
-
}
|
|
1564
|
+
onChange={(value) => {
|
|
1565
|
+
const val = value as
|
|
1566
|
+
| WriterLength
|
|
1567
|
+
| RewriterLength
|
|
1568
|
+
| SummarizerLength;
|
|
1569
|
+
setLength(val);
|
|
1570
|
+
onOptionsChanged?.({ length: val });
|
|
1571
|
+
}}
|
|
1551
1572
|
/>
|
|
1552
1573
|
</Tooltip>
|
|
1553
1574
|
)}
|
|
@@ -1591,14 +1612,14 @@ Follow these additional instructions: ${instructions}`
|
|
|
1591
1612
|
},
|
|
1592
1613
|
]}
|
|
1593
1614
|
value={outputFormat || "markdown"}
|
|
1594
|
-
onChange={(value) =>
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
)
|
|
1601
|
-
}
|
|
1615
|
+
onChange={(value) => {
|
|
1616
|
+
const val = value as
|
|
1617
|
+
| "plain-text"
|
|
1618
|
+
| "markdown"
|
|
1619
|
+
| "html";
|
|
1620
|
+
setOutputFormat(val);
|
|
1621
|
+
onOptionsChanged?.({ outputFormat: val });
|
|
1622
|
+
}}
|
|
1602
1623
|
/>
|
|
1603
1624
|
</Tooltip>
|
|
1604
1625
|
))}
|