@smart-cloud/ai-kit-ui 1.1.20 → 1.1.23
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 +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +9 -9
- package/package.json +19 -19
- package/src/ai-feature/AiFeature.tsx +13 -0
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.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@emotion/cache": "^11.14.0",
|
|
21
21
|
"@emotion/react": "^11.14.0",
|
|
22
|
-
"@mantine/colors-generator": "^8.3.
|
|
23
|
-
"@smart-cloud/ai-kit-core": "^1.1.
|
|
24
|
-
"@smart-cloud/wpsuite-core": "^2.
|
|
22
|
+
"@mantine/colors-generator": "^8.3.14",
|
|
23
|
+
"@smart-cloud/ai-kit-core": "^1.1.11",
|
|
24
|
+
"@smart-cloud/wpsuite-core": "^2.1.1",
|
|
25
25
|
"@tabler/icons-react": "^3.36.1",
|
|
26
26
|
"chroma-js": "^3.2.0",
|
|
27
27
|
"react-markdown": "^10.1.0",
|
|
@@ -33,36 +33,36 @@
|
|
|
33
33
|
"unified": "^11.0.5"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@mantine/core": "^8.3.
|
|
37
|
-
"@mantine/hooks": "^8.3.
|
|
38
|
-
"@mantine/modals": "^8.3.
|
|
39
|
-
"@wordpress/data": "^10.
|
|
40
|
-
"aws-amplify": "^6.
|
|
36
|
+
"@mantine/core": "^8.3.14",
|
|
37
|
+
"@mantine/hooks": "^8.3.14",
|
|
38
|
+
"@mantine/modals": "^8.3.14",
|
|
39
|
+
"@wordpress/data": "^10.39.0",
|
|
40
|
+
"aws-amplify": "^6.16.0",
|
|
41
41
|
"react": "^18.3.1",
|
|
42
42
|
"react-dom": "^18.3.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@eslint/js": "^9.39.2",
|
|
46
|
-
"@mantine/core": "^8.3.
|
|
47
|
-
"@mantine/hooks": "^8.3.
|
|
48
|
-
"@mantine/modals": "^8.3.
|
|
46
|
+
"@mantine/core": "^8.3.14",
|
|
47
|
+
"@mantine/hooks": "^8.3.14",
|
|
48
|
+
"@mantine/modals": "^8.3.14",
|
|
49
49
|
"@types/dom-chromium-ai": "^0.0.13",
|
|
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.
|
|
55
|
-
"@wordpress/data": "^10.
|
|
53
|
+
"@typescript-eslint/eslint-plugin": "^8.54.0",
|
|
54
|
+
"@typescript-eslint/parser": "^8.54.0",
|
|
55
|
+
"@wordpress/data": "^10.39.0",
|
|
56
56
|
"ajv": "^8.17.1",
|
|
57
|
-
"aws-amplify": "^6.
|
|
57
|
+
"aws-amplify": "^6.16.0",
|
|
58
58
|
"eslint": "^9.39.2",
|
|
59
|
-
"globals": "^17.
|
|
60
|
-
"jquery": "^
|
|
59
|
+
"globals": "^17.3.0",
|
|
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.54.0"
|
|
66
66
|
},
|
|
67
67
|
"exports": {
|
|
68
68
|
".": {
|
|
@@ -143,6 +143,7 @@ async function detectTopLanguage(
|
|
|
143
143
|
onStatus?: (e: AiKitStatusEvent) => void;
|
|
144
144
|
context?: ContextKind;
|
|
145
145
|
modeOverride?: AiModePreference;
|
|
146
|
+
onDeviceTimeout?: number;
|
|
146
147
|
},
|
|
147
148
|
): Promise<AiKitLanguageCode> {
|
|
148
149
|
const res: DetectLanguageOutput = await detectLanguage(
|
|
@@ -152,6 +153,7 @@ async function detectTopLanguage(
|
|
|
152
153
|
onStatus: args.onStatus,
|
|
153
154
|
context: args.context,
|
|
154
155
|
modeOverride: args.modeOverride,
|
|
156
|
+
onDeviceTimeoutOverride: args.onDeviceTimeout,
|
|
155
157
|
},
|
|
156
158
|
);
|
|
157
159
|
const top =
|
|
@@ -284,6 +286,7 @@ const AiFeatureBase: FC<AiFeatureProps & AiKitShellInjectedProps> = (props) => {
|
|
|
284
286
|
allowOverride: allowOverrideDefaults,
|
|
285
287
|
autoRun = true,
|
|
286
288
|
editable = true,
|
|
289
|
+
onDeviceTimeout,
|
|
287
290
|
variation = props.variation || "default",
|
|
288
291
|
title,
|
|
289
292
|
showOpenButton = false,
|
|
@@ -496,6 +499,7 @@ const AiFeatureBase: FC<AiFeatureProps & AiKitShellInjectedProps> = (props) => {
|
|
|
496
499
|
onStatus,
|
|
497
500
|
context,
|
|
498
501
|
modeOverride,
|
|
502
|
+
onDeviceTimeoutOverride: onDeviceTimeout,
|
|
499
503
|
});
|
|
500
504
|
return out.result;
|
|
501
505
|
});
|
|
@@ -526,6 +530,7 @@ const AiFeatureBase: FC<AiFeatureProps & AiKitShellInjectedProps> = (props) => {
|
|
|
526
530
|
onStatus,
|
|
527
531
|
context,
|
|
528
532
|
modeOverride,
|
|
533
|
+
onDeviceTimeoutOverride: onDeviceTimeout,
|
|
529
534
|
});
|
|
530
535
|
return out.result;
|
|
531
536
|
});
|
|
@@ -538,6 +543,7 @@ const AiFeatureBase: FC<AiFeatureProps & AiKitShellInjectedProps> = (props) => {
|
|
|
538
543
|
if (inputLang === "auto") {
|
|
539
544
|
inputLang = await detectTopLanguage(text!.trim(), {
|
|
540
545
|
signal,
|
|
546
|
+
onDeviceTimeout,
|
|
541
547
|
});
|
|
542
548
|
setInputLanguage(inputLang);
|
|
543
549
|
}
|
|
@@ -563,6 +569,7 @@ const AiFeatureBase: FC<AiFeatureProps & AiKitShellInjectedProps> = (props) => {
|
|
|
563
569
|
onStatus,
|
|
564
570
|
context,
|
|
565
571
|
modeOverride,
|
|
572
|
+
onDeviceTimeoutOverride: onDeviceTimeout,
|
|
566
573
|
});
|
|
567
574
|
return out.result;
|
|
568
575
|
});
|
|
@@ -578,6 +585,7 @@ const AiFeatureBase: FC<AiFeatureProps & AiKitShellInjectedProps> = (props) => {
|
|
|
578
585
|
if (outputLanguage === "auto") {
|
|
579
586
|
outLang = await detectTopLanguage(text!.trim(), {
|
|
580
587
|
signal,
|
|
588
|
+
onDeviceTimeout,
|
|
581
589
|
});
|
|
582
590
|
setOutputLanguage(outLang);
|
|
583
591
|
}
|
|
@@ -595,6 +603,7 @@ const AiFeatureBase: FC<AiFeatureProps & AiKitShellInjectedProps> = (props) => {
|
|
|
595
603
|
onStatus,
|
|
596
604
|
context,
|
|
597
605
|
modeOverride,
|
|
606
|
+
onDeviceTimeoutOverride: onDeviceTimeout,
|
|
598
607
|
});
|
|
599
608
|
return out.result;
|
|
600
609
|
});
|
|
@@ -619,6 +628,7 @@ const AiFeatureBase: FC<AiFeatureProps & AiKitShellInjectedProps> = (props) => {
|
|
|
619
628
|
text!.trim() + "\n" + (instructions?.trim() || ""),
|
|
620
629
|
{
|
|
621
630
|
signal,
|
|
631
|
+
onDeviceTimeout,
|
|
622
632
|
},
|
|
623
633
|
);
|
|
624
634
|
if (inLang !== outLang && inLang !== "en") {
|
|
@@ -644,6 +654,7 @@ const AiFeatureBase: FC<AiFeatureProps & AiKitShellInjectedProps> = (props) => {
|
|
|
644
654
|
onStatus,
|
|
645
655
|
context,
|
|
646
656
|
modeOverride,
|
|
657
|
+
onDeviceTimeoutOverride: onDeviceTimeout,
|
|
647
658
|
});
|
|
648
659
|
return out.result;
|
|
649
660
|
});
|
|
@@ -684,6 +695,7 @@ Follow these additional instructions: ${instructions}`
|
|
|
684
695
|
onStatus,
|
|
685
696
|
context,
|
|
686
697
|
modeOverride,
|
|
698
|
+
onDeviceTimeoutOverride: onDeviceTimeout,
|
|
687
699
|
},
|
|
688
700
|
);
|
|
689
701
|
return out.result;
|
|
@@ -758,6 +770,7 @@ Follow these additional instructions: ${instructions}`
|
|
|
758
770
|
onStatus,
|
|
759
771
|
context,
|
|
760
772
|
modeOverride,
|
|
773
|
+
onDeviceTimeoutOverride: onDeviceTimeout,
|
|
761
774
|
},
|
|
762
775
|
);
|
|
763
776
|
return out.result;
|