refinement fixes
This commit is contained in:
@@ -7,6 +7,7 @@ const EXTRACTION_MODEL = getEnv('EXTRACTION_MODEL', 'qwen2.5:3b'); // ChatML for
|
||||
const EMBEDDING_SERVICE_URL = getEnv('EMBEDDING_SERVICE_URL', SERVICES.EMBEDDING_URL);
|
||||
|
||||
const ENTITY_TYPES = ENTITIES.TYPES;
|
||||
|
||||
const IGNORED_NAMES = new Set([
|
||||
'good morning', 'good night', 'good evening', 'good afternoon',
|
||||
'hello', 'hi', 'hey', 'goodbye', 'bye', 'thanks', 'thank you', 'morning',
|
||||
@@ -39,7 +40,6 @@ function buildExtractionPrompt(userMessage, aiResponse, knownEntities = []) {
|
||||
`Entity types: ${ENTITY_TYPES.join(', ')}`,
|
||||
'Use "character" for any fictional, game, or media characters (e.g. characters from anime, games, books, TV shows, movies)',
|
||||
'Use "person" only for real people',
|
||||
'Do not extract greetings, pleasantries, or conversational filler (e.g. "good morning", "thanks") as entities.',
|
||||
'For each entity provide:',
|
||||
' "name": short proper noun only (max 4 words)',
|
||||
' "type": one of the valid types',
|
||||
@@ -131,7 +131,7 @@ async function extractAndStoreEntities(userMessage, aiResponse, episodeId=null,
|
||||
|
||||
for (const { name, type, notes } of entities) {
|
||||
if (!name || !type || !ENTITY_TYPES.includes(type)) continue;
|
||||
if (IGNORED_NAMES.includes(name.toLowerCase())) continue;
|
||||
if (isIgnoredName(name)) continue;
|
||||
|
||||
const entity = upsertEntity(name, type, notes ?? null);
|
||||
entityMap.set(`${name}::${type}`, entity);
|
||||
|
||||
@@ -108,7 +108,7 @@ async function deleteEntity(id) {
|
||||
//Filter-based,
|
||||
async function deleteEpisodesBySession(sessionId) {
|
||||
const client = getClient();
|
||||
await client.delete(CoLLECTIONS.EPISODES, {
|
||||
await client.delete(COLLECTIONS.EPISODES, {
|
||||
wait: true,
|
||||
filter: {
|
||||
must: [{ key: 'sessionId', match: { value: sessionId } }]
|
||||
|
||||
Reference in New Issue
Block a user