@chatsdk-dev/elements 0.0.1
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/README.md +43 -0
- package/dist/chunk-2LHKM7RD.js +14 -0
- package/dist/chunk-5UMYP6MD.js +10 -0
- package/dist/chunk-AP4MG32M.js +36 -0
- package/dist/chunk-CFM57HOS.js +358 -0
- package/dist/chunk-EGIUE7H2.js +37 -0
- package/dist/chunk-M5OONVIO.js +90 -0
- package/dist/chunk-MXTBCHYC.js +31 -0
- package/dist/chunk-NIC3MOMY.js +55 -0
- package/dist/chunk-QTRMNIG3.js +83 -0
- package/dist/chunk-R7G3RQLU.js +36 -0
- package/dist/chunk-RJG5D2TM.js +113 -0
- package/dist/chunk-SLJNKQ2G.js +125 -0
- package/dist/chunk-TDEFIW2L.js +9 -0
- package/dist/chunk-TDP6D7U7.js +551 -0
- package/dist/chunk-V2ITXC65.js +24 -0
- package/dist/chunk-VS55HRUS.js +16 -0
- package/dist/chunk-VYDYCGJL.js +25 -0
- package/dist/chunk-X5YUF2YM.js +113 -0
- package/dist/chunk-YX46JVQN.js +78 -0
- package/dist/chunk-YXAMLTTT.js +16 -0
- package/dist/chunk-YXFVHSY4.js +51 -0
- package/dist/chunk-ZCSZX3OI.js +4 -0
- package/dist/common/use-copy-to-clipboard.d.ts +3 -0
- package/dist/common/use-copy-to-clipboard.js +33 -0
- package/dist/common/utilts.d.ts +8 -0
- package/dist/common/utilts.js +28 -0
- package/dist/components/ai-elements/actions.d.ts +13 -0
- package/dist/components/ai-elements/actions.js +42 -0
- package/dist/components/ai-elements/agent.d.ts +31 -0
- package/dist/components/ai-elements/agent.js +77 -0
- package/dist/components/ai-elements/artifact.d.ts +27 -0
- package/dist/components/ai-elements/artifact.js +108 -0
- package/dist/components/ai-elements/attachments.d.ts +57 -0
- package/dist/components/ai-elements/attachments.js +258 -0
- package/dist/components/ai-elements/audio-player.d.ts +33 -0
- package/dist/components/ai-elements/audio-player.js +199 -0
- package/dist/components/ai-elements/canvas.d.ts +10 -0
- package/dist/components/ai-elements/canvas.js +24 -0
- package/dist/components/ai-elements/chain-of-thought.d.ts +34 -0
- package/dist/components/ai-elements/chain-of-thought.js +159 -0
- package/dist/components/ai-elements/checkpoint.d.ts +16 -0
- package/dist/components/ai-elements/checkpoint.js +47 -0
- package/dist/components/ai-elements/code-block.d.ts +48 -0
- package/dist/components/ai-elements/code-block.js +1 -0
- package/dist/components/ai-elements/commit.d.ts +68 -0
- package/dist/components/ai-elements/commit.js +314 -0
- package/dist/components/ai-elements/confirmation.d.ts +52 -0
- package/dist/components/ai-elements/confirmation.js +76 -0
- package/dist/components/ai-elements/connection.d.ts +5 -0
- package/dist/components/ai-elements/connection.js +34 -0
- package/dist/components/ai-elements/context.d.ts +36 -0
- package/dist/components/ai-elements/context.js +320 -0
- package/dist/components/ai-elements/controls.d.ts +8 -0
- package/dist/components/ai-elements/controls.js +17 -0
- package/dist/components/ai-elements/conversation.d.ts +27 -0
- package/dist/components/ai-elements/conversation.js +119 -0
- package/dist/components/ai-elements/edge.d.ts +9 -0
- package/dist/components/ai-elements/edge.js +111 -0
- package/dist/components/ai-elements/environment-variables.d.ts +42 -0
- package/dist/components/ai-elements/environment-variables.js +208 -0
- package/dist/components/ai-elements/file-tree.d.ts +30 -0
- package/dist/components/ai-elements/file-tree.js +212 -0
- package/dist/components/ai-elements/image.d.ts +10 -0
- package/dist/components/ai-elements/image.js +23 -0
- package/dist/components/ai-elements/inline-citation.d.ts +42 -0
- package/dist/components/ai-elements/inline-citation.js +203 -0
- package/dist/components/ai-elements/jsx-preview.d.ts +33 -0
- package/dist/components/ai-elements/jsx-preview.js +206 -0
- package/dist/components/ai-elements/loader.d.ts +9 -0
- package/dist/components/ai-elements/loader.js +115 -0
- package/dist/components/ai-elements/message.d.ts +42 -0
- package/dist/components/ai-elements/message.js +259 -0
- package/dist/components/ai-elements/mic-selector.d.ts +49 -0
- package/dist/components/ai-elements/mic-selector.js +252 -0
- package/dist/components/ai-elements/model-selector.d.ts +39 -0
- package/dist/components/ai-elements/model-selector.js +73 -0
- package/dist/components/ai-elements/node.d.ts +25 -0
- package/dist/components/ai-elements/node.js +41 -0
- package/dist/components/ai-elements/open-in-chat.d.ts +32 -0
- package/dist/components/ai-elements/open-in-chat.js +366 -0
- package/dist/components/ai-elements/package-info.d.ts +32 -0
- package/dist/components/ai-elements/package-info.js +162 -0
- package/dist/components/ai-elements/panel.d.ts +8 -0
- package/dist/components/ai-elements/panel.js +17 -0
- package/dist/components/ai-elements/persona.d.ts +50 -0
- package/dist/components/ai-elements/persona.js +209 -0
- package/dist/components/ai-elements/plan.d.ts +29 -0
- package/dist/components/ai-elements/plan.js +95 -0
- package/dist/components/ai-elements/prompt-input.d.ts +153 -0
- package/dist/components/ai-elements/prompt-input.js +939 -0
- package/dist/components/ai-elements/queue.d.ts +65 -0
- package/dist/components/ai-elements/queue.js +179 -0
- package/dist/components/ai-elements/reasoning.d.ts +30 -0
- package/dist/components/ai-elements/reasoning.js +161 -0
- package/dist/components/ai-elements/response.d.ts +9 -0
- package/dist/components/ai-elements/response.js +33 -0
- package/dist/components/ai-elements/sandbox.d.ts +28 -0
- package/dist/components/ai-elements/sandbox.js +98 -0
- package/dist/components/ai-elements/schema-display.d.ts +58 -0
- package/dist/components/ai-elements/schema-display.js +313 -0
- package/dist/components/ai-elements/shimmer.d.ts +14 -0
- package/dist/components/ai-elements/shimmer.js +1 -0
- package/dist/components/ai-elements/snippet.d.ts +22 -0
- package/dist/components/ai-elements/snippet.js +90 -0
- package/dist/components/ai-elements/sources.d.ts +16 -0
- package/dist/components/ai-elements/sources.js +62 -0
- package/dist/components/ai-elements/speech-input.d.ts +57 -0
- package/dist/components/ai-elements/speech-input.js +206 -0
- package/dist/components/ai-elements/stack-trace.d.ts +42 -0
- package/dist/components/ai-elements/stack-trace.js +377 -0
- package/dist/components/ai-elements/suggestion.d.ts +14 -0
- package/dist/components/ai-elements/suggestion.js +41 -0
- package/dist/components/ai-elements/task.d.ts +18 -0
- package/dist/components/ai-elements/task.js +60 -0
- package/dist/components/ai-elements/terminal.d.ts +31 -0
- package/dist/components/ai-elements/terminal.js +203 -0
- package/dist/components/ai-elements/test-results.d.ts +61 -0
- package/dist/components/ai-elements/test-results.js +349 -0
- package/dist/components/ai-elements/tool.d.ts +35 -0
- package/dist/components/ai-elements/tool.js +2 -0
- package/dist/components/ai-elements/toolbar.d.ts +8 -0
- package/dist/components/ai-elements/toolbar.js +18 -0
- package/dist/components/ai-elements/transcription.d.ts +19 -0
- package/dist/components/ai-elements/transcription.js +90 -0
- package/dist/components/ai-elements/voice-selector.d.ts +66 -0
- package/dist/components/ai-elements/voice-selector.js +332 -0
- package/dist/components/ai-elements/web-preview.d.ts +38 -0
- package/dist/components/ai-elements/web-preview.js +214 -0
- package/dist/components/info-card.d.ts +14 -0
- package/dist/components/info-card.js +1 -0
- package/dist/components/responsive-alert-dialog.d.ts +19 -0
- package/dist/components/responsive-alert-dialog.js +1 -0
- package/dist/components/responsive-dialog.d.ts +14 -0
- package/dist/components/responsive-dialog.js +1 -0
- package/dist/config-IcWUmjwj.d.ts +239 -0
- package/dist/features/chat/chat-card.d.ts +5 -0
- package/dist/features/chat/chat-card.js +14 -0
- package/dist/features/chat/chat-element/chat-element.d.ts +8 -0
- package/dist/features/chat/chat-element/chat-element.js +14 -0
- package/dist/features/chat/chat-element/use-chat.d.ts +21 -0
- package/dist/features/chat/chat-element/use-chat.js +14 -0
- package/dist/features/chat/chat-element/use-initial-messages.d.ts +20 -0
- package/dist/features/chat/chat-element/use-initial-messages.js +14 -0
- package/dist/features/chat/chat-header/chat-header.d.ts +8 -0
- package/dist/features/chat/chat-header/chat-header.js +14 -0
- package/dist/features/chat/chat-header/chat-menu.d.ts +5 -0
- package/dist/features/chat/chat-header/chat-menu.js +2 -0
- package/dist/features/chat/chat-history/chat-history-empty.d.ts +5 -0
- package/dist/features/chat/chat-history/chat-history-empty.js +1 -0
- package/dist/features/chat/chat-history/chat-history.d.ts +5 -0
- package/dist/features/chat/chat-history/chat-history.js +14 -0
- package/dist/features/chat/chat-message.d.ts +10 -0
- package/dist/features/chat/chat-message.js +1 -0
- package/dist/features/chat/chat-molecule.d.ts +35 -0
- package/dist/features/chat/chat-molecule.js +14 -0
- package/dist/features/chat/chat-prompt-input.d.ts +16 -0
- package/dist/features/chat/chat-prompt-input.js +14 -0
- package/dist/features/chat/chat.context.d.ts +26 -0
- package/dist/features/chat/chat.context.js +13 -0
- package/dist/features/chat/index.d.ts +14 -0
- package/dist/features/chat/index.js +14 -0
- package/dist/features/chat/queries/query-keys.d.ts +8 -0
- package/dist/features/chat/queries/query-keys.js +1 -0
- package/dist/features/chat/queries/use-create-conversation-mutation.d.ts +29 -0
- package/dist/features/chat/queries/use-create-conversation-mutation.js +38 -0
- package/dist/features/chat/queries/use-get-chat-query.d.ts +9 -0
- package/dist/features/chat/queries/use-get-chat-query.js +14 -0
- package/dist/features/chat/queries/use-get-conversation-query.d.ts +62 -0
- package/dist/features/chat/queries/use-get-conversation-query.js +14 -0
- package/dist/features/chat/queries/use-list-conversations-query.d.ts +29 -0
- package/dist/features/chat/queries/use-list-conversations-query.js +14 -0
- package/dist/features/chat/store.d.ts +13 -0
- package/dist/features/chat/store.js +1 -0
- package/dist/features/chat/utils.d.ts +5 -0
- package/dist/features/chat/utils.js +1 -0
- package/dist/features/data-fetching/use-api-client.d.ts +5 -0
- package/dist/features/data-fetching/use-api-client.js +14 -0
- package/dist/features/logger/logger.d.ts +9 -0
- package/dist/features/logger/logger.js +1 -0
- package/dist/features/molecule/chatsdk-provider.d.ts +19 -0
- package/dist/features/molecule/chatsdk-provider.js +26 -0
- package/dist/features/molecule/constants.d.ts +3 -0
- package/dist/features/molecule/constants.js +1 -0
- package/dist/features/molecule/molecule-provider.d.ts +39 -0
- package/dist/features/molecule/molecule-provider.js +1 -0
- package/dist/features/molecule/store.d.ts +53 -0
- package/dist/features/molecule/store.js +3 -0
- package/dist/features/molecule/types/api.d.ts +8 -0
- package/dist/features/molecule/types/api.js +1 -0
- package/dist/features/molecule/types/callbacks.d.ts +22 -0
- package/dist/features/molecule/types/callbacks.js +1 -0
- package/dist/features/molecule/types/config.d.ts +10 -0
- package/dist/features/molecule/types/config.js +1 -0
- package/dist/features/molecule/types/context.d.ts +11 -0
- package/dist/features/molecule/types/context.js +1 -0
- package/dist/features/molecule/types/locale.d.ts +9 -0
- package/dist/features/molecule/types/locale.js +1 -0
- package/dist/features/molecule/types/theme.d.ts +38 -0
- package/dist/features/molecule/types/theme.js +1 -0
- package/dist/features/molecule/types/translations.d.ts +10 -0
- package/dist/features/molecule/types/translations.js +1 -0
- package/dist/features/molecule/use-merge-global-config.d.ts +22 -0
- package/dist/features/molecule/use-merge-global-config.js +5 -0
- package/dist/features/molecule/use-molecule-config.d.ts +41 -0
- package/dist/features/molecule/use-molecule-config.js +6 -0
- package/dist/features/molecule/utils.d.ts +10 -0
- package/dist/features/molecule/utils.js +1 -0
- package/dist/i18n/config.d.ts +61 -0
- package/dist/i18n/config.js +1 -0
- package/dist/i18n/i18next.d.ts +11 -0
- package/dist/i18n/i18next.js +2 -0
- package/dist/i18n/utils.d.ts +11 -0
- package/dist/i18n/utils.js +6 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +20 -0
- package/dist/styles.css +6811 -0
- package/package.json +123 -0
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
import { ChatMenu } from './chunk-AP4MG32M.js';
|
|
2
|
+
import { ChatHistoryEmpty } from './chunk-YXAMLTTT.js';
|
|
3
|
+
import { chatQueryKeys } from './chunk-TDEFIW2L.js';
|
|
4
|
+
import { createMoleculeContext } from './chunk-M5OONVIO.js';
|
|
5
|
+
import { useMergeMoleculeConfig } from './chunk-VYDYCGJL.js';
|
|
6
|
+
import { useChatStore } from './chunk-2LHKM7RD.js';
|
|
7
|
+
import { getInitialMessagesFromStrings } from './chunk-5UMYP6MD.js';
|
|
8
|
+
import { ChatMessage } from './chunk-SLJNKQ2G.js';
|
|
9
|
+
import { getClient } from '@chatsdk-dev/api-client';
|
|
10
|
+
import { useTranslation } from 'react-i18next';
|
|
11
|
+
import { CardHeader, CardTitle, Card } from '@chatsdk-dev/ui/components/card';
|
|
12
|
+
import { DotsLoader } from '@chatsdk-dev/ui/components/dots-loader';
|
|
13
|
+
import { Text } from '@chatsdk-dev/ui/components/typography/text';
|
|
14
|
+
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
15
|
+
import { useState, useMemo, useEffect, useRef, Fragment } from 'react';
|
|
16
|
+
import { Conversation, ConversationContent, ConversationScrollButton } from '@chatsdk-dev/elements/components/ai-elements/conversation';
|
|
17
|
+
import { GlobeIcon, CheckIcon, ArrowLeft, Plus } from 'lucide-react';
|
|
18
|
+
import { PromptInput, PromptInputTextarea, PromptInputSubmit, PromptInputTools, PromptInputButton } from '@chatsdk-dev/elements/components/ai-elements/prompt-input';
|
|
19
|
+
import { ModelSelector, ModelSelectorTrigger, ModelSelectorLogo, ModelSelectorName, ModelSelectorContent, ModelSelectorInput, ModelSelectorList, ModelSelectorEmpty, ModelSelectorGroup, ModelSelectorItem, ModelSelectorLogoGroup } from '@chatsdk-dev/elements/components/ai-elements/model-selector';
|
|
20
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
21
|
+
import { useChat as useChat$1 } from '@ai-sdk/react';
|
|
22
|
+
import { DefaultChatTransport } from 'ai';
|
|
23
|
+
import { Button } from '@chatsdk-dev/ui/components/button';
|
|
24
|
+
import { renderRelativeTime } from '@chatsdk-dev/elements/common/utilts';
|
|
25
|
+
|
|
26
|
+
function useGetChatQuery({ chatId }) {
|
|
27
|
+
const client = useApiClient();
|
|
28
|
+
return useQuery({
|
|
29
|
+
queryKey: chatQueryKeys.get(chatId),
|
|
30
|
+
queryFn: async () => {
|
|
31
|
+
const { data, error } = await client.chats.get({
|
|
32
|
+
path: { chatId }
|
|
33
|
+
});
|
|
34
|
+
if (error) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
"error" in error ? error.error : "Failed to fetch chat"
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return data;
|
|
40
|
+
},
|
|
41
|
+
enabled: !!chatId
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function ChatPromptInput({
|
|
45
|
+
chatId,
|
|
46
|
+
onSubmit,
|
|
47
|
+
onModelChange,
|
|
48
|
+
status,
|
|
49
|
+
ref
|
|
50
|
+
}) {
|
|
51
|
+
const { data } = useGetChatQuery({ chatId });
|
|
52
|
+
const defaultModel = data?.chatModelSettings?.defaultModel;
|
|
53
|
+
const allowedModels = data?.chatModelSettings?.allowedModels;
|
|
54
|
+
const [input, setInput] = useState("");
|
|
55
|
+
const [model, setModel] = useState(defaultModel?.name);
|
|
56
|
+
const [modelSelectorOpen, setModelSelectorOpen] = useState(false);
|
|
57
|
+
const [webSearch, setWebSearch] = useState(false);
|
|
58
|
+
const selectedModel = allowedModels?.find((m) => m.name === model);
|
|
59
|
+
const modelGroups = allowedModels?.map((m) => m.chef);
|
|
60
|
+
const hasMultipleModels = allowedModels && allowedModels.length > 1;
|
|
61
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
62
|
+
/* @__PURE__ */ jsxs(
|
|
63
|
+
PromptInput,
|
|
64
|
+
{
|
|
65
|
+
onSubmit: (message, event) => {
|
|
66
|
+
onSubmit(message, event);
|
|
67
|
+
setInput("");
|
|
68
|
+
},
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
71
|
+
PromptInputTextarea,
|
|
72
|
+
{
|
|
73
|
+
ref,
|
|
74
|
+
placeholder: data?.chatBaseSettings?.inputPlaceholder,
|
|
75
|
+
onChange: (e) => setInput(e.target.value),
|
|
76
|
+
value: input
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
/* @__PURE__ */ jsx(
|
|
80
|
+
PromptInputSubmit,
|
|
81
|
+
{
|
|
82
|
+
className: "m-1.5 self-end",
|
|
83
|
+
disabled: !input,
|
|
84
|
+
status
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ jsxs(PromptInputTools, { children: [
|
|
91
|
+
/* @__PURE__ */ jsxs(
|
|
92
|
+
PromptInputButton,
|
|
93
|
+
{
|
|
94
|
+
variant: webSearch ? "primary" : "ghost",
|
|
95
|
+
onClick: () => setWebSearch(!webSearch),
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsx(GlobeIcon, { size: 16 }),
|
|
98
|
+
/* @__PURE__ */ jsx("span", { children: "Search" })
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
hasMultipleModels && /* @__PURE__ */ jsxs(
|
|
103
|
+
ModelSelector,
|
|
104
|
+
{
|
|
105
|
+
onOpenChange: setModelSelectorOpen,
|
|
106
|
+
open: modelSelectorOpen,
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ jsx(ModelSelectorTrigger, { children: /* @__PURE__ */ jsxs(PromptInputButton, { children: [
|
|
109
|
+
selectedModel?.chefSlug && /* @__PURE__ */ jsx(ModelSelectorLogo, { provider: selectedModel.chefSlug }),
|
|
110
|
+
/* @__PURE__ */ jsx(ModelSelectorName, { children: selectedModel?.name })
|
|
111
|
+
] }) }),
|
|
112
|
+
/* @__PURE__ */ jsxs(ModelSelectorContent, { children: [
|
|
113
|
+
/* @__PURE__ */ jsx(ModelSelectorInput, { placeholder: "Search models..." }),
|
|
114
|
+
/* @__PURE__ */ jsxs(ModelSelectorList, { children: [
|
|
115
|
+
/* @__PURE__ */ jsx(ModelSelectorEmpty, { children: "No models found." }),
|
|
116
|
+
modelGroups?.map((chef) => /* @__PURE__ */ jsx(ModelSelectorGroup, { heading: chef, children: allowedModels.filter((m) => m.chef === chef).map((m) => /* @__PURE__ */ jsxs(
|
|
117
|
+
ModelSelectorItem,
|
|
118
|
+
{
|
|
119
|
+
onSelect: () => {
|
|
120
|
+
setModel(m.name);
|
|
121
|
+
onModelChange?.(m);
|
|
122
|
+
setModelSelectorOpen(false);
|
|
123
|
+
},
|
|
124
|
+
value: m.name,
|
|
125
|
+
children: [
|
|
126
|
+
/* @__PURE__ */ jsx(ModelSelectorLogo, { provider: m.chefSlug }),
|
|
127
|
+
/* @__PURE__ */ jsx(ModelSelectorName, { children: m.name }),
|
|
128
|
+
/* @__PURE__ */ jsx(ModelSelectorLogoGroup, { children: m.providers.map((provider) => /* @__PURE__ */ jsx(
|
|
129
|
+
ModelSelectorLogo,
|
|
130
|
+
{
|
|
131
|
+
provider
|
|
132
|
+
},
|
|
133
|
+
provider
|
|
134
|
+
)) }),
|
|
135
|
+
selectedModel?.name === m.name ? /* @__PURE__ */ jsx(CheckIcon, { className: "ml-auto size-4" }) : /* @__PURE__ */ jsx("div", { className: "ml-auto size-4" })
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
m.name
|
|
139
|
+
)) }, chef))
|
|
140
|
+
] })
|
|
141
|
+
] })
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
] })
|
|
146
|
+
] });
|
|
147
|
+
}
|
|
148
|
+
async function getConversation({
|
|
149
|
+
client,
|
|
150
|
+
chatId,
|
|
151
|
+
actorId,
|
|
152
|
+
conversationId
|
|
153
|
+
}) {
|
|
154
|
+
if (!conversationId) {
|
|
155
|
+
const { data: newConversation, error: error2 } = await client.chats.conversations.create({
|
|
156
|
+
path: { chatId },
|
|
157
|
+
body: { actorId }
|
|
158
|
+
});
|
|
159
|
+
if (error2) {
|
|
160
|
+
throw new Error(
|
|
161
|
+
"error" in error2 ? error2.error : "Failed to create conversation"
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
useChatStore.setState({
|
|
165
|
+
...useChatStore.getState(),
|
|
166
|
+
selectedConversationId: newConversation._id
|
|
167
|
+
});
|
|
168
|
+
return newConversation;
|
|
169
|
+
}
|
|
170
|
+
const { data, error } = await client.chats.conversations.get({
|
|
171
|
+
path: { chatId, conversationId }
|
|
172
|
+
});
|
|
173
|
+
if (error) {
|
|
174
|
+
throw new Error(
|
|
175
|
+
"error" in error ? error.error : "Failed to fetch conversation"
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
return data;
|
|
179
|
+
}
|
|
180
|
+
function getConversationQueryConfig({
|
|
181
|
+
chatId,
|
|
182
|
+
conversationId,
|
|
183
|
+
client,
|
|
184
|
+
actorId
|
|
185
|
+
}) {
|
|
186
|
+
return {
|
|
187
|
+
queryKey: chatQueryKeys.conversation(chatId, conversationId),
|
|
188
|
+
queryFn: () => getConversation({ client, chatId, conversationId, actorId })
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function useGetConversationQuery({
|
|
192
|
+
chatId,
|
|
193
|
+
conversationId
|
|
194
|
+
}) {
|
|
195
|
+
const client = useApiClient();
|
|
196
|
+
const { context } = useMoleculeConfig();
|
|
197
|
+
return useQuery({
|
|
198
|
+
...getConversationQueryConfig({
|
|
199
|
+
chatId,
|
|
200
|
+
conversationId,
|
|
201
|
+
client,
|
|
202
|
+
actorId: context?.actor?.id ?? ""
|
|
203
|
+
}),
|
|
204
|
+
enabled: !!chatId,
|
|
205
|
+
staleTime: 200
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
function useInitialMessages() {
|
|
209
|
+
const { selectedConversationId } = useChatStore();
|
|
210
|
+
const { chatId } = useMoleculeComponent();
|
|
211
|
+
const { data } = useGetChatQuery({ chatId });
|
|
212
|
+
const { data: conversation } = useGetConversationQuery({
|
|
213
|
+
chatId,
|
|
214
|
+
conversationId: selectedConversationId
|
|
215
|
+
});
|
|
216
|
+
const conversationMessages = useMemo(() => {
|
|
217
|
+
if (!selectedConversationId) return void 0;
|
|
218
|
+
return conversation?.messages?.map((msg) => {
|
|
219
|
+
return {
|
|
220
|
+
id: msg.id,
|
|
221
|
+
role: msg.role,
|
|
222
|
+
parts: msg.parts.map((p) => ({
|
|
223
|
+
type: "text",
|
|
224
|
+
text: p.text ?? ""
|
|
225
|
+
})),
|
|
226
|
+
metadata: msg
|
|
227
|
+
};
|
|
228
|
+
});
|
|
229
|
+
}, [conversation, selectedConversationId]);
|
|
230
|
+
const initialMessages = useMemo(() => {
|
|
231
|
+
const initialChatMessages = getInitialMessagesFromStrings(
|
|
232
|
+
data?.chatBaseSettings?.initialChatMessages ?? []
|
|
233
|
+
);
|
|
234
|
+
return [...initialChatMessages, ...conversationMessages ?? []];
|
|
235
|
+
}, [data?.chatBaseSettings?.initialChatMessages, conversationMessages]);
|
|
236
|
+
return initialMessages;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// src/features/chat/chat-element/use-chat.tsx
|
|
240
|
+
function useChat() {
|
|
241
|
+
const client = useApiClient();
|
|
242
|
+
const { config, component } = useMolecule();
|
|
243
|
+
const { selectedConversationId, conversationType } = useChatStore();
|
|
244
|
+
const initialMessages = useInitialMessages();
|
|
245
|
+
const useChatResult = useChat$1({
|
|
246
|
+
messages: initialMessages,
|
|
247
|
+
transport: new DefaultChatTransport({
|
|
248
|
+
prepareSendMessagesRequest: ({
|
|
249
|
+
body,
|
|
250
|
+
headers,
|
|
251
|
+
credentials,
|
|
252
|
+
id,
|
|
253
|
+
messages,
|
|
254
|
+
trigger,
|
|
255
|
+
messageId
|
|
256
|
+
}) => {
|
|
257
|
+
return {
|
|
258
|
+
api: client.getUrl("chats.conversations.completion", {
|
|
259
|
+
chatId: component.chatId,
|
|
260
|
+
conversationId: body?.conversationId || "new"
|
|
261
|
+
}),
|
|
262
|
+
body: {
|
|
263
|
+
...body,
|
|
264
|
+
id,
|
|
265
|
+
messages,
|
|
266
|
+
trigger,
|
|
267
|
+
messageId
|
|
268
|
+
},
|
|
269
|
+
headers,
|
|
270
|
+
credentials
|
|
271
|
+
};
|
|
272
|
+
},
|
|
273
|
+
headers: {
|
|
274
|
+
...config.api?.headers
|
|
275
|
+
}
|
|
276
|
+
})
|
|
277
|
+
});
|
|
278
|
+
useEffect(() => {
|
|
279
|
+
if (conversationType === "history" || !selectedConversationId) {
|
|
280
|
+
useChatResult.stop();
|
|
281
|
+
useChatResult.setMessages(initialMessages);
|
|
282
|
+
}
|
|
283
|
+
}, [conversationType, selectedConversationId, initialMessages]);
|
|
284
|
+
return useChatResult;
|
|
285
|
+
}
|
|
286
|
+
function ChatElement() {
|
|
287
|
+
const queryClient = useQueryClient();
|
|
288
|
+
const client = useApiClient();
|
|
289
|
+
const { chatId } = useMoleculeComponent();
|
|
290
|
+
const { context } = useMoleculeConfig();
|
|
291
|
+
const { selectedConversationId } = useChatStore();
|
|
292
|
+
const { data: conversation } = useGetConversationQuery({
|
|
293
|
+
chatId,
|
|
294
|
+
conversationId: selectedConversationId
|
|
295
|
+
});
|
|
296
|
+
const { messages, sendMessage, status } = useChat();
|
|
297
|
+
const promptInputRef = useRef(null);
|
|
298
|
+
useEffect(() => {
|
|
299
|
+
promptInputRef.current?.focus();
|
|
300
|
+
}, [selectedConversationId]);
|
|
301
|
+
const handleSubmit = async (message) => {
|
|
302
|
+
let conversationId = conversation?._id;
|
|
303
|
+
if (!conversation) {
|
|
304
|
+
const newConversation = await queryClient.fetchQuery({
|
|
305
|
+
...getConversationQueryConfig({
|
|
306
|
+
chatId,
|
|
307
|
+
conversationId: selectedConversationId,
|
|
308
|
+
client,
|
|
309
|
+
actorId: context?.actor?.id ?? ""
|
|
310
|
+
})
|
|
311
|
+
});
|
|
312
|
+
conversationId = newConversation._id;
|
|
313
|
+
}
|
|
314
|
+
sendMessage({ text: message.text }, { body: { conversationId } });
|
|
315
|
+
};
|
|
316
|
+
const lastMessage = messages[messages.length - 1];
|
|
317
|
+
const isWaitingForContent = status === "submitted" || status === "streaming" && lastMessage?.role === "assistant" && !lastMessage.parts.some(
|
|
318
|
+
(part) => part.type === "text" && part.text.length > 0
|
|
319
|
+
);
|
|
320
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
321
|
+
/* @__PURE__ */ jsxs(Conversation, { children: [
|
|
322
|
+
/* @__PURE__ */ jsxs(ConversationContent, { children: [
|
|
323
|
+
/* @__PURE__ */ jsx(ChatMessage, { messages }),
|
|
324
|
+
isWaitingForContent && /* @__PURE__ */ jsx(DotsLoader, {})
|
|
325
|
+
] }),
|
|
326
|
+
/* @__PURE__ */ jsx(ConversationScrollButton, {})
|
|
327
|
+
] }),
|
|
328
|
+
/* @__PURE__ */ jsx("div", { className: "m-4 my-2", children: /* @__PURE__ */ jsx(
|
|
329
|
+
ChatPromptInput,
|
|
330
|
+
{
|
|
331
|
+
ref: promptInputRef,
|
|
332
|
+
chatId,
|
|
333
|
+
onSubmit: handleSubmit,
|
|
334
|
+
status
|
|
335
|
+
}
|
|
336
|
+
) })
|
|
337
|
+
] });
|
|
338
|
+
}
|
|
339
|
+
ChatElement.displayName = "ChatElement";
|
|
340
|
+
function ChatHeader({ chatId }) {
|
|
341
|
+
const { t } = useTranslation();
|
|
342
|
+
const { tab, setTab } = useChatStore();
|
|
343
|
+
const { data } = useGetChatQuery({ chatId });
|
|
344
|
+
const [_, setImgLoaded] = useState(false);
|
|
345
|
+
const name = data?.chatAppearanceSettings?.displayName;
|
|
346
|
+
const iconUrl = data?.chatAppearanceSettings?.icon?.url;
|
|
347
|
+
return /* @__PURE__ */ jsxs(CardHeader, { className: "flex justify-between items-center h-14 bg-slate-900 dark:bg-zinc-400 rounded-t-lg px-4!", children: [
|
|
348
|
+
/* @__PURE__ */ jsxs(CardTitle, { children: [
|
|
349
|
+
tab === "chat" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
350
|
+
iconUrl && /* @__PURE__ */ jsx(
|
|
351
|
+
"img",
|
|
352
|
+
{
|
|
353
|
+
src: iconUrl,
|
|
354
|
+
alt: "Chat Icon",
|
|
355
|
+
className: "inline-block w-4 h-4",
|
|
356
|
+
onLoad: () => setImgLoaded(true)
|
|
357
|
+
}
|
|
358
|
+
),
|
|
359
|
+
/* @__PURE__ */ jsx(
|
|
360
|
+
Text,
|
|
361
|
+
{
|
|
362
|
+
variant: "h1",
|
|
363
|
+
className: "text-sm text-background flex items-center gap-2",
|
|
364
|
+
children: name
|
|
365
|
+
}
|
|
366
|
+
)
|
|
367
|
+
] }),
|
|
368
|
+
tab === "history" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
369
|
+
/* @__PURE__ */ jsx(
|
|
370
|
+
Button,
|
|
371
|
+
{
|
|
372
|
+
onClick: () => setTab("chat"),
|
|
373
|
+
variant: "transparent",
|
|
374
|
+
className: "p-0!",
|
|
375
|
+
children: /* @__PURE__ */ jsx(ArrowLeft, { className: "size-4" })
|
|
376
|
+
}
|
|
377
|
+
),
|
|
378
|
+
/* @__PURE__ */ jsx(
|
|
379
|
+
Text,
|
|
380
|
+
{
|
|
381
|
+
variant: "h1",
|
|
382
|
+
className: "text-sm text-background flex items-center gap-2",
|
|
383
|
+
children: t("header.history-tab-label")
|
|
384
|
+
}
|
|
385
|
+
)
|
|
386
|
+
] })
|
|
387
|
+
] }),
|
|
388
|
+
tab === "chat" && /* @__PURE__ */ jsx(ChatMenu, {})
|
|
389
|
+
] });
|
|
390
|
+
}
|
|
391
|
+
function useListConversationsQuery({
|
|
392
|
+
chatId
|
|
393
|
+
}) {
|
|
394
|
+
const client = useApiClient();
|
|
395
|
+
const { context } = useMoleculeConfig();
|
|
396
|
+
return useQuery({
|
|
397
|
+
queryKey: chatQueryKeys.listConversations(chatId),
|
|
398
|
+
queryFn: async () => {
|
|
399
|
+
const { data, error } = await client.chats.conversations.list({
|
|
400
|
+
path: { chatId },
|
|
401
|
+
query: { actorId: context?.actor?.id ?? "" }
|
|
402
|
+
});
|
|
403
|
+
if (error) {
|
|
404
|
+
throw new Error(
|
|
405
|
+
"error" in error ? error.error : "Failed to fetch conversations"
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
return data.conversations.reverse();
|
|
409
|
+
},
|
|
410
|
+
enabled: !!chatId
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
function ChatHistory() {
|
|
414
|
+
const { t, i18n } = useTranslation("chat", { keyPrefix: "history" });
|
|
415
|
+
const queryClient = useQueryClient();
|
|
416
|
+
const { chatId } = useMoleculeComponent();
|
|
417
|
+
const { data, isLoading } = useListConversationsQuery({ chatId });
|
|
418
|
+
const { setSelectedConversationId, setTab, setConversationType } = useChatStore();
|
|
419
|
+
if (isLoading) {
|
|
420
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(DotsLoader, {}) });
|
|
421
|
+
}
|
|
422
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex-1 min-h-0 flex flex-col gap-1 overflow-y-auto gap-2 p-2", children: [
|
|
423
|
+
data?.length === 0 ? /* @__PURE__ */ jsx(ChatHistoryEmpty, {}) : data?.map((conversation, index) => /* @__PURE__ */ jsxs(
|
|
424
|
+
Button,
|
|
425
|
+
{
|
|
426
|
+
variant: "ghost",
|
|
427
|
+
className: "flex flex-col items-start justify-center gap-2 px-3 py-2 h-auto text-left",
|
|
428
|
+
onClick: () => {
|
|
429
|
+
queryClient.invalidateQueries({
|
|
430
|
+
queryKey: chatQueryKeys.conversation(chatId, conversation._id)
|
|
431
|
+
});
|
|
432
|
+
setSelectedConversationId(conversation._id);
|
|
433
|
+
setTab("chat");
|
|
434
|
+
setConversationType("history");
|
|
435
|
+
},
|
|
436
|
+
children: [
|
|
437
|
+
/* @__PURE__ */ jsxs("div", { className: "self-stretch flex justify-between gap-1", children: [
|
|
438
|
+
/* @__PURE__ */ jsxs(Text, { className: "truncate text-sm", children: [
|
|
439
|
+
data.length - index,
|
|
440
|
+
":",
|
|
441
|
+
" ",
|
|
442
|
+
conversation.title ?? t("unitled-conversation")
|
|
443
|
+
] }),
|
|
444
|
+
/* @__PURE__ */ jsx(Text, { variant: "tiny", color: "muted", children: renderRelativeTime({
|
|
445
|
+
date: conversation._creationTime,
|
|
446
|
+
locale: i18n.language
|
|
447
|
+
}) })
|
|
448
|
+
] }),
|
|
449
|
+
/* @__PURE__ */ jsx(
|
|
450
|
+
Text,
|
|
451
|
+
{
|
|
452
|
+
className: "flex-1 min-w-0 max-w-full truncate",
|
|
453
|
+
variant: "paragraph2",
|
|
454
|
+
color: "muted",
|
|
455
|
+
children: conversation.summary
|
|
456
|
+
}
|
|
457
|
+
)
|
|
458
|
+
]
|
|
459
|
+
},
|
|
460
|
+
conversation._id
|
|
461
|
+
)),
|
|
462
|
+
/* @__PURE__ */ jsxs(
|
|
463
|
+
Button,
|
|
464
|
+
{
|
|
465
|
+
className: "absolute bottom-6 left-1/2 -translate-x-1/2",
|
|
466
|
+
onClick: () => {
|
|
467
|
+
setConversationType("new");
|
|
468
|
+
setSelectedConversationId();
|
|
469
|
+
setTab("chat");
|
|
470
|
+
},
|
|
471
|
+
children: [
|
|
472
|
+
/* @__PURE__ */ jsx(Plus, { className: "size-4" }),
|
|
473
|
+
t("new-conversation")
|
|
474
|
+
]
|
|
475
|
+
}
|
|
476
|
+
)
|
|
477
|
+
] });
|
|
478
|
+
}
|
|
479
|
+
function ChatCard() {
|
|
480
|
+
const { t } = useTranslation();
|
|
481
|
+
const { chatId } = useMoleculeComponent();
|
|
482
|
+
const { tab, selectedConversationId, conversationType } = useChatStore();
|
|
483
|
+
useListConversationsQuery({ chatId });
|
|
484
|
+
const { isLoading, data: chat } = useGetChatQuery({ chatId });
|
|
485
|
+
const { isLoading: isConversationLoading } = useGetConversationQuery({
|
|
486
|
+
chatId,
|
|
487
|
+
conversationId: selectedConversationId
|
|
488
|
+
});
|
|
489
|
+
const canCreateMessage = chat?.chatModelSettings?.allowedModels && chat?.chatModelSettings?.allowedModels.length > 0;
|
|
490
|
+
if (!canCreateMessage && chat?.chatBaseSettings?.hideChatWhenInsufficientCredits) {
|
|
491
|
+
return null;
|
|
492
|
+
}
|
|
493
|
+
return /* @__PURE__ */ jsxs(Card, { className: "min-w-[320px] h-[640px] w-[400px] flex flex-col relative p-0 rounded-lg gap-0", children: [
|
|
494
|
+
isLoading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center z-10 bg-card rounded-lg", children: /* @__PURE__ */ jsx(DotsLoader, {}) }),
|
|
495
|
+
/* @__PURE__ */ jsx(ChatHeader, { chatId }),
|
|
496
|
+
conversationType === "history" && isConversationLoading && /* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center justify-center z-10 bg-card rounded-lg", children: /* @__PURE__ */ jsx(DotsLoader, {}) }),
|
|
497
|
+
!isLoading && (conversationType === "new" || !isConversationLoading) && /* @__PURE__ */ jsxs(
|
|
498
|
+
"div",
|
|
499
|
+
{
|
|
500
|
+
className: tab !== "chat" ? "hidden" : "flex flex-col flex-1 min-h-0",
|
|
501
|
+
children: [
|
|
502
|
+
conversationType === "history" && isConversationLoading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center z-10 bg-card rounded-lg", children: /* @__PURE__ */ jsx(DotsLoader, {}) }),
|
|
503
|
+
canCreateMessage ? /* @__PURE__ */ jsx(ChatElement, {}) : /* @__PURE__ */ jsx("div", { className: "m-4 h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
504
|
+
Text,
|
|
505
|
+
{
|
|
506
|
+
variant: "paragraph1",
|
|
507
|
+
color: "muted",
|
|
508
|
+
className: "text-center font-light italic",
|
|
509
|
+
children: t("chat-card.insufficient-credits-error")
|
|
510
|
+
}
|
|
511
|
+
) })
|
|
512
|
+
]
|
|
513
|
+
}
|
|
514
|
+
),
|
|
515
|
+
!isLoading && tab === "history" && /* @__PURE__ */ jsx(ChatHistory, {})
|
|
516
|
+
] });
|
|
517
|
+
}
|
|
518
|
+
var {
|
|
519
|
+
MoleculeProvider,
|
|
520
|
+
useMolecule,
|
|
521
|
+
useMoleculeConfig,
|
|
522
|
+
useMoleculeComponent,
|
|
523
|
+
useMoleculeCallbacks
|
|
524
|
+
} = createMoleculeContext({ name: "ChatSDK.Chat" });
|
|
525
|
+
function ChatMolecule(props) {
|
|
526
|
+
const { config, callbacks, ...componentProps } = useMergeMoleculeConfig({
|
|
527
|
+
props,
|
|
528
|
+
name: "ChatSDK.Chat"
|
|
529
|
+
});
|
|
530
|
+
if (!componentProps.chatId) {
|
|
531
|
+
return null;
|
|
532
|
+
}
|
|
533
|
+
return /* @__PURE__ */ jsx(
|
|
534
|
+
MoleculeProvider,
|
|
535
|
+
{
|
|
536
|
+
config,
|
|
537
|
+
component: componentProps,
|
|
538
|
+
callbacks,
|
|
539
|
+
children: /* @__PURE__ */ jsx(ChatCard, {})
|
|
540
|
+
}
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
ChatMolecule.displayName = "ChatSDK.ChatMolecule";
|
|
544
|
+
|
|
545
|
+
// src/features/data-fetching/use-api-client.ts
|
|
546
|
+
function useApiClient() {
|
|
547
|
+
const { api } = useMoleculeConfig();
|
|
548
|
+
return getClient(api ?? {});
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
export { ChatCard, ChatElement, ChatHeader, ChatHistory, ChatMolecule, ChatPromptInput, MoleculeProvider, getConversationQueryConfig, useApiClient, useChat, useGetChatQuery, useGetConversationQuery, useInitialMessages, useListConversationsQuery, useMolecule, useMoleculeCallbacks, useMoleculeComponent, useMoleculeConfig };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { resources, languages, defaultNamespace, fallbackLng } from './chunk-R7G3RQLU.js';
|
|
2
|
+
import i18next from 'i18next';
|
|
3
|
+
import { initReactI18next } from 'react-i18next/initReactI18next';
|
|
4
|
+
|
|
5
|
+
var runsOnServerSide = typeof window === "undefined";
|
|
6
|
+
var elementsI18n = i18next.createInstance();
|
|
7
|
+
elementsI18n.use(initReactI18next).init({
|
|
8
|
+
// debug: true,
|
|
9
|
+
showSupportNotice: false,
|
|
10
|
+
supportedLngs: languages,
|
|
11
|
+
fallbackLng,
|
|
12
|
+
fallbackNS: defaultNamespace,
|
|
13
|
+
defaultNS: defaultNamespace,
|
|
14
|
+
lng: void 0,
|
|
15
|
+
// detect the language on client side
|
|
16
|
+
detection: {
|
|
17
|
+
order: ["path", "htmlTag", "cookie", "navigator"]
|
|
18
|
+
},
|
|
19
|
+
preload: runsOnServerSide ? languages : [],
|
|
20
|
+
resources
|
|
21
|
+
});
|
|
22
|
+
var i18n = elementsI18n;
|
|
23
|
+
|
|
24
|
+
export { i18n };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/features/logger/logger.ts
|
|
2
|
+
function noOp() {
|
|
3
|
+
}
|
|
4
|
+
function getLogger(loggers) {
|
|
5
|
+
const _loggers = typeof loggers === "function" ? { info: loggers } : loggers;
|
|
6
|
+
const infoLogger = _loggers?.info || noOp;
|
|
7
|
+
const warnLogger = _loggers?.warn || infoLogger;
|
|
8
|
+
const errorLogger = _loggers?.error || infoLogger;
|
|
9
|
+
return {
|
|
10
|
+
info: infoLogger,
|
|
11
|
+
warn: warnLogger,
|
|
12
|
+
error: errorLogger
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { getLogger };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useMergeGlobalConfig } from './chunk-MXTBCHYC.js';
|
|
2
|
+
|
|
3
|
+
// src/features/molecule/use-molecule-config.ts
|
|
4
|
+
function useMergeMoleculeConfig(moleculeConfig) {
|
|
5
|
+
const {
|
|
6
|
+
defaultProps: flatDefaultProps,
|
|
7
|
+
component,
|
|
8
|
+
...flatProps
|
|
9
|
+
} = moleculeConfig.props;
|
|
10
|
+
const { defaultProps: componentDefaultProps, ...componentProps } = component || {};
|
|
11
|
+
const _defaultProps = { ...flatDefaultProps, ...componentDefaultProps };
|
|
12
|
+
const _props = { ...componentProps, ...flatProps };
|
|
13
|
+
const { config, onloading, onsuccess, onerror, ...rest } = {
|
|
14
|
+
..._defaultProps,
|
|
15
|
+
..._props
|
|
16
|
+
};
|
|
17
|
+
const mergedConfig = useMergeGlobalConfig(config);
|
|
18
|
+
return {
|
|
19
|
+
...rest,
|
|
20
|
+
config: mergedConfig,
|
|
21
|
+
callbacks: { onloading, onsuccess, onerror }
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { useMergeMoleculeConfig };
|