diff --git a/web/src/ee/layouts/components/header-enterprise.tsx b/web/src/ee/layouts/components/header-enterprise.tsx index 6a36f7cb05..0e4142c16a 100644 --- a/web/src/ee/layouts/components/header-enterprise.tsx +++ b/web/src/ee/layouts/components/header-enterprise.tsx @@ -1,9 +1,16 @@ /** * Enterprise slots inside the app header. The open-source build renders * nothing here; the enterprise build replaces this file with the real - * billing entries (upgrade badge, support link, current-plan badge). + * entries (tenant switcher, upgrade badge, support link, current-plan badge). */ +export function EnterpriseHeaderTenantSwitcher(_props: { + isCompact?: boolean; +}) { + void _props; + return null; +} + export function EnterpriseHeaderUpgradeBadge() { return null; } diff --git a/web/src/hooks/use-user-setting-request.tsx b/web/src/hooks/use-user-setting-request.tsx index aa52785d25..879b5bfc86 100644 --- a/web/src/hooks/use-user-setting-request.tsx +++ b/web/src/hooks/use-user-setting-request.tsx @@ -216,6 +216,20 @@ export const useSaveSetting = (silent = false) => { return { data, loading, saveSetting: mutateAsync }; }; +// The version endpoint returns either a bare string or `{ version: string }` +// depending on the backend implementation. Normalize both so the sidebar +// never attempts to render an object as a React child. +const normalizeSystemVersion = (payload: unknown): string => { + if (typeof payload === 'string') { + return payload; + } + if (payload && typeof payload === 'object' && 'version' in payload) { + const { version } = payload as { version?: unknown }; + return typeof version === 'string' ? version : ''; + } + return ''; +}; + export const useFetchSystemVersion = () => { const [version, setVersion] = useState(''); const [loading, setLoading] = useState(false); @@ -225,7 +239,7 @@ export const useFetchSystemVersion = () => { setLoading(true); const { data } = await userService.getSystemVersion(); if (data.code === 0) { - setVersion(data.data.version); + setVersion(normalizeSystemVersion(data.data)); setLoading(false); } } catch (error) { diff --git a/web/src/layouts/components/header.tsx b/web/src/layouts/components/header.tsx index cdea671b14..39e328f0a2 100644 --- a/web/src/layouts/components/header.tsx +++ b/web/src/layouts/components/header.tsx @@ -9,6 +9,7 @@ import { } from '@/components/ui/dropdown-menu'; import { EnterpriseHeaderPlanBadge, + EnterpriseHeaderTenantSwitcher, EnterpriseHeaderTicketsLink, EnterpriseHeaderUpgradeBadge, } from '@/ee/layouts/components/header-enterprise'; @@ -87,6 +88,7 @@ export function Header({ > RAGFlow logo +