From e7f7c09b0b580e5f8f5c8c82a01f16a3cb1e3062 Mon Sep 17 00:00:00 2001 From: balibabu Date: Wed, 12 Nov 2025 12:30:08 +0800 Subject: [PATCH] Fix: Fixed an issue that caused the page to crash when a knowledge base variable was selected. #10427 (#11197) ### What problem does this PR solve? Fix: Fixed an issue that caused the page to crash when a knowledge base variable was selected. #10427 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/components/ragflow-avatar.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/src/components/ragflow-avatar.tsx b/web/src/components/ragflow-avatar.tsx index e84a01b34..e3bfc5700 100644 --- a/web/src/components/ragflow-avatar.tsx +++ b/web/src/components/ragflow-avatar.tsx @@ -11,6 +11,8 @@ const PREDEFINED_COLORS = [ ]; const getStringHash = (str: string): number => { + if (typeof str !== 'string') return 0; + const normalized = str.trim().toLowerCase(); let hash = 104729; const seed = 0x9747b28c; @@ -41,8 +43,8 @@ export const RAGFlowAvatar = memo( >(({ name, avatar, isPerson = false, className, ...props }, ref) => { // Generate initial letter logic const getInitials = (name?: string) => { - if (!name) return ''; - const parts = name.trim().split(/\s+/); + if (typeof name !== 'string' || !name) return ''; + const parts = name?.trim().split(/\s+/); if (parts.length === 1) { return parts[0][0].toUpperCase(); }