@smart-cloud/ai-kit-ui 1.5.30 → 1.5.32
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/LocaleDirectionProvider.d.ts +5 -0
- package/dist/ShadowBoundary.d.ts +31 -0
- package/dist/ai-chatbot/AiChatbot.d.ts +18 -0
- package/dist/ai-chatbot/AnswerPresentation.d.ts +5 -0
- package/dist/ai-chatbot/activityPresentation.d.ts +4 -0
- package/dist/ai-chatbot/answer-presentation-state.d.ts +10 -0
- package/dist/ai-chatbot/attachmentStorage.d.ts +19 -0
- package/dist/ai-chatbot/chatStream.d.ts +95 -0
- package/dist/ai-chatbot/citations.d.ts +15 -0
- package/dist/ai-chatbot/index.d.ts +2 -0
- package/dist/ai-chatbot/welcome.d.ts +4 -0
- package/dist/ai-feature/AiFeature.d.ts +29 -0
- package/dist/ai-feature/AiFeatureBorder.d.ts +5 -0
- package/dist/ai-feature/ProofreadDiff.d.ts +13 -0
- package/dist/ai-feature/index.d.ts +2 -0
- package/dist/ai-feature/utils.d.ts +1 -0
- package/dist/doc-search/DocSearch.d.ts +22 -0
- package/dist/doc-search/index.d.ts +1 -0
- package/dist/doc-search/initialFilters.d.ts +1 -0
- package/dist/doc-search/localizedOptions.d.ts +6 -0
- package/dist/errorHandling.d.ts +24 -0
- package/dist/i18n/ar.d.ts +1 -0
- package/dist/i18n/de.d.ts +1 -0
- package/dist/i18n/en.d.ts +1 -0
- package/dist/i18n/es.d.ts +1 -0
- package/dist/i18n/fr.d.ts +1 -0
- package/dist/i18n/he.d.ts +1 -0
- package/dist/i18n/hi.d.ts +1 -0
- package/dist/i18n/hu.d.ts +1 -0
- package/dist/i18n/id.d.ts +1 -0
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/it.d.ts +1 -0
- package/dist/i18n/ja.d.ts +1 -0
- package/dist/i18n/ko.d.ts +1 -0
- package/dist/i18n/nb.d.ts +1 -0
- package/dist/i18n/nl.d.ts +1 -0
- package/dist/i18n/pl.d.ts +1 -0
- package/dist/i18n/pt.d.ts +1 -0
- package/dist/i18n/ru.d.ts +1 -0
- package/dist/i18n/sv.d.ts +1 -0
- package/dist/i18n/th.d.ts +1 -0
- package/dist/i18n/tr.d.ts +1 -0
- package/dist/i18n/ua.d.ts +1 -0
- package/dist/i18n/zh.d.ts +1 -0
- package/dist/index.cjs +11 -11
- package/dist/index.d.ts +7 -0
- package/dist/index.js +11 -11
- package/dist/locale.d.ts +13 -0
- package/dist/poweredBy.d.ts +4 -0
- package/dist/shared/citation-display.d.ts +4 -0
- package/dist/useAiRun.d.ts +40 -0
- package/dist/withAiKitShell.d.ts +14 -0
- package/package.json +6 -6
package/dist/locale.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
|
+
import { type TranslationCatalogs } from "@smart-cloud/wpsuite-core";
|
|
3
|
+
export interface AiKitTranslator {
|
|
4
|
+
language: string;
|
|
5
|
+
customTranslations?: TranslationCatalogs | null;
|
|
6
|
+
get(key: string, fallback?: string): string;
|
|
7
|
+
}
|
|
8
|
+
export declare function useSiteLocale(): import("@smart-cloud/wpsuite-core").SiteLocaleSnapshot;
|
|
9
|
+
export declare function AiKitLocaleProvider({ language, customTranslations, children }: PropsWithChildren<{
|
|
10
|
+
language: string;
|
|
11
|
+
customTranslations?: TranslationCatalogs | null;
|
|
12
|
+
}>): import("react").JSX.Element;
|
|
13
|
+
export declare function useAiKitI18n(): AiKitTranslator;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Decode transport-escaped text once; React will escape the resulting text node. */
|
|
2
|
+
export declare function citationDisplayText(value: string | undefined): string | undefined;
|
|
3
|
+
/** Only decode encoded ampersands in URLs, preserving ordinary query parameters. */
|
|
4
|
+
export declare function citationLinkUrl(value: string | undefined): string | undefined;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AiKitLanguageCode, type AiKitStatusEvent } from "@smart-cloud/ai-kit-core";
|
|
2
|
+
import { type AiRunErrorDetails } from "./errorHandling";
|
|
3
|
+
export type AiRunState<T> = {
|
|
4
|
+
busy: boolean;
|
|
5
|
+
error: string | null;
|
|
6
|
+
errorDetails: AiRunErrorDetails | null;
|
|
7
|
+
statusEvent: AiKitStatusEvent | null;
|
|
8
|
+
result: T | null;
|
|
9
|
+
isCancelled: boolean;
|
|
10
|
+
/** Last known execution source (best-effort). */
|
|
11
|
+
lastSource: "on-device" | "backend" | null;
|
|
12
|
+
};
|
|
13
|
+
export type AiFeatureFunction<T> = (args: {
|
|
14
|
+
signal: AbortSignal;
|
|
15
|
+
onStatus: (e: AiKitStatusEvent) => void;
|
|
16
|
+
}) => Promise<T>;
|
|
17
|
+
export type UseAiRunResult<T> = AiRunState<T> & {
|
|
18
|
+
run: (func: AiFeatureFunction<T>) => Promise<T | null>;
|
|
19
|
+
cancel: () => void;
|
|
20
|
+
reset: () => void;
|
|
21
|
+
/** Current AbortSignal, if a run is in-flight. */
|
|
22
|
+
signal: AbortSignal | null;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Returns true if backend routing is configured in the current AiKit settings.
|
|
26
|
+
*
|
|
27
|
+
* This is intentionally conservative: it only checks *configuration*, not reachability.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isBackendConfigured(): Promise<boolean>;
|
|
30
|
+
export declare function readDefaultOutputLanguage(): AiKitLanguageCode;
|
|
31
|
+
/**
|
|
32
|
+
* Removes a single surrounding Markdown code fence.
|
|
33
|
+
*
|
|
34
|
+
* Handles common model outputs like:
|
|
35
|
+
* ```json
|
|
36
|
+
* {"a":1}
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function stripCodeFence(text: string): string;
|
|
40
|
+
export declare function useAiRun<T>(): UseAiRunResult<T>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AiWorkerProps } from "@smart-cloud/ai-kit-core";
|
|
2
|
+
import { type ComponentType } from "react";
|
|
3
|
+
export type AiKitShellInjectedProps = {
|
|
4
|
+
language?: string;
|
|
5
|
+
rootElement: HTMLElement;
|
|
6
|
+
/** Global portal target for an opened modal; its trigger stays local. */
|
|
7
|
+
modalRootElement?: HTMLElement;
|
|
8
|
+
};
|
|
9
|
+
type AiKitShellOptions = Partial<AiWorkerProps> & {
|
|
10
|
+
/** Used only by intentionally floating components such as the chatbot. */
|
|
11
|
+
overlayWholeComponent?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function withAiKitShell<P extends object>(RootComponent: ComponentType<P & AiKitShellInjectedProps>, propOverrides?: AiKitShellOptions): import("react").FC<P & Partial<AiWorkerProps>>;
|
|
14
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smart-cloud/ai-kit-ui",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@emotion/cache": "^11.14.0",
|
|
26
26
|
"@emotion/react": "^11.14.0",
|
|
27
27
|
"@mantine/colors-generator": "^8.3.18",
|
|
28
|
-
"@smart-cloud/ai-kit-core": "^1.5.
|
|
28
|
+
"@smart-cloud/ai-kit-core": "^1.5.18",
|
|
29
29
|
"@smart-cloud/wpsuite-core": "^2.4.3",
|
|
30
30
|
"@tabler/icons-react": "^3.46.0",
|
|
31
31
|
"chroma-js": "^3.2.0",
|
|
@@ -88,11 +88,11 @@
|
|
|
88
88
|
},
|
|
89
89
|
"resolutions": {
|
|
90
90
|
"@humanfs/node": "^0.16.8",
|
|
91
|
-
"brace-expansion": "^5.0.
|
|
91
|
+
"brace-expansion": "^5.0.10",
|
|
92
92
|
"esbuild": "^0.28.1",
|
|
93
93
|
"fast-xml-builder": "^1.3.0",
|
|
94
94
|
"fast-xml-parser": "^5.10.1",
|
|
95
|
-
"fast-uri": "^3.1.
|
|
95
|
+
"fast-uri": "^3.1.8",
|
|
96
96
|
"flatted": "^3.4.4",
|
|
97
97
|
"picomatch": "^4.0.5",
|
|
98
98
|
"rollup": "^4.62.3",
|
|
@@ -100,11 +100,11 @@
|
|
|
100
100
|
},
|
|
101
101
|
"overrides": {
|
|
102
102
|
"@humanfs/node": "^0.16.8",
|
|
103
|
-
"brace-expansion": "^5.0.
|
|
103
|
+
"brace-expansion": "^5.0.10",
|
|
104
104
|
"esbuild": "^0.28.1",
|
|
105
105
|
"fast-xml-builder": "^1.3.0",
|
|
106
106
|
"fast-xml-parser": "^5.10.1",
|
|
107
|
-
"fast-uri": "^3.1.
|
|
107
|
+
"fast-uri": "^3.1.8",
|
|
108
108
|
"flatted": "^3.4.4",
|
|
109
109
|
"picomatch": "^4.0.5",
|
|
110
110
|
"rollup": "^4.62.3"
|