@blocklet/pages-kit 0.2.313 → 0.2.315
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/runtime/Runtime/index.js +8 -4
- package/lib/cjs/builtin/async/ai-runtime/state/agent.js +2 -3
- package/lib/cjs/builtin/async/ai-runtime/state/session.js +1 -1
- package/lib/cjs/components/CustomComponentRenderer/state.js +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/builtin/async/ai-runtime/runtime/Runtime/index.js +8 -4
- package/lib/esm/builtin/async/ai-runtime/state/agent.js +2 -3
- package/lib/esm/builtin/async/ai-runtime/state/session.js +1 -1
- package/lib/esm/components/CustomComponentRenderer/state.js +1 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/builtin/async/ai-runtime/runtime/Runtime/index.d.ts +4 -1
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ import { getComponentMountPoint } from '../../../../utils';
|
|
|
10
10
|
import RuntimeCommonProvider, { RuntimeLocaleProvider } from '../../components/RuntimeCommonProvider';
|
|
11
11
|
import SocialShare from '../../components/SocialShare';
|
|
12
12
|
import { AI_STUDIO_DID, DEFAULT_PAGE_COMPONENT_ID } from '../../constants';
|
|
13
|
-
import { RuntimeProviderFromUrl } from '../../contexts/Runtime';
|
|
13
|
+
import RuntimeProvider, { RuntimeProviderFromUrl } from '../../contexts/Runtime';
|
|
14
14
|
import useAppearances from '../../hooks/use-appearances';
|
|
15
15
|
import { useRuntimeState } from '../../state/runtime';
|
|
16
16
|
const logoSize = 44;
|
|
@@ -18,8 +18,12 @@ function AgentCreatedBy({ did }) {
|
|
|
18
18
|
const { t } = useLocaleContext();
|
|
19
19
|
return (_jsxs(_Fragment, { children: [t('by'), " ", _jsx(Box, { component: DID, did: did, copyable: false, responsive: true })] }));
|
|
20
20
|
}
|
|
21
|
-
export default function Runtime() {
|
|
22
|
-
|
|
21
|
+
export default function Runtime({ aid, working }) {
|
|
22
|
+
const children = (_jsx(RuntimeCommonProvider, { children: _jsx(RuntimeView, {}) }));
|
|
23
|
+
if (aid) {
|
|
24
|
+
return (_jsx(RuntimeProvider, { aid: aid, working: working, children: children }));
|
|
25
|
+
}
|
|
26
|
+
return _jsx(RuntimeProviderFromUrl, { children: children });
|
|
23
27
|
}
|
|
24
28
|
function RuntimeView() {
|
|
25
29
|
var _a;
|
|
@@ -55,5 +59,5 @@ ${agent === null || agent === void 0 ? void 0 : agent.description}
|
|
|
55
59
|
};
|
|
56
60
|
}, [locale, isMobile, agent]);
|
|
57
61
|
const componentId = (_a = appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentId) !== null && _a !== void 0 ? _a : DEFAULT_PAGE_COMPONENT_ID;
|
|
58
|
-
return (_jsxs(
|
|
62
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Helmet, { children: [agent.project.name && _jsx("title", { children: agent.project.name }), agent.project.description && _jsx("meta", { name: "description", content: agent.project.description })] }), _jsx(CustomComponentRenderer, { componentId: componentId, properties: appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentProps })] }));
|
|
59
63
|
}
|
|
@@ -13,8 +13,7 @@ import { getAgent } from '../api/agent';
|
|
|
13
13
|
import { useRuntimeContext } from '../contexts/Runtime';
|
|
14
14
|
import { createCachedStore } from '../utils/zustand';
|
|
15
15
|
export const createAgentState = ({ aid, working, agent }) => {
|
|
16
|
-
|
|
17
|
-
return createCachedStore(key, () => create()(immer((set) => ({
|
|
16
|
+
return createCachedStore(`agent-state-${aid}-${working}`, () => create()(immer((set) => ({
|
|
18
17
|
agent,
|
|
19
18
|
load: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
19
|
set((state) => {
|
|
@@ -48,7 +47,7 @@ export function useAgentState({ aid, working }) {
|
|
|
48
47
|
if (!state.agent) {
|
|
49
48
|
if (state.error)
|
|
50
49
|
throw state.error;
|
|
51
|
-
const key =
|
|
50
|
+
const key = `agent-loading-${aid}-${working}`;
|
|
52
51
|
(_a = LOADING_TASKS[key]) !== null && _a !== void 0 ? _a : (LOADING_TASKS[key] = state.load());
|
|
53
52
|
throw LOADING_TASKS[key];
|
|
54
53
|
}
|
|
@@ -36,7 +36,7 @@ import { createCachedStore } from '../utils/zustand';
|
|
|
36
36
|
const GET_MESSAGES_LIMIT = 100;
|
|
37
37
|
const GET_MESSAGES_ORDER_DIRECTION = 'desc';
|
|
38
38
|
export const createSessionState = ({ aid }) => {
|
|
39
|
-
return createCachedStore(aid
|
|
39
|
+
return createCachedStore(`session-state-${aid}`, () => create()(immer((set, get) => ({
|
|
40
40
|
reset: () => {
|
|
41
41
|
set((state) => {
|
|
42
42
|
state.loading = undefined;
|
|
@@ -135,7 +135,7 @@ function usePreloadComponent({ instanceId, componentId, properties, locale, dev
|
|
|
135
135
|
previousRef.current = result;
|
|
136
136
|
return result;
|
|
137
137
|
}
|
|
138
|
-
if (
|
|
138
|
+
if (instanceId) {
|
|
139
139
|
const key = [instanceId, realLocale].join('-');
|
|
140
140
|
(_a = COMPONENT_LOADER_MAP[key]) !== null && _a !== void 0 ? _a : (COMPONENT_LOADER_MAP[key] = customComponentStates()
|
|
141
141
|
.getState()
|