@blocklet/pages-kit 0.2.286 → 0.2.287
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/lib/cjs/builtin/async/ai-runtime/api/assistant.js +26 -0
- package/lib/cjs/builtin/async/ai-runtime/api/dataset.js +127 -0
- package/lib/cjs/builtin/async/ai-runtime/api/message.js +33 -0
- package/lib/cjs/builtin/async/ai-runtime/api/request.js +47 -0
- package/lib/cjs/builtin/async/ai-runtime/api/session.js +121 -0
- package/lib/cjs/builtin/async/ai-runtime/api/subscription.js +32 -0
- package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +63 -0
- package/lib/cjs/builtin/async/ai-runtime/components/GlobalLoading.js +60 -0
- package/lib/cjs/builtin/async/ai-runtime/components/LoadingButton.js +40 -0
- package/lib/cjs/builtin/async/ai-runtime/components/LoadingListItemButton.js +51 -0
- package/lib/cjs/builtin/async/ai-runtime/components/MarkdownRenderer.js +156 -0
- package/lib/cjs/builtin/async/ai-runtime/components/MenuButton.js +43 -0
- package/lib/cjs/builtin/async/ai-runtime/components/PoweredBy.js +30 -0
- package/lib/cjs/builtin/async/ai-runtime/components/RuntimeProvider.js +16 -0
- package/lib/cjs/builtin/async/ai-runtime/components/ScrollView.js +109 -0
- package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +102 -0
- package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +193 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +92 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionListView.js +197 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionView.js +122 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentListView.js +152 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentView.js +135 -0
- package/lib/cjs/builtin/async/ai-runtime/components/common/ChatBot.js +105 -0
- package/lib/cjs/builtin/async/ai-runtime/components/common/MessageMetadataRenderer.js +21 -0
- package/lib/cjs/builtin/async/ai-runtime/components/common/MessageSuggestedQuestions.js +35 -0
- package/lib/cjs/builtin/async/ai-runtime/components/common/index.js +12 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterForm.js +48 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +66 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormFields.js +43 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/QuestionField.js +44 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/SettingButton.js +76 -0
- package/lib/cjs/builtin/async/ai-runtime/components/layout/index.js +15 -0
- package/lib/cjs/builtin/async/ai-runtime/components/lottie/index.js +34 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageActions.js +38 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageErrorView.js +30 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageItemView.js +134 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageListView.js +48 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/ReferenceLinks.js +11 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/LanguageField.js +55 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/NumberField.js +21 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/SelectField.js +24 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/StringField.js +21 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/index.js +37 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +94 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +48 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHome.js +21 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +67 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/index.js +15 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +103 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +22 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +72 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.js +31 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/index.js +22 -0
- package/lib/cjs/builtin/async/ai-runtime/components/session/CheckSession.js +62 -0
- package/lib/cjs/builtin/async/ai-runtime/components/session/SessionListView.js +88 -0
- package/lib/cjs/builtin/async/ai-runtime/constants.js +5 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/header.js +32 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/navigate.js +37 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/subscribe.js +35 -0
- package/lib/cjs/builtin/async/ai-runtime/index.js +75 -0
- package/lib/cjs/builtin/async/ai-runtime/locales/index.js +147 -0
- package/lib/cjs/builtin/async/ai-runtime/state/assistant.js +59 -0
- package/lib/cjs/builtin/async/ai-runtime/state/index.js +423 -0
- package/lib/cjs/builtin/async/ai-runtime/state/session.js +217 -0
- package/lib/cjs/builtin/async/ai-runtime/state/subscription.js +52 -0
- package/lib/cjs/builtin/async/ai-runtime/utils.js +49 -0
- package/lib/cjs/builtin/async/react-scroll-to-bottom.js +1 -1
- package/lib/cjs/utils/builtin.js +1 -0
- package/lib/cjs/utils/inject-global-components.js +2 -0
- package/lib/esm/builtin/async/ai-runtime/api/assistant.js +22 -0
- package/lib/esm/builtin/async/ai-runtime/api/dataset.js +113 -0
- package/lib/esm/builtin/async/ai-runtime/api/message.js +28 -0
- package/lib/esm/builtin/async/ai-runtime/api/request.js +43 -0
- package/lib/esm/builtin/async/ai-runtime/api/session.js +112 -0
- package/lib/esm/builtin/async/ai-runtime/api/subscription.js +27 -0
- package/lib/esm/builtin/async/ai-runtime/components/ActionButton.js +56 -0
- package/lib/esm/builtin/async/ai-runtime/components/GlobalLoading.js +56 -0
- package/lib/esm/builtin/async/ai-runtime/components/LoadingButton.js +38 -0
- package/lib/esm/builtin/async/ai-runtime/components/LoadingListItemButton.js +48 -0
- package/lib/esm/builtin/async/ai-runtime/components/MarkdownRenderer.js +129 -0
- package/lib/esm/builtin/async/ai-runtime/components/MenuButton.js +40 -0
- package/lib/esm/builtin/async/ai-runtime/components/PoweredBy.js +27 -0
- package/lib/esm/builtin/async/ai-runtime/components/RuntimeProvider.js +10 -0
- package/lib/esm/builtin/async/ai-runtime/components/ScrollView.js +101 -0
- package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +93 -0
- package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +190 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +92 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionListView.js +197 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionView.js +122 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentListView.js +152 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentView.js +135 -0
- package/lib/esm/builtin/async/ai-runtime/components/common/ChatBot.js +99 -0
- package/lib/esm/builtin/async/ai-runtime/components/common/MessageMetadataRenderer.js +15 -0
- package/lib/esm/builtin/async/ai-runtime/components/common/MessageSuggestedQuestions.js +30 -0
- package/lib/esm/builtin/async/ai-runtime/components/common/index.js +3 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterForm.js +42 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +59 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormFields.js +37 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/QuestionField.js +38 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/SettingButton.js +73 -0
- package/lib/esm/builtin/async/ai-runtime/components/layout/index.js +12 -0
- package/lib/esm/builtin/async/ai-runtime/components/lottie/index.js +8 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageActions.js +35 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageErrorView.js +24 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageItemView.js +105 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageListView.js +42 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/ReferenceLinks.js +8 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/LanguageField.js +53 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/NumberField.js +19 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/SelectField.js +22 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/StringField.js +19 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/index.js +31 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +88 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +22 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHome.js +15 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +61 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/index.js +9 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +97 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +19 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +66 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.js +25 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/index.js +16 -0
- package/lib/esm/builtin/async/ai-runtime/components/session/CheckSession.js +59 -0
- package/lib/esm/builtin/async/ai-runtime/components/session/SessionListView.js +88 -0
- package/lib/esm/builtin/async/ai-runtime/constants.js +2 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/header.js +25 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/navigate.js +31 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/subscribe.js +31 -0
- package/lib/esm/builtin/async/ai-runtime/index.js +66 -0
- package/lib/esm/builtin/async/ai-runtime/locales/index.js +144 -0
- package/lib/esm/builtin/async/ai-runtime/state/assistant.js +54 -0
- package/lib/esm/builtin/async/ai-runtime/state/index.js +423 -0
- package/lib/esm/builtin/async/ai-runtime/state/session.js +209 -0
- package/lib/esm/builtin/async/ai-runtime/state/subscription.js +47 -0
- package/lib/esm/builtin/async/ai-runtime/utils.js +42 -0
- package/lib/esm/builtin/async/react-scroll-to-bottom.js +1 -1
- package/lib/esm/utils/builtin.js +1 -0
- package/lib/esm/utils/inject-global-components.js +2 -0
- package/lib/types/builtin/async/ai-runtime/api/assistant.d.ts +18 -0
- package/lib/types/builtin/async/ai-runtime/api/dataset.d.ts +39 -0
- package/lib/types/builtin/async/ai-runtime/api/message.d.ts +39 -0
- package/lib/types/builtin/async/ai-runtime/api/request.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/api/session.d.ts +54 -0
- package/lib/types/builtin/async/ai-runtime/api/subscription.d.ts +15 -0
- package/lib/types/builtin/async/ai-runtime/components/ActionButton.d.ts +11 -0
- package/lib/types/builtin/async/ai-runtime/components/GlobalLoading.d.ts +33 -0
- package/lib/types/builtin/async/ai-runtime/components/LoadingButton.d.ts +3 -0
- package/lib/types/builtin/async/ai-runtime/components/LoadingListItemButton.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/components/MarkdownRenderer.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/components/MenuButton.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/PoweredBy.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/RuntimeProvider.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/ScrollView.d.ts +61 -0
- package/lib/types/builtin/async/ai-runtime/components/SocialShare.d.ts +17 -0
- package/lib/types/builtin/async/ai-runtime/components/ThemeProvider.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionEditDialog.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/DocumentListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/DocumentView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/common/ChatBot.d.ts +13 -0
- package/lib/types/builtin/async/ai-runtime/components/common/MessageMetadataRenderer.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/common/MessageSuggestedQuestions.d.ts +7 -0
- package/lib/types/builtin/async/ai-runtime/components/common/index.d.ts +3 -0
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterForm.d.ts +12 -0
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormDialog.d.ts +28 -0
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormFields.d.ts +8 -0
- package/lib/types/builtin/async/ai-runtime/components/form/QuestionField.d.ts +13 -0
- package/lib/types/builtin/async/ai-runtime/components/form/SettingButton.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/layout/index.d.ts +7 -0
- package/lib/types/builtin/async/ai-runtime/components/lottie/index.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/message/MessageActions.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/message/MessageErrorView.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/components/message/MessageItemView.d.ts +10 -0
- package/lib/types/builtin/async/ai-runtime/components/message/MessageListView.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/message/ReferenceLinks.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/LanguageField.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/NumberField.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/SelectField.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/StringField.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/index.d.ts +7 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/InitialForm.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHome.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/index.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/index.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/session/CheckSession.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/session/SessionListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/constants.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/hooks/header.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/hooks/navigate.d.ts +25 -0
- package/lib/types/builtin/async/ai-runtime/hooks/subscribe.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/index.d.ts +17 -0
- package/lib/types/builtin/async/ai-runtime/locales/index.d.ts +126 -0
- package/lib/types/builtin/async/ai-runtime/state/assistant.d.ts +17 -0
- package/lib/types/builtin/async/ai-runtime/state/index.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/state/session.d.ts +40 -0
- package/lib/types/builtin/async/ai-runtime/state/subscription.d.ts +15 -0
- package/lib/types/builtin/async/ai-runtime/utils.d.ts +20 -0
- package/lib/types/builtin/async/react-scroll-to-bottom.d.ts +3 -2
- package/lib/types/builtin/session.d.ts +11 -1
- package/lib/types/utils/builtin.d.ts +1 -0
- package/package.json +12 -7
- package/tsconfig.json +5 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Parameter } from '@blocklet/ai-runtime/types';
|
|
2
|
+
import { TextFieldProps } from '@mui/material';
|
|
3
|
+
export default function ParameterField({ parameter, ...props }: {
|
|
4
|
+
readOnly?: boolean;
|
|
5
|
+
parameter: Parameter;
|
|
6
|
+
onChange: (value: string | number | undefined) => void;
|
|
7
|
+
} & Omit<TextFieldProps, 'onChange'>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { RuntimeNavigate } from '../../hooks/navigate';
|
|
3
|
+
export default function CheckSession({ assistantId, sessionId, autoCreateSession, children, navigate, }: {
|
|
4
|
+
assistantId: string;
|
|
5
|
+
sessionId?: string;
|
|
6
|
+
autoCreateSession?: boolean;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
navigate?: RuntimeNavigate;
|
|
9
|
+
}): ReactNode;
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NavigateOptions } from 'react-router-dom';
|
|
2
|
+
export declare function useNavigateTo(): (query: {
|
|
3
|
+
[key: string]: string | number | undefined;
|
|
4
|
+
}) => string;
|
|
5
|
+
export declare function useNavigateWithQuery(): RuntimeNavigate;
|
|
6
|
+
export type Page = 'assistant' | 'session';
|
|
7
|
+
export type CurrentPage = {
|
|
8
|
+
page: 'assistant';
|
|
9
|
+
assistantId: string;
|
|
10
|
+
sessionId?: string;
|
|
11
|
+
} | {
|
|
12
|
+
page: 'session';
|
|
13
|
+
assistantId: string;
|
|
14
|
+
sessionId: string;
|
|
15
|
+
};
|
|
16
|
+
export type PageState = {
|
|
17
|
+
navigate: RuntimeNavigate;
|
|
18
|
+
} & CurrentPage;
|
|
19
|
+
export interface RuntimeNavigate {
|
|
20
|
+
(page: Omit<CurrentPage, 'navigate'>, options?: NavigateOptions): void;
|
|
21
|
+
}
|
|
22
|
+
export declare function useCurrentPage(): PageState;
|
|
23
|
+
export declare function useCurrentPage<P extends Page>(page: P): PageState & {
|
|
24
|
+
page: P;
|
|
25
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Assistant } from './api/assistant';
|
|
2
|
+
import type { ChatBotProps } from './components/common/ChatBot';
|
|
3
|
+
export declare function getServerSideProps(): Promise<{
|
|
4
|
+
props: {
|
|
5
|
+
preload: {
|
|
6
|
+
assistantId: string;
|
|
7
|
+
assistant: Assistant | undefined;
|
|
8
|
+
} | undefined;
|
|
9
|
+
};
|
|
10
|
+
}>;
|
|
11
|
+
export default function AIRuntime({ preload }: {
|
|
12
|
+
preload?: {
|
|
13
|
+
assistantId: string;
|
|
14
|
+
assistant: Assistant;
|
|
15
|
+
};
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function ChatBot(props: ChatBotProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
export declare const translations: {
|
|
2
|
+
en: {
|
|
3
|
+
socialShare: {
|
|
4
|
+
shareToX: string;
|
|
5
|
+
shareToTelegram: string;
|
|
6
|
+
shareToReddit: string;
|
|
7
|
+
shareToWeibo: string;
|
|
8
|
+
shareToFacebook: string;
|
|
9
|
+
shareToLinkedin: string;
|
|
10
|
+
copyLink: string;
|
|
11
|
+
};
|
|
12
|
+
questionPlaceholder: string;
|
|
13
|
+
parameters: string;
|
|
14
|
+
parametersTitle: string;
|
|
15
|
+
parametersSetting: string;
|
|
16
|
+
clearSession: string;
|
|
17
|
+
generate: string;
|
|
18
|
+
startChat: string;
|
|
19
|
+
collections: string;
|
|
20
|
+
collection: string;
|
|
21
|
+
collectionName: string;
|
|
22
|
+
document: string;
|
|
23
|
+
rename: string;
|
|
24
|
+
delete: string;
|
|
25
|
+
confirmDelete: string;
|
|
26
|
+
noData: string;
|
|
27
|
+
createObject: string;
|
|
28
|
+
title: string;
|
|
29
|
+
titlePlaceholder: string;
|
|
30
|
+
content: string;
|
|
31
|
+
contentPlaceholder: string;
|
|
32
|
+
cancel: string;
|
|
33
|
+
save: string;
|
|
34
|
+
edit: string;
|
|
35
|
+
chat: string;
|
|
36
|
+
subscribeNow: string;
|
|
37
|
+
requireNewSubscription: string;
|
|
38
|
+
requireNewSubscriptionFooter: string;
|
|
39
|
+
thanksForSubscription: string;
|
|
40
|
+
clickTheButton: string;
|
|
41
|
+
cleanSessionTip: string;
|
|
42
|
+
poweredBy: string;
|
|
43
|
+
selectPromptToStart: string;
|
|
44
|
+
history: string;
|
|
45
|
+
unnamed: string;
|
|
46
|
+
newObject: string;
|
|
47
|
+
editObject: string;
|
|
48
|
+
name: string;
|
|
49
|
+
description: string;
|
|
50
|
+
create: string;
|
|
51
|
+
back: string;
|
|
52
|
+
unauthorized: string;
|
|
53
|
+
unauthorizedDescription: string;
|
|
54
|
+
login: string;
|
|
55
|
+
copy: string;
|
|
56
|
+
copied: string;
|
|
57
|
+
copyToClipboard: string;
|
|
58
|
+
saveToNoteTip: string;
|
|
59
|
+
saveToNote: string;
|
|
60
|
+
savedToNote: string;
|
|
61
|
+
uploadFile: string;
|
|
62
|
+
submit: string;
|
|
63
|
+
};
|
|
64
|
+
zh: {
|
|
65
|
+
socialShare: {
|
|
66
|
+
shareToX: string;
|
|
67
|
+
shareToTelegram: string;
|
|
68
|
+
shareToReddit: string;
|
|
69
|
+
shareToWeibo: string;
|
|
70
|
+
shareToFacebook: string;
|
|
71
|
+
shareToLinkedin: string;
|
|
72
|
+
copyLink: string;
|
|
73
|
+
};
|
|
74
|
+
questionPlaceholder: string;
|
|
75
|
+
parameters: string;
|
|
76
|
+
parametersTitle: string;
|
|
77
|
+
parametersSetting: string;
|
|
78
|
+
clearSession: string;
|
|
79
|
+
generate: string;
|
|
80
|
+
startChat: string;
|
|
81
|
+
collections: string;
|
|
82
|
+
collection: string;
|
|
83
|
+
collectionName: string;
|
|
84
|
+
document: string;
|
|
85
|
+
rename: string;
|
|
86
|
+
delete: string;
|
|
87
|
+
confirmDelete: string;
|
|
88
|
+
noData: string;
|
|
89
|
+
createObject: string;
|
|
90
|
+
title: string;
|
|
91
|
+
titlePlaceholder: string;
|
|
92
|
+
content: string;
|
|
93
|
+
contentPlaceholder: string;
|
|
94
|
+
cancel: string;
|
|
95
|
+
save: string;
|
|
96
|
+
edit: string;
|
|
97
|
+
chat: string;
|
|
98
|
+
subscribeNow: string;
|
|
99
|
+
requireNewSubscription: string;
|
|
100
|
+
requireNewSubscriptionFooter: string;
|
|
101
|
+
thanksForSubscription: string;
|
|
102
|
+
clickTheButton: string;
|
|
103
|
+
cleanSessionTip: string;
|
|
104
|
+
poweredBy: string;
|
|
105
|
+
selectPromptToStart: string;
|
|
106
|
+
history: string;
|
|
107
|
+
unnamed: string;
|
|
108
|
+
newObject: string;
|
|
109
|
+
editObject: string;
|
|
110
|
+
name: string;
|
|
111
|
+
description: string;
|
|
112
|
+
create: string;
|
|
113
|
+
back: string;
|
|
114
|
+
unauthorized: string;
|
|
115
|
+
unauthorizedDescription: string;
|
|
116
|
+
login: string;
|
|
117
|
+
copy: string;
|
|
118
|
+
copied: string;
|
|
119
|
+
copyToClipboard: string;
|
|
120
|
+
saveToNoteTip: string;
|
|
121
|
+
saveToNote: string;
|
|
122
|
+
savedToNote: string;
|
|
123
|
+
uploadFile: string;
|
|
124
|
+
submit: string;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StoreApi, UseBoundStore } from 'zustand';
|
|
2
|
+
import { Assistant } from '../api/assistant';
|
|
3
|
+
import { Subscription } from '../api/subscription';
|
|
4
|
+
export interface AssistantState {
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
assistant?: Assistant;
|
|
7
|
+
error?: Error;
|
|
8
|
+
subscription?: Subscription;
|
|
9
|
+
load: () => Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare const createAssistantState: ({ assistantId, assistant }: {
|
|
12
|
+
assistantId: string;
|
|
13
|
+
assistant?: Assistant;
|
|
14
|
+
}) => UseBoundStore<StoreApi<AssistantState>>;
|
|
15
|
+
export declare function useAssistantState({ assistantId }: {
|
|
16
|
+
assistantId: string;
|
|
17
|
+
}): readonly [Assistant, AssistantState];
|
|
File without changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { RuntimeOutputVariablesSchema } from '@blocklet/ai-runtime/types';
|
|
2
|
+
import { StoreApi, UseBoundStore } from 'zustand';
|
|
3
|
+
import { Message } from '../api/message';
|
|
4
|
+
import { Session } from '../api/session';
|
|
5
|
+
export interface MessageItem extends Omit<Message, 'id'> {
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface SessionState {
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
running?: boolean;
|
|
11
|
+
session?: Session;
|
|
12
|
+
messages?: MessageItem[];
|
|
13
|
+
error?: Error;
|
|
14
|
+
metadata?: RuntimeOutputVariablesSchema;
|
|
15
|
+
updateSession: ({ parameters }: {
|
|
16
|
+
parameters: any;
|
|
17
|
+
}) => Promise<void>;
|
|
18
|
+
clearSession: ({ sessionId }: {
|
|
19
|
+
sessionId: string;
|
|
20
|
+
}) => Promise<void>;
|
|
21
|
+
load: () => Promise<void>;
|
|
22
|
+
execute: (options: {
|
|
23
|
+
assistantId: string;
|
|
24
|
+
parameters: any;
|
|
25
|
+
onResponseStart?: () => void;
|
|
26
|
+
includeSessionParameters?: boolean;
|
|
27
|
+
}) => Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export declare const createSessionState: ({ sessionId, session }: {
|
|
30
|
+
sessionId: string;
|
|
31
|
+
session?: Session;
|
|
32
|
+
}) => UseBoundStore<StoreApi<SessionState>>;
|
|
33
|
+
export declare function useSessionState(options: {
|
|
34
|
+
sessionId: string;
|
|
35
|
+
required: true;
|
|
36
|
+
}): [Session, SessionState];
|
|
37
|
+
export declare function useSessionState(options: {
|
|
38
|
+
sessionId: string;
|
|
39
|
+
required?: false;
|
|
40
|
+
}): [Session | undefined, SessionState];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StoreApi, UseBoundStore } from 'zustand';
|
|
2
|
+
import { Release, Subscription } from '../api/subscription';
|
|
3
|
+
export interface SubscriptionState {
|
|
4
|
+
loading?: boolean;
|
|
5
|
+
loaded?: boolean;
|
|
6
|
+
subscription?: Subscription;
|
|
7
|
+
release?: Release;
|
|
8
|
+
load: () => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare const createAssistantState: ({ aid }: {
|
|
11
|
+
aid: string;
|
|
12
|
+
}) => UseBoundStore<StoreApi<SubscriptionState>>;
|
|
13
|
+
export declare function useSubscriptionState({ aid }: {
|
|
14
|
+
aid: string;
|
|
15
|
+
}): readonly [Subscription | undefined, SubscriptionState];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SxProps, Theme } from '@mui/material';
|
|
2
|
+
import type { SystemStyleObject } from '@mui/system';
|
|
3
|
+
export interface Identity {
|
|
4
|
+
projectId: string;
|
|
5
|
+
projectRef: string;
|
|
6
|
+
assistantId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function parseIdentity(aid: string, options: {
|
|
9
|
+
rejectWhenError: true;
|
|
10
|
+
}): Identity;
|
|
11
|
+
export declare function parseIdentity(aid: string, options?: {
|
|
12
|
+
rejectWhenError?: false;
|
|
13
|
+
}): Identity | undefined;
|
|
14
|
+
export declare function stringifyIdentity({ projectId, projectRef, assistantId, }: {
|
|
15
|
+
projectId: string;
|
|
16
|
+
projectRef: string;
|
|
17
|
+
assistantId: string;
|
|
18
|
+
}): string;
|
|
19
|
+
export declare function deepMerge(target: Record<any, any>, source: Record<any, any>): void;
|
|
20
|
+
export declare const mergeSx: (initial: SystemStyleObject<Theme>, sx?: SxProps<Theme>) => any[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare const _default: () => Promise<{
|
|
3
|
+
Composer: typeof import("react-scroll-to-bottom").default;
|
|
3
4
|
useInternalContext: any;
|
|
4
5
|
default(props: import("react").PropsWithChildren<{
|
|
5
6
|
checkInterval?: number | undefined;
|
|
@@ -8,7 +9,7 @@ declare const _default: () => Promise<{
|
|
|
8
9
|
debug?: boolean | undefined;
|
|
9
10
|
followButtonClassName?: string | undefined;
|
|
10
11
|
initialScrollBehavior?: "auto" | "smooth" | undefined;
|
|
11
|
-
mode?: "
|
|
12
|
+
mode?: "bottom" | "top" | undefined;
|
|
12
13
|
nonce?: string | undefined;
|
|
13
14
|
scroller?: ((values: {
|
|
14
15
|
maxValue: number;
|
|
@@ -33,7 +34,7 @@ declare const _default: () => Promise<{
|
|
|
33
34
|
useAtEnd(): [boolean];
|
|
34
35
|
useAtStart(): [boolean];
|
|
35
36
|
useAtTop(): [boolean];
|
|
36
|
-
useMode(): ["
|
|
37
|
+
useMode(): ["bottom" | "top"];
|
|
37
38
|
useSticky(): [boolean];
|
|
38
39
|
FunctionContext: import("react").Context<{
|
|
39
40
|
scrollTo: (scrollTop: number | "100%") => void;
|
|
@@ -37,4 +37,5 @@ export declare const BuiltinModules: {
|
|
|
37
37
|
'@blocklet/pages-kit/builtin/async/react-markdown': {};
|
|
38
38
|
'@blocklet/pages-kit/builtin/async/react-syntax-highlighter': {};
|
|
39
39
|
'@blocklet/pages-kit/builtin/async/image-preview': {};
|
|
40
|
+
'@blocklet/pages-kit/builtin/async/ai-runtime': {};
|
|
40
41
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/pages-kit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.287",
|
|
4
4
|
"description": "Pages Kit components and utils",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -93,14 +93,18 @@
|
|
|
93
93
|
"prepare": "npm run build"
|
|
94
94
|
},
|
|
95
95
|
"dependencies": {
|
|
96
|
-
"@arcblock/did-connect": "^2.9.
|
|
96
|
+
"@arcblock/did-connect": "^2.9.71",
|
|
97
97
|
"@blocklet/ai-kit": "^0.1.27",
|
|
98
|
+
"@blocklet/ai-runtime": "^0.1.346",
|
|
99
|
+
"@blocklet/js-sdk": "1.16.26-beta-cca12425",
|
|
98
100
|
"@blocklet/sdk": "^1.16.25",
|
|
99
101
|
"@iconify/react": "^4.1.1",
|
|
102
|
+
"@lottiefiles/lottie-player": "^1.7.1",
|
|
100
103
|
"axios": "^1.6.8",
|
|
101
104
|
"dayjs": "^1.11.10",
|
|
102
105
|
"eventsource-parser": "^1.1.2",
|
|
103
106
|
"immer": "^10.0.4",
|
|
107
|
+
"js-base64": "^3.7.7",
|
|
104
108
|
"lodash": "^4.17.21",
|
|
105
109
|
"nanoid": "^3.3.7",
|
|
106
110
|
"node-fetch": "^2.7.0",
|
|
@@ -109,6 +113,7 @@
|
|
|
109
113
|
"react-hook-form": "^7.51.3",
|
|
110
114
|
"react-markdown": "^9.0.1",
|
|
111
115
|
"react-scroll-to-bottom": "^4.2.0",
|
|
116
|
+
"react-share": "^5.1.0",
|
|
112
117
|
"react-syntax-highlighter": "^15.5.0",
|
|
113
118
|
"react-wrap-balancer": "^1.1.0",
|
|
114
119
|
"typescript": "^5.4.5",
|
|
@@ -129,7 +134,7 @@
|
|
|
129
134
|
"react-router-dom": "^6.16.0"
|
|
130
135
|
},
|
|
131
136
|
"devDependencies": {
|
|
132
|
-
"@arcblock/ux": "^2.9.
|
|
137
|
+
"@arcblock/ux": "^2.9.71",
|
|
133
138
|
"@emotion/cache": "^11.11.0",
|
|
134
139
|
"@emotion/css": "^11.11.2",
|
|
135
140
|
"@emotion/react": "^11.11.4",
|
|
@@ -139,14 +144,14 @@
|
|
|
139
144
|
"@types/lodash": "^4.17.0",
|
|
140
145
|
"@types/mustache": "^4.2.5",
|
|
141
146
|
"@types/node-fetch": "^2.6.11",
|
|
142
|
-
"@types/react": "^18.
|
|
147
|
+
"@types/react": "^18.3.0",
|
|
143
148
|
"@types/react-scroll-to-bottom": "^4.2.5",
|
|
144
149
|
"@types/react-syntax-highlighter": "^15.5.11",
|
|
145
150
|
"axios": "^1.6.8",
|
|
146
151
|
"npm-run-all": "^4.1.5",
|
|
147
|
-
"react": "^18.
|
|
148
|
-
"react-dom": "^18.
|
|
149
|
-
"react-router-dom": "^6.
|
|
152
|
+
"react": "^18.3.0",
|
|
153
|
+
"react-dom": "^18.3.0",
|
|
154
|
+
"react-router-dom": "^6.23.0",
|
|
150
155
|
"rimraf": "^5.0.5"
|
|
151
156
|
}
|
|
152
157
|
}
|
package/tsconfig.json
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"noEmit": false,
|
|
5
5
|
"outDir": "lib",
|
|
6
|
-
"lib": ["DOM"]
|
|
6
|
+
"lib": ["DOM"],
|
|
7
|
+
"paths": {
|
|
8
|
+
// FIXME: Just for local dev, comment next line before publish
|
|
9
|
+
"@blocklet/ai-runtime/*": ["../../../ai-studio/packages/ai-runtime/src/*"]
|
|
10
|
+
}
|
|
7
11
|
}
|
|
8
12
|
}
|