From e920cc0b8482c97af1d5f9be12f50e6045dd4753 Mon Sep 17 00:00:00 2001 From: bang9 Date: Fri, 8 Nov 2024 15:38:13 +0900 Subject: [PATCH 1/3] fix: use disconnectWebsocket --- packages/uikit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uikit b/packages/uikit index f8af8706c..d21217eaf 160000 --- a/packages/uikit +++ b/packages/uikit @@ -1 +1 @@ -Subproject commit f8af8706c4b6b429559e085bc60e1c9908f5ac5b +Subproject commit d21217eaf1e5d8d11e6ba692372d6b11a5f3ef35 From e2f9d170d1a94c24492e83f53c7bd9e8c5392c96 Mon Sep 17 00:00:00 2001 From: bang9 Date: Mon, 11 Nov 2024 09:53:25 +0900 Subject: [PATCH 2/3] fix: do not modify theme added by other logic --- packages/uikit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uikit b/packages/uikit index d21217eaf..31ec13e08 160000 --- a/packages/uikit +++ b/packages/uikit @@ -1 +1 @@ -Subproject commit d21217eaf1e5d8d11e6ba692372d6b11a5f3ef35 +Subproject commit 31ec13e08094eb6b57ed5fed9968d47770e1626b From 8467aa3d20e9d98239e1a3defcf95b4d3fecc75c Mon Sep 17 00:00:00 2001 From: bang9 Date: Mon, 11 Nov 2024 10:05:32 +0900 Subject: [PATCH 3/3] feat: add localCacheEnabled flag to Constants --- packages/uikit | 2 +- src/components/widget/ProviderContainer.tsx | 2 ++ src/const.ts | 5 +++++ src/context/ConstantContext.tsx | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/uikit b/packages/uikit index 31ec13e08..4fc061947 160000 --- a/packages/uikit +++ b/packages/uikit @@ -1 +1 @@ -Subproject commit 31ec13e08094eb6b57ed5fed9968d47770e1626b +Subproject commit 4fc0619472906ca5a0a3a8992650ca8bcfdf54c0 diff --git a/src/components/widget/ProviderContainer.tsx b/src/components/widget/ProviderContainer.tsx index 93311b25c..cf41f69ad 100644 --- a/src/components/widget/ProviderContainer.tsx +++ b/src/components/widget/ProviderContainer.tsx @@ -31,6 +31,7 @@ const SBComponent = ({ children }: { children: React.ReactElement }) => { isMobileView, dateLocale, enableHideWidgetForDeactivatedUser, + localCacheEnabled, } = useConstantState(); const { setIsVisible } = useWidgetState(); @@ -80,6 +81,7 @@ const SBComponent = ({ children }: { children: React.ReactElement }) => { nickname={userNickName} customApiHost={apiHost} customWebSocketHost={wsHost} + sdkInitParams={{ localCacheEnabled }} configureSession={configureSession} customExtensionParams={userAgentCustomParams} breakpoint={isMobileView} // A property that determines whether to show it with a layout that fits the mobile screen. Or you can put the width size with `px`. diff --git a/src/const.ts b/src/const.ts index 25fb04dc8..b4574de0e 100644 --- a/src/const.ts +++ b/src/const.ts @@ -266,6 +266,11 @@ export interface Constant extends ConstantFeatureFlags, ConstantAIFeatures { * @description Callback to be called when the widget open state changes. */ onWidgetOpenStateChange?: (params: OnWidgetOpenStateChangeParams) => void; + /** + * @private + * @description Determines whether to use the local cache of the Chat SDK. + */ + localCacheEnabled?: boolean; } interface ConstantAIFeatures { diff --git a/src/context/ConstantContext.tsx b/src/context/ConstantContext.tsx index 046377e50..694091b96 100644 --- a/src/context/ConstantContext.tsx +++ b/src/context/ConstantContext.tsx @@ -76,6 +76,7 @@ export const ConstantStateProvider = (props: PropsWithChildren