WIP - semantinc linking working with other fields

This commit is contained in:
Francisco Gaona
2026-04-12 10:48:37 +02:00
parent 385a842ab8
commit 3f9be316ce
2 changed files with 6 additions and 11 deletions

View File

@@ -53,14 +53,10 @@ export class DefaultSemanticProjectionAdapter implements SemanticProjectionAdapt
input.record?.subject ||
`${input.objectApiName} ${input.record?.id || ''}`.trim();
/*
const fieldNarrative = fieldEntries
.map(([key, value]) => `${key}: ${String(value)}`)
.join('\n');
*/
const fieldNarrative = fieldEntries
.map(([key, value]) => `${String(value)}`)
.join('\n');
const commentNarrative = (input.comments || [])
.map((comment, index) => `Comment ${index + 1}: ${comment.content}`)
@@ -68,9 +64,10 @@ export class DefaultSemanticProjectionAdapter implements SemanticProjectionAdapt
const narrative = [fieldNarrative, commentNarrative].filter(Boolean).join('\n\n');
// Temporary: use only the name field for embedding to test pure semantic matching.
// Widen this back to all field values once semantic results are validated.
const embeddingNarrative = String(input.record?.name || title);
// Plain values only — no 'key:' prefixes. Comments are handled separately by the chunker.
const embeddingNarrative = fieldEntries
.map(([, value]) => String(value))
.join('\n');
return {
entityType: input.objectApiName,

View File

@@ -72,9 +72,7 @@ export class SemanticOrchestratorService {
});
const documentId = await this.upsertSemanticDocument(knex, projection);
// Temporary: pass empty comments so only embeddingNarrative (name field) is indexed.
// Re-enable by replacing [] with `comments` once semantic matching is validated.
const chunks = this.chunkerService.chunkText(projection.embeddingNarrative, []);
const chunks = this.chunkerService.chunkText(projection.embeddingNarrative, comments);
this.logger.log(
`Semantic refresh chunking: ${objectApiName}:${recordId} chunks=${chunks.length}`,
);