@absolutejs/absolute 0.19.0-beta.604 → 0.19.0-beta.606
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/ai/client/index.js +238 -6
- package/dist/ai/client/index.js.map +4 -4
- package/dist/ai/client/ui.js +242 -6
- package/dist/ai/client/ui.js.map +4 -4
- package/dist/ai/index.js +381 -38
- package/dist/ai/index.js.map +7 -7
- package/dist/ai/rag/quality.js +17 -6
- package/dist/ai/rag/quality.js.map +3 -3
- package/dist/ai/rag/ui.js +242 -6
- package/dist/ai/rag/ui.js.map +4 -4
- package/dist/ai-client/angular/ai/index.js +237 -5
- package/dist/ai-client/react/ai/index.js +281 -12
- package/dist/ai-client/vue/ai/index.js +364 -97
- package/dist/angular/ai/index.js +238 -6
- package/dist/angular/ai/index.js.map +4 -4
- package/dist/angular/index.js +2 -2
- package/dist/angular/index.js.map +1 -1
- package/dist/angular/server.js +2 -2
- package/dist/angular/server.js.map +1 -1
- package/dist/build.js +2 -2
- package/dist/build.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/react/ai/index.js +282 -13
- package/dist/react/ai/index.js.map +6 -6
- package/dist/src/ai/client/ui.d.ts +1 -1
- package/dist/src/ai/rag/index.d.ts +1 -1
- package/dist/src/ai/rag/presentation.d.ts +7 -1
- package/dist/src/ai/rag/ui.d.ts +1 -1
- package/dist/src/react/ai/useRAG.d.ts +9 -0
- package/dist/src/react/ai/useRAGChunkPreview.d.ts +7 -0
- package/dist/src/react/ai/useRAGSources.d.ts +2 -0
- package/dist/src/svelte/ai/createRAG.d.ts +9 -0
- package/dist/src/svelte/ai/createRAGChunkPreview.d.ts +7 -0
- package/dist/src/svelte/ai/createRAGSources.d.ts +2 -0
- package/dist/src/vue/ai/useRAG.d.ts +69 -0
- package/dist/src/vue/ai/useRAGChunkPreview.d.ts +37 -0
- package/dist/src/vue/ai/useRAGSearch.d.ts +30 -0
- package/dist/src/vue/ai/useRAGSources.d.ts +2 -0
- package/dist/svelte/ai/index.js +334 -53
- package/dist/svelte/ai/index.js.map +6 -6
- package/dist/types/ai.d.ts +66 -0
- package/dist/vue/ai/index.js +328 -59
- package/dist/vue/ai/index.js.map +6 -6
- package/package.json +1 -1
|
@@ -765,6 +765,11 @@ var buildContextLabel = (metadata) => {
|
|
|
765
765
|
if (speaker) {
|
|
766
766
|
return `Speaker ${speaker}`;
|
|
767
767
|
}
|
|
768
|
+
const sectionPath = Array.isArray(metadata.sectionPath) ? metadata.sectionPath.map((value) => getContextString(value)).filter((value) => typeof value === "string") : [];
|
|
769
|
+
const sectionTitle = getContextString(metadata.sectionTitle) ?? sectionPath.at(-1);
|
|
770
|
+
if (sectionTitle) {
|
|
771
|
+
return `Section ${sectionTitle}`;
|
|
772
|
+
}
|
|
768
773
|
return;
|
|
769
774
|
};
|
|
770
775
|
var formatMediaTimestamp = (value) => {
|
|
@@ -814,6 +819,10 @@ var buildLocatorLabel = (metadata, source, title) => {
|
|
|
814
819
|
if (mediaStart) {
|
|
815
820
|
return `Timestamp ${mediaStart}`;
|
|
816
821
|
}
|
|
822
|
+
const sectionPath = Array.isArray(metadata.sectionPath) ? metadata.sectionPath.map((value) => getContextString(value)).filter((value) => typeof value === "string") : [];
|
|
823
|
+
if (sectionPath.length > 0) {
|
|
824
|
+
return `Section ${sectionPath.join(" > ")}`;
|
|
825
|
+
}
|
|
817
826
|
return;
|
|
818
827
|
};
|
|
819
828
|
var formatTimestampLabel = (value) => {
|
|
@@ -863,8 +872,10 @@ var buildExcerpt = (text, maxLength = 160) => {
|
|
|
863
872
|
var buildGroundingReferenceEvidenceLabel = (reference) => [reference.label, reference.locatorLabel, reference.contextLabel].filter((value) => Boolean(value && value.length > 0)).filter((value, index, values) => values.findIndex((entry) => entry === value) === index).join(" · ");
|
|
864
873
|
var buildGroundingReferenceEvidenceSummary = (reference) => [
|
|
865
874
|
reference.source ?? reference.title ?? reference.chunkId,
|
|
875
|
+
reference.locatorLabel,
|
|
876
|
+
reference.contextLabel,
|
|
866
877
|
reference.provenanceLabel
|
|
867
|
-
].filter((value) => Boolean(value && value.length > 0)).join(" · ");
|
|
878
|
+
].filter((value) => Boolean(value && value.length > 0)).filter((value, index, values) => values.findIndex((entry) => entry === value) === index).join(" · ");
|
|
868
879
|
var buildGroundedAnswerCitationDetail = (reference) => ({
|
|
869
880
|
contextLabel: reference.contextLabel,
|
|
870
881
|
evidenceLabel: buildGroundingReferenceEvidenceLabel(reference),
|
|
@@ -888,12 +899,12 @@ var buildRAGCitations = (sources) => {
|
|
|
888
899
|
continue;
|
|
889
900
|
unique.set(key, {
|
|
890
901
|
chunkId: source.chunkId,
|
|
891
|
-
contextLabel: buildContextLabel(source.metadata),
|
|
902
|
+
contextLabel: source.labels?.contextLabel ?? buildContextLabel(source.metadata),
|
|
892
903
|
key,
|
|
893
904
|
label: buildSourceLabel(source),
|
|
894
|
-
locatorLabel: buildLocatorLabel(source.metadata, source.source, source.title),
|
|
905
|
+
locatorLabel: source.labels?.locatorLabel ?? buildLocatorLabel(source.metadata, source.source, source.title),
|
|
895
906
|
metadata: source.metadata,
|
|
896
|
-
provenanceLabel: buildProvenanceLabel(source.metadata),
|
|
907
|
+
provenanceLabel: source.labels?.provenanceLabel ?? buildProvenanceLabel(source.metadata),
|
|
897
908
|
score: source.score,
|
|
898
909
|
source: source.source,
|
|
899
910
|
text: source.text,
|
|
@@ -963,7 +974,7 @@ var buildRAGGroundingReferences = (sources) => {
|
|
|
963
974
|
const citationReferenceMap = buildRAGCitationReferenceMap(citations);
|
|
964
975
|
return citations.map((citation) => ({
|
|
965
976
|
chunkId: citation.chunkId,
|
|
966
|
-
contextLabel: buildContextLabel(citation.metadata),
|
|
977
|
+
contextLabel: citation.contextLabel ?? buildContextLabel(citation.metadata),
|
|
967
978
|
excerpt: buildExcerpt(citation.text),
|
|
968
979
|
label: citation.label,
|
|
969
980
|
locatorLabel: citation.locatorLabel ?? buildLocatorLabel(citation.metadata, citation.source, citation.title),
|
|
@@ -1060,6 +1071,11 @@ var buildContextLabel2 = (metadata) => {
|
|
|
1060
1071
|
if (speaker) {
|
|
1061
1072
|
return `Speaker ${speaker}`;
|
|
1062
1073
|
}
|
|
1074
|
+
const sectionPath = Array.isArray(metadata.sectionPath) ? metadata.sectionPath.map((value) => getContextString2(value)).filter((value) => typeof value === "string") : [];
|
|
1075
|
+
const sectionTitle = getContextString2(metadata.sectionTitle) ?? sectionPath.at(-1);
|
|
1076
|
+
if (sectionTitle) {
|
|
1077
|
+
return `Section ${sectionTitle}`;
|
|
1078
|
+
}
|
|
1063
1079
|
return;
|
|
1064
1080
|
};
|
|
1065
1081
|
var buildLocatorLabel2 = (metadata, source, title) => {
|
|
@@ -1099,6 +1115,10 @@ var buildLocatorLabel2 = (metadata, source, title) => {
|
|
|
1099
1115
|
if (mediaStart) {
|
|
1100
1116
|
return `Timestamp ${mediaStart}`;
|
|
1101
1117
|
}
|
|
1118
|
+
const sectionPath = Array.isArray(metadata.sectionPath) ? metadata.sectionPath.map((value) => getContextString2(value)).filter((value) => typeof value === "string") : [];
|
|
1119
|
+
if (sectionPath.length > 0) {
|
|
1120
|
+
return `Section ${sectionPath.join(" > ")}`;
|
|
1121
|
+
}
|
|
1102
1122
|
return;
|
|
1103
1123
|
};
|
|
1104
1124
|
var buildProvenanceLabel2 = (metadata) => {
|
|
@@ -1144,6 +1164,33 @@ var buildRAGSourceLabels = ({
|
|
|
1144
1164
|
provenanceLabel
|
|
1145
1165
|
};
|
|
1146
1166
|
};
|
|
1167
|
+
var buildRAGChunkStructure = (metadata) => {
|
|
1168
|
+
if (!metadata) {
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
const sectionPath = Array.isArray(metadata.sectionPath) ? metadata.sectionPath.filter((value) => typeof value === "string" && value.trim().length > 0) : undefined;
|
|
1172
|
+
const sectionKind = metadata.sectionKind === "markdown_heading" || metadata.sectionKind === "html_heading" ? metadata.sectionKind : undefined;
|
|
1173
|
+
const section = {
|
|
1174
|
+
depth: getContextNumber2(metadata.sectionDepth),
|
|
1175
|
+
kind: sectionKind,
|
|
1176
|
+
path: sectionPath && sectionPath.length > 0 ? sectionPath : undefined,
|
|
1177
|
+
title: getContextString2(metadata.sectionTitle)
|
|
1178
|
+
};
|
|
1179
|
+
const sequence = {
|
|
1180
|
+
nextChunkId: getContextString2(metadata.nextChunkId),
|
|
1181
|
+
previousChunkId: getContextString2(metadata.previousChunkId),
|
|
1182
|
+
sectionChunkCount: getContextNumber2(metadata.sectionChunkCount),
|
|
1183
|
+
sectionChunkId: getContextString2(metadata.sectionChunkId),
|
|
1184
|
+
sectionChunkIndex: getContextNumber2(metadata.sectionChunkIndex)
|
|
1185
|
+
};
|
|
1186
|
+
if (!section.title && (!section.path || section.path.length === 0) && typeof section.depth !== "number" && !section.kind && !sequence.nextChunkId && !sequence.previousChunkId && typeof sequence.sectionChunkCount !== "number" && !sequence.sectionChunkId && typeof sequence.sectionChunkIndex !== "number") {
|
|
1187
|
+
return;
|
|
1188
|
+
}
|
|
1189
|
+
return {
|
|
1190
|
+
section: section.title || section.path && section.path.length > 0 || typeof section.depth === "number" || section.kind ? section : undefined,
|
|
1191
|
+
sequence: sequence.nextChunkId || sequence.previousChunkId || typeof sequence.sectionChunkCount === "number" || sequence.sectionChunkId || typeof sequence.sectionChunkIndex === "number" ? sequence : undefined
|
|
1192
|
+
};
|
|
1193
|
+
};
|
|
1147
1194
|
var buildExcerpt2 = (text, maxLength = 160) => {
|
|
1148
1195
|
const normalized = text.replaceAll(/\s+/g, " ").trim();
|
|
1149
1196
|
if (normalized.length <= maxLength) {
|
|
@@ -1151,6 +1198,188 @@ var buildExcerpt2 = (text, maxLength = 160) => {
|
|
|
1151
1198
|
}
|
|
1152
1199
|
return `${normalized.slice(0, Math.max(0, maxLength - 1)).trimEnd()}…`;
|
|
1153
1200
|
};
|
|
1201
|
+
var buildRAGChunkGraph = (chunks) => {
|
|
1202
|
+
const nodes = [];
|
|
1203
|
+
const edges = [];
|
|
1204
|
+
const edgeKeys = new Set;
|
|
1205
|
+
const sections = new Map;
|
|
1206
|
+
for (const chunk of chunks) {
|
|
1207
|
+
const labels = chunk.labels ?? buildRAGSourceLabels({
|
|
1208
|
+
metadata: chunk.metadata,
|
|
1209
|
+
source: chunk.source,
|
|
1210
|
+
title: chunk.title
|
|
1211
|
+
});
|
|
1212
|
+
const structure = chunk.structure ?? buildRAGChunkStructure(chunk.metadata);
|
|
1213
|
+
nodes.push({
|
|
1214
|
+
chunkId: chunk.chunkId,
|
|
1215
|
+
contextLabel: labels?.contextLabel,
|
|
1216
|
+
label: chunk.source ?? chunk.title ?? chunk.chunkId,
|
|
1217
|
+
locatorLabel: labels?.locatorLabel,
|
|
1218
|
+
provenanceLabel: labels?.provenanceLabel,
|
|
1219
|
+
score: chunk.score,
|
|
1220
|
+
source: chunk.source,
|
|
1221
|
+
structure,
|
|
1222
|
+
title: chunk.title
|
|
1223
|
+
});
|
|
1224
|
+
const previousChunkId = structure?.sequence?.previousChunkId;
|
|
1225
|
+
if (previousChunkId) {
|
|
1226
|
+
const key = `previous:${previousChunkId}:${chunk.chunkId}`;
|
|
1227
|
+
if (!edgeKeys.has(key)) {
|
|
1228
|
+
edgeKeys.add(key);
|
|
1229
|
+
edges.push({
|
|
1230
|
+
fromChunkId: previousChunkId,
|
|
1231
|
+
relation: "previous",
|
|
1232
|
+
toChunkId: chunk.chunkId
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
const nextChunkId = structure?.sequence?.nextChunkId;
|
|
1237
|
+
if (nextChunkId) {
|
|
1238
|
+
const key = `next:${chunk.chunkId}:${nextChunkId}`;
|
|
1239
|
+
if (!edgeKeys.has(key)) {
|
|
1240
|
+
edgeKeys.add(key);
|
|
1241
|
+
edges.push({
|
|
1242
|
+
fromChunkId: chunk.chunkId,
|
|
1243
|
+
relation: "next",
|
|
1244
|
+
toChunkId: nextChunkId
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
const sectionId = structure?.sequence?.sectionChunkId;
|
|
1249
|
+
if (sectionId) {
|
|
1250
|
+
const existing = sections.get(sectionId);
|
|
1251
|
+
if (!existing) {
|
|
1252
|
+
sections.set(sectionId, {
|
|
1253
|
+
childSectionIds: [],
|
|
1254
|
+
chunkCount: structure.sequence?.sectionChunkCount ?? 1,
|
|
1255
|
+
chunkIds: [chunk.chunkId],
|
|
1256
|
+
depth: structure.section?.depth,
|
|
1257
|
+
id: sectionId,
|
|
1258
|
+
kind: structure.section?.kind,
|
|
1259
|
+
leadChunkId: chunk.chunkId,
|
|
1260
|
+
path: structure.section?.path,
|
|
1261
|
+
title: structure.section?.title
|
|
1262
|
+
});
|
|
1263
|
+
continue;
|
|
1264
|
+
}
|
|
1265
|
+
if (!existing.chunkIds.includes(chunk.chunkId)) {
|
|
1266
|
+
existing.chunkIds.push(chunk.chunkId);
|
|
1267
|
+
}
|
|
1268
|
+
existing.chunkCount = Math.max(existing.chunkCount, structure.sequence?.sectionChunkCount ?? existing.chunkCount);
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
for (const section of sections.values()) {
|
|
1272
|
+
section.chunkIds.sort((left, right) => {
|
|
1273
|
+
const leftNode = nodes.find((node) => node.chunkId === left);
|
|
1274
|
+
const rightNode = nodes.find((node) => node.chunkId === right);
|
|
1275
|
+
const leftIndex = leftNode?.structure?.sequence?.sectionChunkIndex ?? Number.MAX_SAFE_INTEGER;
|
|
1276
|
+
const rightIndex = rightNode?.structure?.sequence?.sectionChunkIndex ?? Number.MAX_SAFE_INTEGER;
|
|
1277
|
+
if (leftIndex !== rightIndex) {
|
|
1278
|
+
return leftIndex - rightIndex;
|
|
1279
|
+
}
|
|
1280
|
+
return left.localeCompare(right);
|
|
1281
|
+
});
|
|
1282
|
+
section.leadChunkId = section.chunkIds[0];
|
|
1283
|
+
}
|
|
1284
|
+
const sectionPathIndex = new Map;
|
|
1285
|
+
for (const section of sections.values()) {
|
|
1286
|
+
const path = section.path && section.path.length > 0 ? section.path : section.title ? [section.title] : undefined;
|
|
1287
|
+
if (path && path.length > 0) {
|
|
1288
|
+
sectionPathIndex.set(path.join("\x00"), section);
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
for (const section of sections.values()) {
|
|
1292
|
+
const path = section.path && section.path.length > 0 ? section.path : section.title ? [section.title] : undefined;
|
|
1293
|
+
if (!path || path.length < 2) {
|
|
1294
|
+
continue;
|
|
1295
|
+
}
|
|
1296
|
+
const parent = sectionPathIndex.get(path.slice(0, -1).join("\x00"));
|
|
1297
|
+
if (!parent || parent.id === section.id) {
|
|
1298
|
+
continue;
|
|
1299
|
+
}
|
|
1300
|
+
section.parentSectionId = parent.id;
|
|
1301
|
+
if (!parent.childSectionIds.includes(section.id)) {
|
|
1302
|
+
parent.childSectionIds.push(section.id);
|
|
1303
|
+
}
|
|
1304
|
+
if (parent.leadChunkId && section.leadChunkId) {
|
|
1305
|
+
const parentKey = `section_parent:${section.leadChunkId}:${parent.leadChunkId}`;
|
|
1306
|
+
if (!edgeKeys.has(parentKey)) {
|
|
1307
|
+
edgeKeys.add(parentKey);
|
|
1308
|
+
edges.push({
|
|
1309
|
+
fromChunkId: section.leadChunkId,
|
|
1310
|
+
relation: "section_parent",
|
|
1311
|
+
toChunkId: parent.leadChunkId
|
|
1312
|
+
});
|
|
1313
|
+
}
|
|
1314
|
+
const childKey = `section_child:${parent.leadChunkId}:${section.leadChunkId}`;
|
|
1315
|
+
if (!edgeKeys.has(childKey)) {
|
|
1316
|
+
edgeKeys.add(childKey);
|
|
1317
|
+
edges.push({
|
|
1318
|
+
fromChunkId: parent.leadChunkId,
|
|
1319
|
+
relation: "section_child",
|
|
1320
|
+
toChunkId: section.leadChunkId
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
nodes.sort((left, right) => {
|
|
1326
|
+
const leftSection = left.structure?.sequence?.sectionChunkIndex ?? Number.MAX_SAFE_INTEGER;
|
|
1327
|
+
const rightSection = right.structure?.sequence?.sectionChunkIndex ?? Number.MAX_SAFE_INTEGER;
|
|
1328
|
+
if (leftSection !== rightSection) {
|
|
1329
|
+
return leftSection - rightSection;
|
|
1330
|
+
}
|
|
1331
|
+
const leftScore = left.score ?? Number.NEGATIVE_INFINITY;
|
|
1332
|
+
const rightScore = right.score ?? Number.NEGATIVE_INFINITY;
|
|
1333
|
+
if (leftScore !== rightScore) {
|
|
1334
|
+
return rightScore - leftScore;
|
|
1335
|
+
}
|
|
1336
|
+
return left.label.localeCompare(right.label);
|
|
1337
|
+
});
|
|
1338
|
+
return {
|
|
1339
|
+
edges,
|
|
1340
|
+
nodes,
|
|
1341
|
+
sections: [...sections.values()].sort((left, right) => (left.title ?? left.id).localeCompare(right.title ?? right.id))
|
|
1342
|
+
};
|
|
1343
|
+
};
|
|
1344
|
+
var buildRAGChunkPreviewGraph = (preview) => buildRAGChunkGraph(preview.chunks.map((chunk) => ({
|
|
1345
|
+
chunkId: chunk.chunkId,
|
|
1346
|
+
labels: chunk.labels,
|
|
1347
|
+
metadata: chunk.metadata,
|
|
1348
|
+
source: chunk.source ?? preview.document.source,
|
|
1349
|
+
structure: chunk.structure,
|
|
1350
|
+
title: chunk.title ?? preview.document.title
|
|
1351
|
+
})));
|
|
1352
|
+
var buildRAGChunkPreviewNavigation = (preview, activeChunkId) => buildRAGChunkGraphNavigation(buildRAGChunkPreviewGraph(preview), activeChunkId);
|
|
1353
|
+
var buildRAGChunkGraphNavigation = (graph, activeChunkId) => {
|
|
1354
|
+
if (graph.nodes.length === 0) {
|
|
1355
|
+
return {
|
|
1356
|
+
activeChunkId,
|
|
1357
|
+
childSections: [],
|
|
1358
|
+
siblingSections: [],
|
|
1359
|
+
sectionNodes: []
|
|
1360
|
+
};
|
|
1361
|
+
}
|
|
1362
|
+
const activeNode = (activeChunkId ? graph.nodes.find((node) => node.chunkId === activeChunkId) : undefined) ?? graph.nodes[0];
|
|
1363
|
+
const resolvedActiveChunkId = activeNode?.chunkId;
|
|
1364
|
+
const previousNode = activeNode?.structure?.sequence?.previousChunkId ? graph.nodes.find((node) => node.chunkId === activeNode.structure?.sequence?.previousChunkId) : undefined;
|
|
1365
|
+
const nextNode = activeNode?.structure?.sequence?.nextChunkId ? graph.nodes.find((node) => node.chunkId === activeNode.structure?.sequence?.nextChunkId) : undefined;
|
|
1366
|
+
const section = activeNode?.structure?.sequence?.sectionChunkId ? graph.sections.find((entry) => entry.id === activeNode.structure?.sequence?.sectionChunkId) : undefined;
|
|
1367
|
+
const parentSection = section?.parentSectionId ? graph.sections.find((entry) => entry.id === section.parentSectionId) : undefined;
|
|
1368
|
+
const childSections = section ? section.childSectionIds.map((sectionId) => graph.sections.find((entry) => entry.id === sectionId)).filter((entry) => Boolean(entry)) : [];
|
|
1369
|
+
const siblingSections = section?.parentSectionId ? graph.sections.filter((entry) => entry.parentSectionId === section.parentSectionId && entry.id !== section.id) : [];
|
|
1370
|
+
const sectionNodes = section ? section.chunkIds.map((chunkId) => graph.nodes.find((node) => node.chunkId === chunkId)).filter((node) => Boolean(node)) : activeNode ? [activeNode] : [];
|
|
1371
|
+
return {
|
|
1372
|
+
activeChunkId: resolvedActiveChunkId,
|
|
1373
|
+
activeNode,
|
|
1374
|
+
childSections,
|
|
1375
|
+
nextNode,
|
|
1376
|
+
parentSection,
|
|
1377
|
+
previousNode,
|
|
1378
|
+
section,
|
|
1379
|
+
siblingSections,
|
|
1380
|
+
sectionNodes
|
|
1381
|
+
};
|
|
1382
|
+
};
|
|
1154
1383
|
var buildRAGRetrievedState = (messages) => {
|
|
1155
1384
|
const message = getLatestRetrievedMessage(messages);
|
|
1156
1385
|
if (!message) {
|
|
@@ -1192,6 +1421,7 @@ var buildRAGSourceSummaries = (sources) => {
|
|
|
1192
1421
|
label: group.label,
|
|
1193
1422
|
locatorLabel: leadChunk?.labels?.locatorLabel ?? buildLocatorLabel2(leadChunk?.metadata, leadChunk?.source, leadChunk?.title),
|
|
1194
1423
|
provenanceLabel: leadChunk?.labels?.provenanceLabel ?? buildProvenanceLabel2(leadChunk?.metadata),
|
|
1424
|
+
structure: leadChunk?.structure ?? buildRAGChunkStructure(leadChunk?.metadata),
|
|
1195
1425
|
source: group.source,
|
|
1196
1426
|
title: group.title
|
|
1197
1427
|
};
|
|
@@ -1320,6 +1550,7 @@ var buildSourceGroup = (source, key) => ({
|
|
|
1320
1550
|
source: source.source,
|
|
1321
1551
|
title: source.title
|
|
1322
1552
|
}),
|
|
1553
|
+
structure: source.structure ?? buildRAGChunkStructure(source.metadata),
|
|
1323
1554
|
source: source.source,
|
|
1324
1555
|
title: source.title
|
|
1325
1556
|
});
|
|
@@ -1338,6 +1569,7 @@ var updateSourceGroup = (groups, source) => {
|
|
|
1338
1569
|
source: source.source,
|
|
1339
1570
|
title: source.title
|
|
1340
1571
|
});
|
|
1572
|
+
existing.structure = source.structure ?? buildRAGChunkStructure(source.metadata);
|
|
1341
1573
|
existing.source = source.source;
|
|
1342
1574
|
existing.title = source.title;
|
|
1343
1575
|
} else {
|