trivial turn patch

This commit is contained in:
Storme-bit
2026-08-17 06:23:00 -07:00
parent 7e8aead917
commit ff1c0ab215
5 changed files with 119 additions and 19 deletions
+11 -3
View File
@@ -1,5 +1,5 @@
const {getDB} = require('../db');
const { EPISODIC, getEnv, SERVICES, parseRow, formatEpisodeText, SUMMARIES, logger } = require('@nexusai/shared');
const { EPISODIC, getEnv, SERVICES, parseRow, formatEpisodeText, SUMMARIES, logger, isTrivialTurn } = require('@nexusai/shared');
const semantic = require('../semantic');
const { extractAndStoreEntities } = require('../entities/extraction')
@@ -162,8 +162,16 @@ async function createEpisode(sessionId, userMessage, aiResponse, tokenCount = nu
}))
.catch(err => logger.error(`Failed to embed episode ${episode.id}:`, err.message));
extractAndStoreEntities(userMessage, aiResponse, episode.id, projectId)
.catch(err => logger.error(`Failed to extract entities for episode ${episode.id}:`, err.message));
// Skip entity extraction on contentless social turns (greetings, sign-offs).
// They carry nothing worth storing, and running extraction on them was a
// source of junk/confabulated entities. The informational content lives in
// substantive turns, which still extract normally.
if (isTrivialTurn(userMessage)) {
logger.debug(`[entities] Skipping extraction for episode ${episode.id} — trivial turn`);
} else {
extractAndStoreEntities(userMessage, aiResponse, episode.id, projectId)
.catch(err => logger.error(`Failed to extract entities for episode ${episode.id}:`, err.message));
}
return episode;