@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
|
@@ -16,7 +16,10 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
|
|
|
16
16
|
isLoading: boolean;
|
|
17
17
|
navigation: import("../..").RAGChunkGraphNavigation | null;
|
|
18
18
|
preview: import("../..").RAGDocumentChunkPreview | null;
|
|
19
|
+
selectChildSection: (sectionId: string) => void;
|
|
19
20
|
selectChunk: (id: string | null) => void;
|
|
21
|
+
selectParentSection: () => void;
|
|
22
|
+
selectSiblingSection: (sectionId: string) => void;
|
|
20
23
|
};
|
|
21
24
|
citations: {
|
|
22
25
|
citationReferenceMap: import("../..").RAGCitationReferenceMap;
|
|
@@ -193,6 +196,7 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
|
|
|
193
196
|
chunkGraph: import("../..").RAGChunkGraph;
|
|
194
197
|
hasSources: boolean;
|
|
195
198
|
latestAssistantMessage: import("../..").AIMessage | undefined;
|
|
199
|
+
navigationForChunk: (chunkId?: string | null) => import("../..").RAGChunkGraphNavigation;
|
|
196
200
|
sourceGroups: import("../..").RAGSourceGroup[];
|
|
197
201
|
sources: import("../..").RAGSource[];
|
|
198
202
|
sourceSummaries: import("../..").RAGSourceSummary[];
|
|
@@ -10,6 +10,9 @@ export declare const useRAGChunkPreview: (path: string) => {
|
|
|
10
10
|
isLoading: boolean;
|
|
11
11
|
navigation: import("../..").RAGChunkGraphNavigation | null;
|
|
12
12
|
preview: RAGDocumentChunkPreview | null;
|
|
13
|
+
selectChildSection: (sectionId: string) => void;
|
|
13
14
|
selectChunk: (id: string | null) => void;
|
|
15
|
+
selectParentSection: () => void;
|
|
16
|
+
selectSiblingSection: (sectionId: string) => void;
|
|
14
17
|
};
|
|
15
18
|
export type UseRAGChunkPreviewResult = ReturnType<typeof useRAGChunkPreview>;
|
|
@@ -4,6 +4,7 @@ export declare const useRAGSources: (messages: AIMessage[]) => {
|
|
|
4
4
|
chunkGraph: import("../..").RAGChunkGraph;
|
|
5
5
|
hasSources: boolean;
|
|
6
6
|
latestAssistantMessage: AIMessage | undefined;
|
|
7
|
+
navigationForChunk: (chunkId?: string | null) => import("../..").RAGChunkGraphNavigation;
|
|
7
8
|
sourceGroups: import("../..").RAGSourceGroup[];
|
|
8
9
|
sources: import("../..").RAGSource[];
|
|
9
10
|
sourceSummaries: import("../..").RAGSourceSummary[];
|
|
@@ -16,7 +16,10 @@ export declare const createRAG: (path: string, options?: CreateRAGOptions) => {
|
|
|
16
16
|
isLoading: import("svelte/store").Writable<boolean>;
|
|
17
17
|
navigation: import("svelte/store").Readable<import("../..").RAGChunkGraphNavigation | null>;
|
|
18
18
|
preview: import("svelte/store").Writable<import("../..").RAGDocumentChunkPreview | null>;
|
|
19
|
+
selectChildSection: (sectionId: string) => void;
|
|
19
20
|
selectChunk: (id: string | null) => void;
|
|
21
|
+
selectParentSection: () => void;
|
|
22
|
+
selectSiblingSection: (sectionId: string) => void;
|
|
20
23
|
};
|
|
21
24
|
citations: {
|
|
22
25
|
citationReferenceMap: import("svelte/store").Readable<import("../..").RAGCitationReferenceMap>;
|
|
@@ -194,6 +197,7 @@ export declare const createRAG: (path: string, options?: CreateRAGOptions) => {
|
|
|
194
197
|
chunkGraph: import("svelte/store").Readable<import("../..").RAGChunkGraph>;
|
|
195
198
|
hasSources: import("svelte/store").Readable<boolean>;
|
|
196
199
|
latestAssistantMessage: import("svelte/store").Readable<import("../..").AIMessage | undefined>;
|
|
200
|
+
navigationForChunk: (chunkId?: string | null) => import("../..").RAGChunkGraphNavigation;
|
|
197
201
|
sourceGroups: import("svelte/store").Readable<import("../..").RAGSourceGroup[]>;
|
|
198
202
|
sources: import("svelte/store").Readable<import("../..").RAGSource[]>;
|
|
199
203
|
sourceSummaries: import("svelte/store").Readable<import("../..").RAGSourceSummary[]>;
|
|
@@ -10,6 +10,9 @@ export declare const createRAGChunkPreview: (path: string) => {
|
|
|
10
10
|
isLoading: import("svelte/store").Writable<boolean>;
|
|
11
11
|
navigation: import("svelte/store").Readable<import("../..").RAGChunkGraphNavigation | null>;
|
|
12
12
|
preview: import("svelte/store").Writable<RAGDocumentChunkPreview | null>;
|
|
13
|
+
selectChildSection: (sectionId: string) => void;
|
|
13
14
|
selectChunk: (id: string | null) => void;
|
|
15
|
+
selectParentSection: () => void;
|
|
16
|
+
selectSiblingSection: (sectionId: string) => void;
|
|
14
17
|
};
|
|
15
18
|
export type CreateRAGChunkPreviewResult = ReturnType<typeof createRAGChunkPreview>;
|
|
@@ -5,6 +5,7 @@ export declare const createRAGSources: (messages: Readable<AIMessage[]>) => {
|
|
|
5
5
|
chunkGraph: Readable<import("../..").RAGChunkGraph>;
|
|
6
6
|
hasSources: Readable<boolean>;
|
|
7
7
|
latestAssistantMessage: Readable<AIMessage | undefined>;
|
|
8
|
+
navigationForChunk: (chunkId?: string | null) => import("../..").RAGChunkGraphNavigation;
|
|
8
9
|
sourceGroups: Readable<import("../..").RAGSourceGroup[]>;
|
|
9
10
|
sources: Readable<import("../..").RAGSource[]>;
|
|
10
11
|
sourceSummaries: Readable<import("../..").RAGSourceSummary[]>;
|
|
@@ -112,7 +112,10 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
|
|
|
112
112
|
} | undefined;
|
|
113
113
|
}[];
|
|
114
114
|
} | null>;
|
|
115
|
+
selectChildSection: (sectionId: string) => void;
|
|
115
116
|
selectChunk: (id: string | null) => void;
|
|
117
|
+
selectParentSection: () => void;
|
|
118
|
+
selectSiblingSection: (sectionId: string) => void;
|
|
116
119
|
};
|
|
117
120
|
citations: {
|
|
118
121
|
citationReferenceMap: import("vue").ComputedRef<import("../..").RAGCitationReferenceMap>;
|
|
@@ -1428,6 +1431,7 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
|
|
|
1428
1431
|
chunkGraph: import("vue").ComputedRef<import("../..").RAGChunkGraph>;
|
|
1429
1432
|
hasSources: import("vue").ComputedRef<boolean>;
|
|
1430
1433
|
latestAssistantMessage: import("vue").ComputedRef<import("../..").AIMessage | undefined>;
|
|
1434
|
+
navigationForChunk: (chunkId?: string | null) => import("../..").RAGChunkGraphNavigation;
|
|
1431
1435
|
sourceGroups: import("vue").ComputedRef<import("../..").RAGSourceGroup[]>;
|
|
1432
1436
|
sources: import("vue").ComputedRef<import("../..").RAGSource[]>;
|
|
1433
1437
|
sourceSummaries: import("vue").ComputedRef<import("../..").RAGSourceSummary[]>;
|
|
@@ -106,6 +106,9 @@ export declare const useRAGChunkPreview: (path: string) => {
|
|
|
106
106
|
} | undefined;
|
|
107
107
|
}[];
|
|
108
108
|
} | null>;
|
|
109
|
+
selectChildSection: (sectionId: string) => void;
|
|
109
110
|
selectChunk: (id: string | null) => void;
|
|
111
|
+
selectParentSection: () => void;
|
|
112
|
+
selectSiblingSection: (sectionId: string) => void;
|
|
110
113
|
};
|
|
111
114
|
export type UseRAGChunkPreviewResult = ReturnType<typeof useRAGChunkPreview>;
|
|
@@ -5,6 +5,7 @@ export declare const useRAGSources: (messages: Ref<AIMessage[]>) => {
|
|
|
5
5
|
chunkGraph: import("vue").ComputedRef<import("../..").RAGChunkGraph>;
|
|
6
6
|
hasSources: import("vue").ComputedRef<boolean>;
|
|
7
7
|
latestAssistantMessage: import("vue").ComputedRef<AIMessage | undefined>;
|
|
8
|
+
navigationForChunk: (chunkId?: string | null) => import("../..").RAGChunkGraphNavigation;
|
|
8
9
|
sourceGroups: import("vue").ComputedRef<import("../..").RAGSourceGroup[]>;
|
|
9
10
|
sources: import("vue").ComputedRef<import("../..").RAGSource[]>;
|
|
10
11
|
sourceSummaries: import("vue").ComputedRef<import("../..").RAGSourceSummary[]>;
|
package/dist/svelte/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
|
};
|
|
@@ -6803,6 +6855,36 @@ var createRAGChunkPreview = (path) => {
|
|
|
6803
6855
|
const selectChunk = (id) => {
|
|
6804
6856
|
activeChunkId.set(id);
|
|
6805
6857
|
};
|
|
6858
|
+
const selectParentSection = () => {
|
|
6859
|
+
let leadChunkId;
|
|
6860
|
+
const unsubscribe = navigationWithSelection.subscribe(($navigation) => {
|
|
6861
|
+
leadChunkId = $navigation?.parentSection?.leadChunkId;
|
|
6862
|
+
});
|
|
6863
|
+
unsubscribe();
|
|
6864
|
+
if (leadChunkId) {
|
|
6865
|
+
activeChunkId.set(leadChunkId);
|
|
6866
|
+
}
|
|
6867
|
+
};
|
|
6868
|
+
const selectChildSection = (sectionId) => {
|
|
6869
|
+
let leadChunkId;
|
|
6870
|
+
const unsubscribe = navigationWithSelection.subscribe(($navigation) => {
|
|
6871
|
+
leadChunkId = $navigation?.childSections.find((section) => section.id === sectionId)?.leadChunkId;
|
|
6872
|
+
});
|
|
6873
|
+
unsubscribe();
|
|
6874
|
+
if (leadChunkId) {
|
|
6875
|
+
activeChunkId.set(leadChunkId);
|
|
6876
|
+
}
|
|
6877
|
+
};
|
|
6878
|
+
const selectSiblingSection = (sectionId) => {
|
|
6879
|
+
let leadChunkId;
|
|
6880
|
+
const unsubscribe = navigationWithSelection.subscribe(($navigation) => {
|
|
6881
|
+
leadChunkId = $navigation?.siblingSections.find((section) => section.id === sectionId)?.leadChunkId;
|
|
6882
|
+
});
|
|
6883
|
+
unsubscribe();
|
|
6884
|
+
if (leadChunkId) {
|
|
6885
|
+
activeChunkId.set(leadChunkId);
|
|
6886
|
+
}
|
|
6887
|
+
};
|
|
6806
6888
|
return {
|
|
6807
6889
|
activeChunkId,
|
|
6808
6890
|
clear,
|
|
@@ -6812,7 +6894,10 @@ var createRAGChunkPreview = (path) => {
|
|
|
6812
6894
|
isLoading,
|
|
6813
6895
|
navigation: navigationWithSelection,
|
|
6814
6896
|
preview,
|
|
6815
|
-
|
|
6897
|
+
selectChildSection,
|
|
6898
|
+
selectChunk,
|
|
6899
|
+
selectParentSection,
|
|
6900
|
+
selectSiblingSection
|
|
6816
6901
|
};
|
|
6817
6902
|
};
|
|
6818
6903
|
|
|
@@ -7371,7 +7456,7 @@ var createRAGSearch = (path) => {
|
|
|
7371
7456
|
};
|
|
7372
7457
|
|
|
7373
7458
|
// src/svelte/ai/createRAGSources.ts
|
|
7374
|
-
import { derived as derived5 } from "svelte/store";
|
|
7459
|
+
import { derived as derived5, get } from "svelte/store";
|
|
7375
7460
|
var createRAGSources = (messages) => {
|
|
7376
7461
|
const latestAssistantMessage = derived5(messages, ($messages) => getLatestAssistantMessage($messages));
|
|
7377
7462
|
const sources = derived5(messages, ($messages) => getLatestRAGSources($messages));
|
|
@@ -7380,11 +7465,13 @@ var createRAGSources = (messages) => {
|
|
|
7380
7465
|
const chunkGraph = derived5(sources, ($sources) => buildRAGChunkGraph($sources));
|
|
7381
7466
|
const citationReferenceMap = derived5(sourceSummaries, ($sourceSummaries) => buildRAGCitationReferenceMap($sourceSummaries.flatMap((summary) => summary.citations)));
|
|
7382
7467
|
const hasSources = derived5(sources, ($sources) => $sources.length > 0);
|
|
7468
|
+
const navigationForChunk = (chunkId) => buildRAGChunkGraphNavigation(get(chunkGraph), chunkId ?? undefined);
|
|
7383
7469
|
return {
|
|
7384
7470
|
citationReferenceMap,
|
|
7385
7471
|
chunkGraph,
|
|
7386
7472
|
hasSources,
|
|
7387
7473
|
latestAssistantMessage,
|
|
7474
|
+
navigationForChunk,
|
|
7388
7475
|
sourceGroups,
|
|
7389
7476
|
sources,
|
|
7390
7477
|
sourceSummaries
|
|
@@ -7578,5 +7665,5 @@ export {
|
|
|
7578
7665
|
createAIStream
|
|
7579
7666
|
};
|
|
7580
7667
|
|
|
7581
|
-
//# debugId=
|
|
7668
|
+
//# debugId=585BD3B22EFD464B64756E2164756E21
|
|
7582
7669
|
//# sourceMappingURL=index.js.map
|