mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
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:
@ -11,6 +11,8 @@ const PREDEFINED_COLORS = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const getStringHash = (str: string): number => {
|
const getStringHash = (str: string): number => {
|
||||||
|
if (typeof str !== 'string') return 0;
|
||||||
|
|
||||||
const normalized = str.trim().toLowerCase();
|
const normalized = str.trim().toLowerCase();
|
||||||
let hash = 104729;
|
let hash = 104729;
|
||||||
const seed = 0x9747b28c;
|
const seed = 0x9747b28c;
|
||||||
@ -41,8 +43,8 @@ export const RAGFlowAvatar = memo(
|
|||||||
>(({ name, avatar, isPerson = false, className, ...props }, ref) => {
|
>(({ name, avatar, isPerson = false, className, ...props }, ref) => {
|
||||||
// Generate initial letter logic
|
// Generate initial letter logic
|
||||||
const getInitials = (name?: string) => {
|
const getInitials = (name?: string) => {
|
||||||
if (!name) return '';
|
if (typeof name !== 'string' || !name) return '';
|
||||||
const parts = name.trim().split(/\s+/);
|
const parts = name?.trim().split(/\s+/);
|
||||||
if (parts.length === 1) {
|
if (parts.length === 1) {
|
||||||
return parts[0][0].toUpperCase();
|
return parts[0][0].toUpperCase();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user