knowledge graph entity fixes

This commit is contained in:
Storme-bit
2026-04-27 03:41:56 -07:00
parent 1a97b19280
commit c9cbac87ac
3 changed files with 14 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ const EXTRACTION_URL = getEnv('EXTRACTION_URL', 'http://localhost:11434');
const EXTRACTION_MODEL = getEnv('EXTRACTION_MODEL', 'qwen2.5:3b'); // ChatML format — see buildExtractionPrompt
const EMBEDDING_SERVICE_URL = getEnv('EMBEDDING_SERVICE_URL', SERVICES.EMBEDDING_URL);
const ENTITY_TYPES = ['person', 'place', 'project', 'technology', 'concept', 'organization'];
const ENTITY_TYPES = ENTITIES.TYPES;
const IGNORED_NAMES = ['good morning', 'good night', 'hello', 'goodbye', 'thanks', 'thank you'];
// NOTE: This prompt uses ChatML format (<|im_start|> / <|im_end|> tags), which is

View File

@@ -7,8 +7,8 @@ const { parseRow } = require ('@nexusai/shared')
function upsertEntity(name, type, notes = null, metadata = null, source = 'extraction') {
const db = getDB();
const stmt = db.prepare(`
INSERT INTO entities (name, type, notes, metadata, source)
VALUES (?, ?, ?, ?, ?)
INSERT INTO entities (name, type, notes, metadata, source, last_seen_at)
VALUES (?, ?, ?, ?, ?, unixepoch())
ON CONFLICT(name, type) DO UPDATE SET
-- First extraction wins: notes are never overwritten once set.
-- Revisit during Memory Consolidation Lifecycle (Phase 2) — once entity

View File

@@ -83,6 +83,17 @@ const ENTITIES = {
THRESHOLD: 0.55, // Minimum confidence score for an extracted entity to be included in the results
PROMOTION_THRESHOLD: 3, // mention_count threshold before entity is considered well-established
GRAPH_HOP_DEPTH: 1, // Default traversal depth for neighborhood queries
TYPES: [
'person',
'place',
'project',
'technology',
'concept',
'organization',
'character',
'event',
'topic'
],
}
module.exports = {