@equationalapplications/core-llm-wiki 5.0.0 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/testing.js CHANGED
@@ -969,6 +969,10 @@ ${JSON.stringify(facts, null, 2)}`
969
969
  }
970
970
  };
971
971
 
972
+ // src/utils/chunkingDefaults.ts
973
+ var DEFAULT_MAX_CHUNK_LENGTH = 12e3;
974
+ var DEFAULT_CHUNK_OVERLAP = 400;
975
+
972
976
  // src/services/IngestionService.ts
973
977
  var IngestionService = class {
974
978
  constructor(db, prefix, options, entryRepo, searchService, jobManager, embeddingService, promptService, ontologyService) {
@@ -987,10 +991,10 @@ var IngestionService = class {
987
991
  if (!sourceRef) throw new Error("Invalid sourceRef");
988
992
  const sourceHash = normalizeSourceHash(params.sourceHash);
989
993
  if (!sourceHash) throw new Error("Invalid sourceHash (must be 64-char hex string)");
990
- const maxChunkLength = params.maxChunkLength ?? this.options.config?.maxChunkLength ?? 12e3;
991
- const rawOverlap = params.chunkOverlap ?? this.options.config?.chunkOverlap ?? 400;
994
+ const maxChunkLength = params.maxChunkLength ?? this.options.config?.maxChunkLength ?? DEFAULT_MAX_CHUNK_LENGTH;
995
+ const rawOverlap = params.chunkOverlap ?? this.options.config?.chunkOverlap ?? DEFAULT_CHUNK_OVERLAP;
992
996
  const chunkOverlap = Math.min(
993
- Number.isFinite(rawOverlap) && rawOverlap >= 0 ? Math.floor(rawOverlap) : 400,
997
+ Number.isFinite(rawOverlap) && rawOverlap >= 0 ? Math.floor(rawOverlap) : DEFAULT_CHUNK_OVERLAP,
994
998
  maxChunkLength - 1
995
999
  );
996
1000
  const rawConcurrency = params.chunkConcurrency ?? this.options.config?.chunkConcurrency ?? 1;
@@ -1725,10 +1729,10 @@ var MaintenanceService = class {
1725
1729
  const validNewFacts = newFacts.map(validateFact).filter((f) => f !== null);
1726
1730
  const insertedFacts = [];
1727
1731
  const uniqueDeletedFactIds = Array.from(new Set(safeDeleted));
1728
- const healFactsForDedupe = (await this.entryRepo.findInferredTitlesByEntityId(entityId)).filter((f) => !safeDeletedSet.has(f.id));
1729
1732
  await this.db.withTransactionAsync(async (tx) => {
1730
1733
  await this.entryRepo.downgradeByIds(safeDowngraded, entityId, tx);
1731
1734
  await this.entryRepo.softDeleteByIds(safeDeleted, entityId, tx);
1735
+ const healFactsForDedupe = await this.entryRepo.findInferredTitlesByEntityId(entityId, tx);
1732
1736
  for (const fact of validNewFacts) {
1733
1737
  const newTokens = titleTokens(fact.title);
1734
1738
  let skip = false;