Add "Creature" entity type and reorganize type mappings

- Add Creature to default entity types
- Map animals/beings to creature type
This commit is contained in:
yangdx 2025-09-23 21:58:33 +08:00
parent 7a66c009ed
commit 9dd1790b5c
3 changed files with 46 additions and 48 deletions

View file

@ -125,7 +125,7 @@ ENABLE_LLM_CACHE_FOR_EXTRACT=true
SUMMARY_LANGUAGE=English SUMMARY_LANGUAGE=English
### Entity types that the LLM will attempt to recognize ### Entity types that the LLM will attempt to recognize
# ENTITY_TYPES='["Person", "Organization", "Location", "Event", "Concept", "Method", "Content", "Data", "Artifact", "NaturalObject"]' # ENTITY_TYPES='["Person", "Creature", "Organization", "Location", "Event", "Concept", "Method", "Content", "Data", "Artifact", "NaturalObject"]'
### Chunk size for document splitting, 500~1500 is recommended ### Chunk size for document splitting, 500~1500 is recommended
# CHUNK_SIZE=1200 # CHUNK_SIZE=1200

View file

@ -25,6 +25,7 @@ DEFAULT_SUMMARY_CONTEXT_SIZE = 12000
# Default entities to extract if ENTITY_TYPES is not specified in .env # Default entities to extract if ENTITY_TYPES is not specified in .env
DEFAULT_ENTITY_TYPES = [ DEFAULT_ENTITY_TYPES = [
"Person", "Person",
"Creature",
"Organization", "Organization",
"Location", "Location",
"Event", "Event",

View file

@ -39,14 +39,22 @@ const TYPE_SYNONYMS: Record<string, string> = {
'过程': 'method', '过程': 'method',
'artifact': 'artifact', 'artifact': 'artifact',
'technology': 'technology',
'tech': 'technology',
'equipment': 'artifact', 'equipment': 'artifact',
'device': 'artifact', 'device': 'artifact',
'stuff': 'artifact', 'stuff': 'artifact',
'weapon': 'artifact',
'arms': 'artifact',
'人工制品': 'artifact', '人工制品': 'artifact',
'人造物品': 'artifact', '人造物品': 'artifact',
'技术': 'technology',
'科技': 'technology',
'设备': 'artifact', '设备': 'artifact',
'装备': 'artifact', '装备': 'artifact',
'物品': 'artifact', '物品': 'artifact',
'武器': 'artifact',
'军火': 'artifact',
'naturalobject': 'naturalobject', 'naturalobject': 'naturalobject',
'natural': 'naturalobject', 'natural': 'naturalobject',
@ -86,71 +94,60 @@ const TYPE_SYNONYMS: Record<string, string> = {
'人物': 'person', '人物': 'person',
'人': 'person', '人': 'person',
'animal': 'animal', 'creature': 'creature',
'动物': 'animal', 'animal': 'creature',
'creature': 'animal', 'beings': 'creature',
'生物': 'animal', 'being': 'creature',
'alien': 'creature',
'geo': 'geo', 'ghost': 'creature',
'地理': 'geo', '动物': 'creature',
'geography': 'geo', '生物': 'creature',
'地域': 'geo', '神仙': 'creature',
'鬼怪': 'creature',
'妖怪': 'creature',
'location': 'location', 'location': 'location',
'地点': 'location', 'geography': 'location',
'geo': 'location',
'place': 'location', 'place': 'location',
'address': 'location', 'address': 'location',
'地点': 'location',
'位置': 'location', '位置': 'location',
'地址': 'location', '地址': 'location',
'地理': 'location',
'technology': 'technology', '地域': 'location',
'技术': 'technology',
'tech': 'technology',
'科技': 'technology',
'weapon': 'weapon',
'武器': 'weapon',
'arms': 'weapon',
'军火': 'weapon',
'group': 'group',
'群组': 'group',
'community': 'group',
'社区': 'group'
}; };
// node type to color mapping // node type to color mapping
const NODE_TYPE_COLORS: Record<string, string> = { const NODE_TYPE_COLORS: Record<string, string> = {
'unknown': '#b0b0b0', // Yellow
'other': '#f4d371', // Yellow
'concept': '#e3493b', // GoogleRed
'group': '#ec407a', // red
'method': '#b71c1c', // red
'organization': '#0f705d', // Green
'event': '#00bfa0', // Turquoise
'person': '#4169E1', // RoyalBlue 'person': '#4169E1', // RoyalBlue
'animal': '#84a3e1', // SkyBlue 'creature': '#bd7ebe', // LightViolet
'geo': '#ff99cc', // Pale Pink 'organization': '#00cc00', // LightGreen
'location': '#cf6d17', // Carrot 'location': '#cf6d17', // Carrot
'data': '#b300b3', // Purple 'event': '#00bfa0', // Turquoise
'technology': '#2F4F4F', // DarkSlateGray 'concept': '#e3493b', // GoogleRed
'content': '#4421af', // DeepPurple 'method': '#b71c1c', // red
'naturalobject': '#00cc00', // Green 'content': '#0f558a', // NavyBlue
'artifact': '#0f558a', // NavyBlue 'data': '#0000ff', // Blue
'artifact': '#4421af', // DeepPurple
'naturalobject': '#b2e061', // YellowGreen
'other': '#f4d371', // Yellow
'unknown': '#b0b0b0', // Yellow
}; };
// Extended colors pool - Used for unknown node types // Extended colors pool - Used for unknown node types
const EXTENDED_COLORS = [ const EXTENDED_COLORS = [
'#84a3e1', // SkyBlue
'#5a2c6d', // DeepViolet '#5a2c6d', // DeepViolet
'#0000ff', // Blue '#2F4F4F', // DarkSlateGray
'#cd071e', // ChinaRed
'#00CED1', // DarkTurquoise
'#9b3a31', // DarkBrown
'#b2e061', // YellowGreen
'#bd7ebe', // LightViolet
'#6ef7b3', // LightGreen
'#003366', // DarkBlue '#003366', // DarkBlue
'#DEB887', // BurlyWood '#9b3a31', // DarkBrown
'#00CED1', // DarkTurquoise
'#b300b3', // Purple
'#0f705d', // Green
'#ff99cc', // Pale Pink
'#6ef7b3', // LightGreen
'#cd071e', // ChinaRed
]; ];
// Select color based on node type // Select color based on node type