@blocklet/pages-kit 0.2.286 → 0.2.288
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 +55 -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 +24 -0
- package/lib/cjs/builtin/async/ai-runtime/components/LoadingButton.js +40 -0
- package/lib/cjs/builtin/async/ai-runtime/components/LoadingListItemButton.js +49 -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 +22 -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 +104 -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 +89 -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 +57 -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 +81 -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 +129 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageListView.js +47 -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 +111 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +60 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +52 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/index.js +28 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +120 -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 +65 -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/error.js +10 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/header.js +32 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/navigate.js +38 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/subscribe.js +35 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/useAsync.js +32 -0
- package/lib/cjs/builtin/async/ai-runtime/index.js +81 -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/loading.js +39 -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 +51 -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 +21 -0
- package/lib/esm/builtin/async/ai-runtime/components/LoadingButton.js +38 -0
- package/lib/esm/builtin/async/ai-runtime/components/LoadingListItemButton.js +46 -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 +16 -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 +98 -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 +60 -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 +50 -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 +75 -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 +100 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageListView.js +41 -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 +103 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +34 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +46 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/index.js +22 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +114 -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/error.js +6 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/header.js +25 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/navigate.js +32 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/subscribe.js +31 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/useAsync.js +29 -0
- package/lib/esm/builtin/async/ai-runtime/index.js +72 -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/loading.js +36 -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 +2 -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 +5 -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 +11 -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 +6 -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 +8 -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 +10 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.d.ts +5 -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 +5 -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 +8 -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/error.d.ts +4 -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/hooks/useAsync.d.ts +1 -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/loading.d.ts +10 -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/page/header.d.ts +1 -6
- package/lib/types/builtin/session.d.ts +11 -1
- package/lib/types/components/CustomComponentRenderer/state.d.ts +1 -116
- package/lib/types/utils/builtin.d.ts +1 -0
- package/package.json +14 -9
- package/tsconfig.json +5 -1
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
11
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
12
|
+
var m = o[Symbol.asyncIterator], i;
|
|
13
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
14
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
15
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
16
|
+
};
|
|
17
|
+
import { RuntimeOutputVariableNames } from '@blocklet/ai-runtime/types';
|
|
18
|
+
import pick from 'lodash/pick';
|
|
19
|
+
import { create } from 'zustand';
|
|
20
|
+
import { immer } from 'zustand/middleware/immer';
|
|
21
|
+
import { deleteMessages, getMessages } from '../api/message';
|
|
22
|
+
import { getSession, runAssistant, updateSession } from '../api/session';
|
|
23
|
+
import { deepMerge, parseIdentity } from '../utils';
|
|
24
|
+
const STATES = {};
|
|
25
|
+
export const createSessionState = ({ sessionId, session }) => {
|
|
26
|
+
var _a;
|
|
27
|
+
(_a = STATES[sessionId]) !== null && _a !== void 0 ? _a : (STATES[sessionId] = create()(immer((set, get) => ({
|
|
28
|
+
session,
|
|
29
|
+
clearSession: (_b) => __awaiter(void 0, [_b], void 0, function* ({ sessionId }) {
|
|
30
|
+
yield deleteMessages({ sessionId });
|
|
31
|
+
yield get().load();
|
|
32
|
+
}),
|
|
33
|
+
updateSession: (_c) => __awaiter(void 0, [_c], void 0, function* ({ parameters }) {
|
|
34
|
+
const { updated } = yield updateSession({ sessionId, parameters });
|
|
35
|
+
set((state) => {
|
|
36
|
+
state.session = updated;
|
|
37
|
+
});
|
|
38
|
+
}),
|
|
39
|
+
load: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
set((state) => {
|
|
41
|
+
state.loading = true;
|
|
42
|
+
});
|
|
43
|
+
try {
|
|
44
|
+
const [{ session }, { messages }] = yield Promise.all([
|
|
45
|
+
getSession({ sessionId }),
|
|
46
|
+
getMessages({ sessionId }),
|
|
47
|
+
]);
|
|
48
|
+
set((state) => {
|
|
49
|
+
state.session = session;
|
|
50
|
+
state.messages = messages;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
set((state) => {
|
|
55
|
+
state.error = error;
|
|
56
|
+
});
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
set((state) => {
|
|
61
|
+
state.loading = false;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}),
|
|
65
|
+
execute: (_d) => __awaiter(void 0, [_d], void 0, function* ({ assistantId, parameters, onResponseStart, includeSessionParameters, }) {
|
|
66
|
+
var _e, e_1, _f, _g;
|
|
67
|
+
var _h, _j, _k, _l, _m;
|
|
68
|
+
const identity = parseIdentity(assistantId, { rejectWhenError: true });
|
|
69
|
+
let message;
|
|
70
|
+
const childMessages = [];
|
|
71
|
+
const childMessagesMap = {};
|
|
72
|
+
set((state) => {
|
|
73
|
+
state.running = true;
|
|
74
|
+
state.error = undefined;
|
|
75
|
+
});
|
|
76
|
+
let realParameters = Object.assign(Object.assign({}, parameters), { $clientTime: new Date().toISOString() });
|
|
77
|
+
if (includeSessionParameters) {
|
|
78
|
+
realParameters = Object.assign(Object.assign({}, (_h = get().session) === null || _h === void 0 ? void 0 : _h.parameters), parameters);
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
const stream = runAssistant({
|
|
82
|
+
sessionId,
|
|
83
|
+
identity,
|
|
84
|
+
parameters: realParameters,
|
|
85
|
+
});
|
|
86
|
+
let responseStarted = false;
|
|
87
|
+
try {
|
|
88
|
+
for (var _o = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield stream_1.next(), _e = stream_1_1.done, !_e; _o = true) {
|
|
89
|
+
_g = stream_1_1.value;
|
|
90
|
+
_o = false;
|
|
91
|
+
const value = _g;
|
|
92
|
+
if (!responseStarted) {
|
|
93
|
+
responseStarted = true;
|
|
94
|
+
onResponseStart === null || onResponseStart === void 0 ? void 0 : onResponseStart();
|
|
95
|
+
}
|
|
96
|
+
if ((value === null || value === void 0 ? void 0 : value.type) === 'CHUNK') {
|
|
97
|
+
if (!message) {
|
|
98
|
+
message = {
|
|
99
|
+
taskId: value.taskId,
|
|
100
|
+
sessionId,
|
|
101
|
+
parameters,
|
|
102
|
+
createdAt: new Date().toISOString(),
|
|
103
|
+
updatedAt: new Date().toISOString(),
|
|
104
|
+
loading: true,
|
|
105
|
+
};
|
|
106
|
+
set((state) => {
|
|
107
|
+
var _a;
|
|
108
|
+
(_a = state.messages) !== null && _a !== void 0 ? _a : (state.messages = []);
|
|
109
|
+
state.messages.push(message);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (message.taskId === value.taskId) {
|
|
113
|
+
set((state) => {
|
|
114
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
115
|
+
var _h;
|
|
116
|
+
const msg = (_a = state.messages) === null || _a === void 0 ? void 0 : _a.findLast((i) => i.taskId === message.taskId);
|
|
117
|
+
if (!msg)
|
|
118
|
+
return;
|
|
119
|
+
(_b = msg.result) !== null && _b !== void 0 ? _b : (msg.result = {});
|
|
120
|
+
msg.result.content = (msg.result.content || '') + (value.delta.content || '');
|
|
121
|
+
if ((_d = (_c = value.delta) === null || _c === void 0 ? void 0 : _c.images) === null || _d === void 0 ? void 0 : _d.length) {
|
|
122
|
+
msg.result.images = ((_e = msg.result.images) !== null && _e !== void 0 ? _e : []).concat(value.delta.images);
|
|
123
|
+
}
|
|
124
|
+
if (value.delta.object) {
|
|
125
|
+
(_f = (_h = msg.result).objects) !== null && _f !== void 0 ? _f : (_h.objects = []);
|
|
126
|
+
msg.result.objects.push({ taskId: value.taskId, data: value.delta.object });
|
|
127
|
+
if (value.delta.object) {
|
|
128
|
+
(_g = state.metadata) !== null && _g !== void 0 ? _g : (state.metadata = {});
|
|
129
|
+
deepMerge(state.metadata, pick(value.delta.object, RuntimeOutputVariableNames));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
else if (value.respondAs && value.respondAs !== 'none') {
|
|
135
|
+
let childMessage = childMessagesMap[value.taskId];
|
|
136
|
+
if (!childMessage) {
|
|
137
|
+
childMessage = {
|
|
138
|
+
taskId: value.taskId,
|
|
139
|
+
respondAs: value.respondAs,
|
|
140
|
+
};
|
|
141
|
+
childMessagesMap[value.taskId] = childMessage;
|
|
142
|
+
childMessages.push(childMessage);
|
|
143
|
+
}
|
|
144
|
+
(_j = childMessage.result) !== null && _j !== void 0 ? _j : (childMessage.result = {});
|
|
145
|
+
childMessage.result.content = (childMessage.result.content || '') + (value.delta.content || '');
|
|
146
|
+
if ((_l = (_k = value.delta) === null || _k === void 0 ? void 0 : _k.images) === null || _l === void 0 ? void 0 : _l.length) {
|
|
147
|
+
childMessage.result.images = ((_m = childMessage.result.images) !== null && _m !== void 0 ? _m : []).concat(value.delta.images);
|
|
148
|
+
}
|
|
149
|
+
set((state) => {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
const msg = (_a = state.messages) === null || _a === void 0 ? void 0 : _a.findLast((i) => i.taskId === message.taskId);
|
|
152
|
+
if (!msg)
|
|
153
|
+
return;
|
|
154
|
+
(_b = msg.result) !== null && _b !== void 0 ? _b : (msg.result = {});
|
|
155
|
+
msg.result.messages = JSON.parse(JSON.stringify(childMessages));
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if ((value === null || value === void 0 ? void 0 : value.type) === 'ERROR') {
|
|
160
|
+
set((state) => {
|
|
161
|
+
var _a;
|
|
162
|
+
const msg = (_a = state.messages) === null || _a === void 0 ? void 0 : _a.findLast((i) => i.taskId === message.taskId);
|
|
163
|
+
if (msg)
|
|
164
|
+
msg.error = value.error;
|
|
165
|
+
else
|
|
166
|
+
throw new Error(value.error.message);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
172
|
+
finally {
|
|
173
|
+
try {
|
|
174
|
+
if (!_o && !_e && (_f = stream_1.return)) yield _f.call(stream_1);
|
|
175
|
+
}
|
|
176
|
+
finally { if (e_1) throw e_1.error; }
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
set((state) => {
|
|
181
|
+
state.error = error;
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
finally {
|
|
185
|
+
set((state) => {
|
|
186
|
+
var _a;
|
|
187
|
+
state.running = false;
|
|
188
|
+
if (message) {
|
|
189
|
+
const msg = (_a = state.messages) === null || _a === void 0 ? void 0 : _a.findLast((i) => i.taskId === message.taskId);
|
|
190
|
+
if (msg)
|
|
191
|
+
msg.loading = false;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}),
|
|
196
|
+
}))));
|
|
197
|
+
return STATES[sessionId];
|
|
198
|
+
};
|
|
199
|
+
const LOADING_TASKS = {};
|
|
200
|
+
export function useSessionState({ sessionId, required }) {
|
|
201
|
+
var _a;
|
|
202
|
+
const state = createSessionState({ sessionId })();
|
|
203
|
+
if (!state.session) {
|
|
204
|
+
(_a = LOADING_TASKS[sessionId]) !== null && _a !== void 0 ? _a : (LOADING_TASKS[sessionId] = state.load());
|
|
205
|
+
if (required)
|
|
206
|
+
throw LOADING_TASKS[sessionId];
|
|
207
|
+
}
|
|
208
|
+
return [state.session, state];
|
|
209
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { create } from 'zustand';
|
|
11
|
+
import { immer } from 'zustand/middleware/immer';
|
|
12
|
+
import { getRelease, getSubscription } from '../api/subscription';
|
|
13
|
+
const STATES = {};
|
|
14
|
+
export const createAssistantState = ({ aid }) => {
|
|
15
|
+
var _a;
|
|
16
|
+
(_a = STATES[aid]) !== null && _a !== void 0 ? _a : (STATES[aid] = create()(immer((set) => ({
|
|
17
|
+
load: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
set((state) => {
|
|
19
|
+
state.loading = true;
|
|
20
|
+
});
|
|
21
|
+
try {
|
|
22
|
+
const [{ subscription }, release] = yield Promise.all([getSubscription({ aid }), getRelease({ aid })]);
|
|
23
|
+
set((state) => {
|
|
24
|
+
state.subscription = subscription;
|
|
25
|
+
state.release = release;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
set((state) => {
|
|
30
|
+
state.loading = false;
|
|
31
|
+
state.loaded = true;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}),
|
|
35
|
+
}))));
|
|
36
|
+
return STATES[aid];
|
|
37
|
+
};
|
|
38
|
+
const LOADING_TASKS = {};
|
|
39
|
+
export function useSubscriptionState({ aid }) {
|
|
40
|
+
var _a;
|
|
41
|
+
const state = createAssistantState({ aid })();
|
|
42
|
+
if (!state.loaded && !state.subscription) {
|
|
43
|
+
(_a = LOADING_TASKS[aid]) !== null && _a !== void 0 ? _a : (LOADING_TASKS[aid] = state.load());
|
|
44
|
+
throw LOADING_TASKS[aid];
|
|
45
|
+
}
|
|
46
|
+
return [state.subscription, state];
|
|
47
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Base64 } from 'js-base64';
|
|
2
|
+
export function parseIdentity(aid, options) {
|
|
3
|
+
let projectId;
|
|
4
|
+
let projectRef;
|
|
5
|
+
let assistantId;
|
|
6
|
+
try {
|
|
7
|
+
const s = Base64.decode(aid).split('/');
|
|
8
|
+
[projectId, projectRef, assistantId] = s.length === 3 ? s : s.length === 2 ? [s[0], 'main', s[1]] : [];
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
console.error('parse assistantId error', { error });
|
|
12
|
+
}
|
|
13
|
+
if (projectId && projectRef && assistantId)
|
|
14
|
+
return { projectId, projectRef, assistantId };
|
|
15
|
+
if (options === null || options === void 0 ? void 0 : options.rejectWhenError)
|
|
16
|
+
throw new Error(`Invalid assistant identity ${aid}`);
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
export function stringifyIdentity({ projectId, projectRef, assistantId, }) {
|
|
20
|
+
return Base64.encodeURI([projectId, projectRef, assistantId].join('/'));
|
|
21
|
+
}
|
|
22
|
+
function isObject(obj) {
|
|
23
|
+
return typeof obj === 'object' && !Array.isArray(obj);
|
|
24
|
+
}
|
|
25
|
+
export function deepMerge(target, source) {
|
|
26
|
+
if (isObject(target) && isObject(source)) {
|
|
27
|
+
for (const key of Object.keys(source)) {
|
|
28
|
+
if (isObject(source[key])) {
|
|
29
|
+
if (!target[key] || !isObject(target[key]))
|
|
30
|
+
target[key] = source[key];
|
|
31
|
+
deepMerge(target[key], source[key]);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
target[key] = source[key];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export const mergeSx = (initial, sx) => {
|
|
40
|
+
const mergedSx = [initial, ...(Array.isArray(sx) ? sx : [sx])];
|
|
41
|
+
return mergedSx;
|
|
42
|
+
};
|
|
@@ -5,4 +5,4 @@ export default () => Promise.all([
|
|
|
5
5
|
import('react-scroll-to-bottom/lib/esm/hooks/internal/useInternalContext')
|
|
6
6
|
: // @ts-ignore
|
|
7
7
|
import('react-scroll-to-bottom/lib/hooks/internal/useInternalContext'),
|
|
8
|
-
]).then(([mod, { default: useInternalContext }]) => (Object.assign(Object.assign({}, mod), { useInternalContext })));
|
|
8
|
+
]).then(([mod, { default: useInternalContext }]) => (Object.assign(Object.assign({}, mod), { Composer: mod.Composer, useInternalContext })));
|
package/lib/esm/utils/builtin.js
CHANGED
|
@@ -43,4 +43,5 @@ export const BuiltinModules = {
|
|
|
43
43
|
'@blocklet/pages-kit/builtin/async/react-markdown': {},
|
|
44
44
|
'@blocklet/pages-kit/builtin/async/react-syntax-highlighter': {},
|
|
45
45
|
'@blocklet/pages-kit/builtin/async/image-preview': {},
|
|
46
|
+
'@blocklet/pages-kit/builtin/async/ai-runtime': {},
|
|
46
47
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as arcblockUx from '../builtin/arcblock/ux';
|
|
2
|
+
import * as aiRuntime from '../builtin/async/ai-runtime';
|
|
2
3
|
import * as imagePreview from '../builtin/async/image-preview';
|
|
3
4
|
import * as reactMarkdown from '../builtin/async/react-markdown';
|
|
4
5
|
import * as reactScrollToBottom from '../builtin/async/react-scroll-to-bottom';
|
|
@@ -50,6 +51,7 @@ function injectGlobalComponents() {
|
|
|
50
51
|
'@blocklet/pages-kit/builtin/async/react-markdown': reactMarkdown,
|
|
51
52
|
'@blocklet/pages-kit/builtin/async/react-syntax-highlighter': reactSyntaxHighlighter,
|
|
52
53
|
'@blocklet/pages-kit/builtin/async/image-preview': imagePreview,
|
|
54
|
+
'@blocklet/pages-kit/builtin/async/ai-runtime': aiRuntime,
|
|
53
55
|
},
|
|
54
56
|
require(module) {
|
|
55
57
|
return win[BuiltinModulesGlobalVariableName].modules[module];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AssistantBase, Parameter } from '@blocklet/ai-runtime/types';
|
|
2
|
+
export interface Assistant {
|
|
3
|
+
id: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
parameters?: Parameter[];
|
|
7
|
+
entries?: {
|
|
8
|
+
id: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
parameters?: {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
};
|
|
13
|
+
}[];
|
|
14
|
+
release?: AssistantBase['release'];
|
|
15
|
+
}
|
|
16
|
+
export declare function getAssistant({ assistantId: id }: {
|
|
17
|
+
assistantId: string;
|
|
18
|
+
}): Promise<Assistant>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface Dataset {
|
|
2
|
+
id: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function getDataset({ datasetId }: {
|
|
7
|
+
datasetId: string;
|
|
8
|
+
}): Promise<Dataset>;
|
|
9
|
+
export declare function getDatasets({ appId }: {
|
|
10
|
+
appId: string;
|
|
11
|
+
}): Promise<Array<Dataset>>;
|
|
12
|
+
export declare function createDataset({ appId, name, description, }: {
|
|
13
|
+
appId: string;
|
|
14
|
+
name: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
}): Promise<unknown>;
|
|
17
|
+
export declare function updateDataset(datasetId: string, input: Pick<Dataset, 'name' | 'description'>): Promise<Dataset>;
|
|
18
|
+
export declare function deleteDataset(datasetId: string): Promise<void>;
|
|
19
|
+
export interface Document {
|
|
20
|
+
id: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function deleteDocument(datasetId: string, documentId: string): Promise<void>;
|
|
24
|
+
export declare function getDocuments(datasetId: string): Promise<{
|
|
25
|
+
items: Array<Document>;
|
|
26
|
+
total: number;
|
|
27
|
+
}>;
|
|
28
|
+
export declare function getDocument(datasetId: string, documentId: string): Promise<{
|
|
29
|
+
document: Document;
|
|
30
|
+
}>;
|
|
31
|
+
export declare function createDocument(datasetId: string, type: 'text' | 'file', input: {
|
|
32
|
+
name: string;
|
|
33
|
+
content: string;
|
|
34
|
+
} | File): Promise<any>;
|
|
35
|
+
export declare function createDocumentFile(datasetId: string, file: File): Promise<any>;
|
|
36
|
+
export declare function updateDocument(datasetId: string, documentId: string, type: 'text', input: {
|
|
37
|
+
name: string;
|
|
38
|
+
content: string;
|
|
39
|
+
}): Promise<unknown>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ExecuteBlock, RuntimeOutputVariablesSchema } from '@blocklet/ai-runtime/types';
|
|
2
|
+
export interface Message {
|
|
3
|
+
id: string;
|
|
4
|
+
taskId: string;
|
|
5
|
+
sessionId: string;
|
|
6
|
+
createdAt: string;
|
|
7
|
+
updatedAt: string;
|
|
8
|
+
parameters?: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
result?: {
|
|
12
|
+
content?: string;
|
|
13
|
+
images?: {
|
|
14
|
+
url: string;
|
|
15
|
+
}[];
|
|
16
|
+
messages?: {
|
|
17
|
+
taskId: string;
|
|
18
|
+
respondAs?: ExecuteBlock['respondAs'];
|
|
19
|
+
result?: Pick<NonNullable<Message['result']>, 'content' | 'images'>;
|
|
20
|
+
}[];
|
|
21
|
+
objects?: {
|
|
22
|
+
taskId: string;
|
|
23
|
+
data: RuntimeOutputVariablesSchema;
|
|
24
|
+
}[];
|
|
25
|
+
} | null;
|
|
26
|
+
error?: {
|
|
27
|
+
type?: string;
|
|
28
|
+
message: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export declare function getMessages({ sessionId, }: {
|
|
32
|
+
sessionId: string;
|
|
33
|
+
}): Promise<{
|
|
34
|
+
messages: Message[];
|
|
35
|
+
count: number;
|
|
36
|
+
}>;
|
|
37
|
+
export declare function deleteMessages({ sessionId }: {
|
|
38
|
+
sessionId: string;
|
|
39
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { RunAssistantResponse } from '@blocklet/ai-runtime/types';
|
|
2
|
+
import { Identity } from '../utils';
|
|
3
|
+
export interface Session {
|
|
4
|
+
id: string;
|
|
5
|
+
userId: string;
|
|
6
|
+
projectId: string;
|
|
7
|
+
projectRef: string;
|
|
8
|
+
assistantId: string;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
parameters?: any;
|
|
11
|
+
entry?: {
|
|
12
|
+
title?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare function getSessions({ projectId, projectRef, assistantId, }: {
|
|
16
|
+
projectId: string;
|
|
17
|
+
projectRef: string;
|
|
18
|
+
assistantId: string;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
sessions: Session[];
|
|
21
|
+
}>;
|
|
22
|
+
export declare function getSession({ sessionId }: {
|
|
23
|
+
sessionId: string;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
session: Session;
|
|
26
|
+
}>;
|
|
27
|
+
export declare function createSession({ assistantId, name, parameters, entry, }: {
|
|
28
|
+
assistantId: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
parameters?: any;
|
|
31
|
+
entry?: any;
|
|
32
|
+
}): Promise<{
|
|
33
|
+
created: Session;
|
|
34
|
+
sessions: Session[];
|
|
35
|
+
}>;
|
|
36
|
+
export declare function updateSession({ sessionId, name, parameters, }: {
|
|
37
|
+
sessionId: string;
|
|
38
|
+
name?: string;
|
|
39
|
+
parameters?: any;
|
|
40
|
+
}): Promise<{
|
|
41
|
+
updated: Session;
|
|
42
|
+
sessions: Session[];
|
|
43
|
+
}>;
|
|
44
|
+
export declare function deleteSession({ sessionId, }: {
|
|
45
|
+
sessionId: string;
|
|
46
|
+
}): Promise<{
|
|
47
|
+
deleted: Session;
|
|
48
|
+
sessions: Session[];
|
|
49
|
+
}>;
|
|
50
|
+
export declare function runAssistant({ sessionId, identity, parameters, }: {
|
|
51
|
+
sessionId: string;
|
|
52
|
+
identity: Identity;
|
|
53
|
+
parameters: any;
|
|
54
|
+
}): AsyncGenerator<RunAssistantResponse, void, unknown>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface Subscription {
|
|
2
|
+
}
|
|
3
|
+
export declare function getSubscription({ aid }: {
|
|
4
|
+
aid: string;
|
|
5
|
+
}): Promise<{
|
|
6
|
+
subscription?: Subscription;
|
|
7
|
+
}>;
|
|
8
|
+
export interface Release {
|
|
9
|
+
paymentProductId?: string;
|
|
10
|
+
paymentLinkId?: string;
|
|
11
|
+
paymentUnitAmount?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function getRelease({ aid }: {
|
|
14
|
+
aid: string;
|
|
15
|
+
}): Promise<Release>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LoadingButtonProps } from '@mui/lab';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export declare function ActionButton({ tip, tipSucceed, title, titleSucceed, icon, iconSucceed, autoReset, ...props }: {
|
|
4
|
+
tip?: ReactNode;
|
|
5
|
+
tipSucceed?: ReactNode;
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
titleSucceed?: ReactNode;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
iconSucceed?: ReactNode;
|
|
10
|
+
autoReset?: boolean;
|
|
11
|
+
} & Omit<Partial<LoadingButtonProps>, 'title'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ListItemButtonProps } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export default function LoadingListItemButton({ children, confirmation, ...props }: ListItemButtonProps & {
|
|
4
|
+
confirmation?: ReactNode;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BoxProps } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface Props {
|
|
4
|
+
sx?: BoxProps;
|
|
5
|
+
menus?: React.ReactNode | (() => React.ReactNode);
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export default function MenuButton({ sx, menus, children }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { BoxProps } from '@mui/material';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
export declare function useScrollToBottomModule(): {
|
|
4
|
+
Composer: typeof import("react-scroll-to-bottom").default;
|
|
5
|
+
useInternalContext: any;
|
|
6
|
+
default(props: import("react").PropsWithChildren<{
|
|
7
|
+
checkInterval?: number | undefined;
|
|
8
|
+
className?: string | undefined;
|
|
9
|
+
debounce?: number | undefined;
|
|
10
|
+
debug?: boolean | undefined;
|
|
11
|
+
followButtonClassName?: string | undefined;
|
|
12
|
+
initialScrollBehavior?: "auto" | "smooth" | undefined;
|
|
13
|
+
mode?: "bottom" | "top" | undefined;
|
|
14
|
+
nonce?: string | undefined;
|
|
15
|
+
scroller?: ((values: {
|
|
16
|
+
maxValue: number;
|
|
17
|
+
minValue: number;
|
|
18
|
+
offsetHeight: number;
|
|
19
|
+
scrollHeight: number;
|
|
20
|
+
scrollTop: number;
|
|
21
|
+
}) => number) | undefined;
|
|
22
|
+
scrollViewClassName?: string | undefined;
|
|
23
|
+
}>): null;
|
|
24
|
+
useScrollTo(): (scrollTop: number | "100%") => void;
|
|
25
|
+
useScrollToBottom(): (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
|
|
26
|
+
useScrollToEnd(): (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
|
|
27
|
+
useScrollToStart(): (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
|
|
28
|
+
useScrollToTop(): (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
|
|
29
|
+
useObserveScrollPosition(observer: false | (({ scrollTop }: {
|
|
30
|
+
scrollTop: number;
|
|
31
|
+
}) => void)): void;
|
|
32
|
+
useAnimating(): [boolean];
|
|
33
|
+
useAnimatingToEnd(): [boolean];
|
|
34
|
+
useAtBottom(): [boolean];
|
|
35
|
+
useAtEnd(): [boolean];
|
|
36
|
+
useAtStart(): [boolean];
|
|
37
|
+
useAtTop(): [boolean];
|
|
38
|
+
useMode(): ["bottom" | "top"];
|
|
39
|
+
useSticky(): [boolean];
|
|
40
|
+
FunctionContext: import("react").Context<{
|
|
41
|
+
scrollTo: (scrollTop: number | "100%") => void;
|
|
42
|
+
scrollToBottom: (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
|
|
43
|
+
scrollToEnd: (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
|
|
44
|
+
scrollToStart: (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
|
|
45
|
+
scrollToTop: (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
|
|
46
|
+
}>;
|
|
47
|
+
StateContext: import("react").Context<{
|
|
48
|
+
animating: boolean;
|
|
49
|
+
animatingToEnd: boolean;
|
|
50
|
+
atBottom: boolean;
|
|
51
|
+
atEnd: boolean;
|
|
52
|
+
atStart: boolean;
|
|
53
|
+
atTop: boolean;
|
|
54
|
+
mode: string;
|
|
55
|
+
sticky: boolean;
|
|
56
|
+
}>;
|
|
57
|
+
};
|
|
58
|
+
export default function ScrollView({ children, initialScrollBehavior, ...props }: BoxProps & {
|
|
59
|
+
scroller?: 'window';
|
|
60
|
+
initialScrollBehavior?: ComponentProps<(typeof import('react-scroll-to-bottom'))['default']>['initialScrollBehavior'];
|
|
61
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BoxProps } from '@mui/material';
|
|
2
|
+
interface SocialShareMenuProps extends BoxProps {
|
|
3
|
+
url?: string;
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
interface SocialShareButtonsProps extends SocialShareMenuProps {
|
|
7
|
+
itemSx?: BoxProps['sx'];
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
bgFill?: string;
|
|
10
|
+
iconFill?: string;
|
|
11
|
+
}
|
|
12
|
+
export default function SocialShare(props: SocialShareMenuProps & SocialShareButtonsProps & {
|
|
13
|
+
type?: 'menu' | 'buttons';
|
|
14
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function SocialShareMenu({ url, content, ...restProps }: SocialShareMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function SocialShareButtons({ url, content, sx, itemSx, onClick, bgFill, iconFill, ...rest }: SocialShareButtonsProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|