@absolutejs/absolute 0.19.0-beta.605 → 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 +53 -1
- package/dist/ai/client/index.js.map +4 -4
- package/dist/ai/client/ui.js +53 -1
- package/dist/ai/client/ui.js.map +4 -4
- package/dist/ai/index.js +94 -4
- package/dist/ai/index.js.map +6 -6
- package/dist/ai/rag/quality.js.map +2 -2
- package/dist/ai/rag/ui.js +53 -1
- package/dist/ai/rag/ui.js.map +4 -4
- package/dist/ai-client/angular/ai/index.js +52 -0
- package/dist/ai-client/react/ai/index.js +82 -7
- package/dist/ai-client/vue/ai/index.js +76 -1
- package/dist/angular/ai/index.js +53 -1
- package/dist/angular/ai/index.js.map +4 -4
- package/dist/react/ai/index.js +83 -8
- package/dist/react/ai/index.js.map +6 -6
- package/dist/src/react/ai/useRAG.d.ts +4 -0
- package/dist/src/react/ai/useRAGChunkPreview.d.ts +3 -0
- package/dist/src/react/ai/useRAGSources.d.ts +1 -0
- package/dist/src/svelte/ai/createRAG.d.ts +4 -0
- package/dist/src/svelte/ai/createRAGChunkPreview.d.ts +3 -0
- package/dist/src/svelte/ai/createRAGSources.d.ts +1 -0
- package/dist/src/vue/ai/useRAG.d.ts +4 -0
- package/dist/src/vue/ai/useRAGChunkPreview.d.ts +3 -0
- package/dist/src/vue/ai/useRAGSources.d.ts +1 -0
- package/dist/svelte/ai/index.js +90 -3
- package/dist/svelte/ai/index.js.map +6 -6
- package/dist/types/ai.d.ts +7 -1
- package/dist/vue/ai/index.js +77 -2
- package/dist/vue/ai/index.js.map +6 -6
- package/package.json +1 -1
package/dist/types/ai.d.ts
CHANGED
|
@@ -453,7 +453,7 @@ export type RAGChunkGraphNode = {
|
|
|
453
453
|
export type RAGChunkGraphEdge = {
|
|
454
454
|
fromChunkId: string;
|
|
455
455
|
toChunkId: string;
|
|
456
|
-
relation: 'previous' | 'next';
|
|
456
|
+
relation: 'previous' | 'next' | 'section_parent' | 'section_child';
|
|
457
457
|
};
|
|
458
458
|
export type RAGChunkGraphSectionGroup = {
|
|
459
459
|
id: string;
|
|
@@ -463,6 +463,9 @@ export type RAGChunkGraphSectionGroup = {
|
|
|
463
463
|
kind?: 'markdown_heading' | 'html_heading';
|
|
464
464
|
chunkIds: string[];
|
|
465
465
|
chunkCount: number;
|
|
466
|
+
leadChunkId?: string;
|
|
467
|
+
parentSectionId?: string;
|
|
468
|
+
childSectionIds: string[];
|
|
466
469
|
};
|
|
467
470
|
export type RAGChunkGraph = {
|
|
468
471
|
nodes: RAGChunkGraphNode[];
|
|
@@ -475,6 +478,9 @@ export type RAGChunkGraphNavigation = {
|
|
|
475
478
|
previousNode?: RAGChunkGraphNode;
|
|
476
479
|
nextNode?: RAGChunkGraphNode;
|
|
477
480
|
section?: RAGChunkGraphSectionGroup;
|
|
481
|
+
parentSection?: RAGChunkGraphSectionGroup;
|
|
482
|
+
childSections: RAGChunkGraphSectionGroup[];
|
|
483
|
+
siblingSections: RAGChunkGraphSectionGroup[];
|
|
478
484
|
sectionNodes: RAGChunkGraphNode[];
|
|
479
485
|
};
|
|
480
486
|
export type RAGBackendDescriptor = {
|
package/dist/vue/ai/index.js
CHANGED
|
@@ -4204,11 +4204,13 @@ var buildRAGChunkGraph = (chunks) => {
|
|
|
4204
4204
|
const existing = sections.get(sectionId);
|
|
4205
4205
|
if (!existing) {
|
|
4206
4206
|
sections.set(sectionId, {
|
|
4207
|
+
childSectionIds: [],
|
|
4207
4208
|
chunkCount: structure.sequence?.sectionChunkCount ?? 1,
|
|
4208
4209
|
chunkIds: [chunk.chunkId],
|
|
4209
4210
|
depth: structure.section?.depth,
|
|
4210
4211
|
id: sectionId,
|
|
4211
4212
|
kind: structure.section?.kind,
|
|
4213
|
+
leadChunkId: chunk.chunkId,
|
|
4212
4214
|
path: structure.section?.path,
|
|
4213
4215
|
title: structure.section?.title
|
|
4214
4216
|
});
|
|
@@ -4231,6 +4233,48 @@ var buildRAGChunkGraph = (chunks) => {
|
|
|
4231
4233
|
}
|
|
4232
4234
|
return left.localeCompare(right);
|
|
4233
4235
|
});
|
|
4236
|
+
section.leadChunkId = section.chunkIds[0];
|
|
4237
|
+
}
|
|
4238
|
+
const sectionPathIndex = new Map;
|
|
4239
|
+
for (const section of sections.values()) {
|
|
4240
|
+
const path = section.path && section.path.length > 0 ? section.path : section.title ? [section.title] : undefined;
|
|
4241
|
+
if (path && path.length > 0) {
|
|
4242
|
+
sectionPathIndex.set(path.join("\x00"), section);
|
|
4243
|
+
}
|
|
4244
|
+
}
|
|
4245
|
+
for (const section of sections.values()) {
|
|
4246
|
+
const path = section.path && section.path.length > 0 ? section.path : section.title ? [section.title] : undefined;
|
|
4247
|
+
if (!path || path.length < 2) {
|
|
4248
|
+
continue;
|
|
4249
|
+
}
|
|
4250
|
+
const parent = sectionPathIndex.get(path.slice(0, -1).join("\x00"));
|
|
4251
|
+
if (!parent || parent.id === section.id) {
|
|
4252
|
+
continue;
|
|
4253
|
+
}
|
|
4254
|
+
section.parentSectionId = parent.id;
|
|
4255
|
+
if (!parent.childSectionIds.includes(section.id)) {
|
|
4256
|
+
parent.childSectionIds.push(section.id);
|
|
4257
|
+
}
|
|
4258
|
+
if (parent.leadChunkId && section.leadChunkId) {
|
|
4259
|
+
const parentKey = `section_parent:${section.leadChunkId}:${parent.leadChunkId}`;
|
|
4260
|
+
if (!edgeKeys.has(parentKey)) {
|
|
4261
|
+
edgeKeys.add(parentKey);
|
|
4262
|
+
edges.push({
|
|
4263
|
+
fromChunkId: section.leadChunkId,
|
|
4264
|
+
relation: "section_parent",
|
|
4265
|
+
toChunkId: parent.leadChunkId
|
|
4266
|
+
});
|
|
4267
|
+
}
|
|
4268
|
+
const childKey = `section_child:${parent.leadChunkId}:${section.leadChunkId}`;
|
|
4269
|
+
if (!edgeKeys.has(childKey)) {
|
|
4270
|
+
edgeKeys.add(childKey);
|
|
4271
|
+
edges.push({
|
|
4272
|
+
fromChunkId: parent.leadChunkId,
|
|
4273
|
+
relation: "section_child",
|
|
4274
|
+
toChunkId: section.leadChunkId
|
|
4275
|
+
});
|
|
4276
|
+
}
|
|
4277
|
+
}
|
|
4234
4278
|
}
|
|
4235
4279
|
nodes.sort((left, right) => {
|
|
4236
4280
|
const leftSection = left.structure?.sequence?.sectionChunkIndex ?? Number.MAX_SAFE_INTEGER;
|
|
@@ -4264,6 +4308,8 @@ var buildRAGChunkGraphNavigation = (graph, activeChunkId) => {
|
|
|
4264
4308
|
if (graph.nodes.length === 0) {
|
|
4265
4309
|
return {
|
|
4266
4310
|
activeChunkId,
|
|
4311
|
+
childSections: [],
|
|
4312
|
+
siblingSections: [],
|
|
4267
4313
|
sectionNodes: []
|
|
4268
4314
|
};
|
|
4269
4315
|
}
|
|
@@ -4272,13 +4318,19 @@ var buildRAGChunkGraphNavigation = (graph, activeChunkId) => {
|
|
|
4272
4318
|
const previousNode = activeNode?.structure?.sequence?.previousChunkId ? graph.nodes.find((node) => node.chunkId === activeNode.structure?.sequence?.previousChunkId) : undefined;
|
|
4273
4319
|
const nextNode = activeNode?.structure?.sequence?.nextChunkId ? graph.nodes.find((node) => node.chunkId === activeNode.structure?.sequence?.nextChunkId) : undefined;
|
|
4274
4320
|
const section = activeNode?.structure?.sequence?.sectionChunkId ? graph.sections.find((entry) => entry.id === activeNode.structure?.sequence?.sectionChunkId) : undefined;
|
|
4321
|
+
const parentSection = section?.parentSectionId ? graph.sections.find((entry) => entry.id === section.parentSectionId) : undefined;
|
|
4322
|
+
const childSections = section ? section.childSectionIds.map((sectionId) => graph.sections.find((entry) => entry.id === sectionId)).filter((entry) => Boolean(entry)) : [];
|
|
4323
|
+
const siblingSections = section?.parentSectionId ? graph.sections.filter((entry) => entry.parentSectionId === section.parentSectionId && entry.id !== section.id) : [];
|
|
4275
4324
|
const sectionNodes = section ? section.chunkIds.map((chunkId) => graph.nodes.find((node) => node.chunkId === chunkId)).filter((node) => Boolean(node)) : activeNode ? [activeNode] : [];
|
|
4276
4325
|
return {
|
|
4277
4326
|
activeChunkId: resolvedActiveChunkId,
|
|
4278
4327
|
activeNode,
|
|
4328
|
+
childSections,
|
|
4279
4329
|
nextNode,
|
|
4330
|
+
parentSection,
|
|
4280
4331
|
previousNode,
|
|
4281
4332
|
section,
|
|
4333
|
+
siblingSections,
|
|
4282
4334
|
sectionNodes
|
|
4283
4335
|
};
|
|
4284
4336
|
};
|
|
@@ -6798,6 +6850,24 @@ var useRAGChunkPreview = (path) => {
|
|
|
6798
6850
|
const selectChunk = (id) => {
|
|
6799
6851
|
activeChunkId.value = id;
|
|
6800
6852
|
};
|
|
6853
|
+
const selectParentSection = () => {
|
|
6854
|
+
const leadChunkId = navigation.value?.parentSection?.leadChunkId;
|
|
6855
|
+
if (leadChunkId) {
|
|
6856
|
+
activeChunkId.value = leadChunkId;
|
|
6857
|
+
}
|
|
6858
|
+
};
|
|
6859
|
+
const selectChildSection = (sectionId) => {
|
|
6860
|
+
const leadChunkId = navigation.value?.childSections.find((section) => section.id === sectionId)?.leadChunkId;
|
|
6861
|
+
if (leadChunkId) {
|
|
6862
|
+
activeChunkId.value = leadChunkId;
|
|
6863
|
+
}
|
|
6864
|
+
};
|
|
6865
|
+
const selectSiblingSection = (sectionId) => {
|
|
6866
|
+
const leadChunkId = navigation.value?.siblingSections.find((section) => section.id === sectionId)?.leadChunkId;
|
|
6867
|
+
if (leadChunkId) {
|
|
6868
|
+
activeChunkId.value = leadChunkId;
|
|
6869
|
+
}
|
|
6870
|
+
};
|
|
6801
6871
|
return {
|
|
6802
6872
|
activeChunkId,
|
|
6803
6873
|
clear,
|
|
@@ -6807,7 +6877,10 @@ var useRAGChunkPreview = (path) => {
|
|
|
6807
6877
|
isLoading,
|
|
6808
6878
|
navigation,
|
|
6809
6879
|
preview,
|
|
6810
|
-
|
|
6880
|
+
selectChildSection,
|
|
6881
|
+
selectChunk,
|
|
6882
|
+
selectParentSection,
|
|
6883
|
+
selectSiblingSection
|
|
6811
6884
|
};
|
|
6812
6885
|
};
|
|
6813
6886
|
// src/vue/ai/useRAG.ts
|
|
@@ -7379,11 +7452,13 @@ var useRAGSources = (messages) => {
|
|
|
7379
7452
|
const chunkGraph = computed5(() => buildRAGChunkGraph(sources.value));
|
|
7380
7453
|
const citationReferenceMap = computed5(() => buildRAGCitationReferenceMap(sourceSummaries.value.flatMap((summary) => summary.citations)));
|
|
7381
7454
|
const hasSources = computed5(() => sources.value.length > 0);
|
|
7455
|
+
const navigationForChunk = (chunkId) => buildRAGChunkGraphNavigation(chunkGraph.value, chunkId ?? undefined);
|
|
7382
7456
|
return {
|
|
7383
7457
|
citationReferenceMap,
|
|
7384
7458
|
chunkGraph,
|
|
7385
7459
|
hasSources,
|
|
7386
7460
|
latestAssistantMessage,
|
|
7461
|
+
navigationForChunk,
|
|
7387
7462
|
sourceGroups,
|
|
7388
7463
|
sources,
|
|
7389
7464
|
sourceSummaries
|
|
@@ -7561,5 +7636,5 @@ export {
|
|
|
7561
7636
|
AIStreamKey
|
|
7562
7637
|
};
|
|
7563
7638
|
|
|
7564
|
-
//# debugId=
|
|
7639
|
+
//# debugId=E188A8917F67F05864756E2164756E21
|
|
7565
7640
|
//# sourceMappingURL=index.js.map
|