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)
This commit is contained in:
balibabu
2025-11-12 12:30:08 +08:00
committed by GitHub
parent 8ae562504b
commit e7f7c09b0b

View File

@ -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();
}