Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
Fix/web app permission check (#26821)
NFish5fc104a99283
diff --git a/web/app/components/base/chat/embedded-chatbot/context.tsx b/web/app/components/base/chat/embedded-chatbot/context.tsxindex 544da253af3..d6c35e172e1 100644--- a/web/app/components/base/chat/embedded-chatbot/context.tsx+++ b/web/app/components/base/chat/embedded-chatbot/context.tsx@@ -17,12 +17,9 @@ import type {import { noop } from 'lodash-es'export type EmbeddedChatbotContextValue = {- userCanAccess?: boolean- appInfoError?: any- appInfoLoading?: boolean- appMeta?: AppMeta- appData?: AppData- appParams?: ChatConfig+ appMeta: AppMeta | null+ appData: AppData | null+ appParams: ChatConfig | nullappChatListDataLoading?: booleancurrentConversationId: stringcurrentConversationItem?: ConversationItem@@ -59,7 +56,10 @@ export type EmbeddedChatbotContextValue = {}export const EmbeddedChatbotContext = createContext<EmbeddedChatbotContextValue>({- userCanAccess: false,+ appData: null,+ appMeta: null,+ appParams: null,+ appChatListDataLoading: false,currentConversationId: '',appPrevChatList: [],pinnedConversationList: [],diff --git a/web/app/components/base/chat/embedded-chatbot/hooks.tsx b/web/app/components/base/chat/embedded-chatbot/hooks.tsxindex aa7006db253..6987955b741 100644--- a/web/app/components/base/chat/embedded-chatbot/hooks.tsx+++ b/web/app/components/base/chat/embedded-chatbot/hooks.tsx@@ -18,9 +18,6 @@ import { CONVERSATION_ID_INFO } from '../constants'import { buildChatItemTree, getProcessedInputsFromUrlParams, getProcessedSystemVariablesFromUrlParams, getProcessedUserVariablesFromUrlParams } from '../utils'import { getProcessedFilesFromResponse } from '../../file-uploader/utils'import {- fetchAppInfo,- fetchAppMeta,- fetchAppParams,fetchChatList,fetchConversations,generationConversationName,@@ -36,8 +33,7 @@ import { InputVarType } from '@/app/components/workflow/types'import { TransferMethod } from '@/types/app'import { addFileInfos, sortAgentSorts } from '@/app/components/tools/utils'import { noop } from 'lodash-es'-import { useGetUserCanAccessApp } from '@/service/access-control'-import { useGlobalPublicStore } from '@/context/global-public-context'+import { useWebAppStore } from '@/context/web-app-context'function getFormattedChatList(messages: any[]) {const newChatList: ChatItem[] = []@@ -67,18 +63,10 @@ function getFormattedChatList(messages: any[]) {export const useEmbeddedChatbot = () => {const isInstalledApp = false- const systemFeatures = useGlobalPublicStore(s => s.systemFeatures)- const { data: appInfo, isLoading: appInfoLoading, error: appInfoError } = useSWR('appInfo', fetchAppInfo)- const { isPending: isCheckingPermission, data: userCanAccessResult } = useGetUserCanAccessApp({- appId: appInfo?.app_id,- isInstalledApp,- enabled: systemFeatures.webapp_auth.enabled,- })-- const appData = useMemo(() => {- return appInfo- }, [appInfo])- const appId = useMemo(() => appData?.app_id, [appData])+ const appInfo = useWebAppStore(s => s.appInfo)+ const appMeta = useWebAppStore(s => s.appMeta)+ const appParams = useWebAppStore(s => s.appParams)+ const appId = useMemo(() => appInfo?.app_id, [appInfo])const [userId, setUserId] = useState<string>()const [conversationId, setConversationId] = useState<string>()@@ -145,8 +133,6 @@ export const useEmbeddedChatbot = () => {return currentConversationId}, [currentConversationId, newConversationId])- const { data: appParams } = useSWR(['appParams', isInstalledApp, appId], () => fetchAppParams(isInstalledApp, appId))- const { data: appMeta } = useSWR(['appMeta', isInstalledApp, appId], () => fetchAppMeta(isInstalledApp, appId))const { data: appPinnedConversationData } = useSWR(['appConversationData', isInstalledApp, appId, true], () => fetchConversations(isInstalledApp, appId, undefined, true, 100))const { data: appConversationData, isLoading: appConversationDataLoading, mutate: mutateAppConversationData } = useSWR(['appConversationData', isInstalledApp, appId, false], () => fetchConversations(isInstalledApp, appId, undefined, false, 100))const { data: appChatListData, isLoading: appChatListDataLoading } = useSWR(chatShouldReloadKey ? ['appChatList', chatShouldReloadKey, isInstalledApp, appId] : null, () => fetchChatList(chatShouldReloadKey, isInstalledApp, appId))@@ -398,16 +384,13 @@ export const useEmbeddedChatbot = () => {}, [isInstalledApp, appId, t, notify])return {- appInfoError,- appInfoLoading: appInfoLoading || (systemFeatures.webapp_auth.enabled && isCheckingPermission),- userCanAccess: systemFeatures.webapp_auth.enabled ? userCanAccessResult?.result : true,isInstalledApp,allowResetChat,appId,currentConversationId,currentConversationItem,handleConversationIdInfoChange,- appData,+ appData: appInfo,appParams: appParams || {} as ChatConfig,appMeta,appPinnedConversationData,diff --git a/web/app/components/base/chat/embedded-chatbot/index.tsx b/web/app/components/base/chat/embedded-chatbot/index.tsxindex 4c8c0a2455e..df188e35d4c 100644--- a/web/app/components/base/chat/embedded-chatbot/index.tsx+++ b/web/app/components/base/chat/embedded-chatbot/index.tsx@@ -101,7 +101,6 @@ const EmbeddedChatbotWrapper = () => {const {appData,- userCanAccess,appParams,appMeta,appChatListDataLoading,@@ -135,7 +134,6 @@ const EmbeddedChatbotWrapper = () => {} = useEmbeddedChatbot()return <EmbeddedChatbotContext.Provider value={{- userCanAccess,appData,appParams,appMeta,