@absolutejs/absolute 0.19.0-beta.439 → 0.19.0-beta.440
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/vue/ai/index.js +459 -17
- 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/src/vue/ai/index.d.ts +6 -0
- package/dist/src/vue/ai/useRAG.d.ts +434 -0
- package/dist/src/vue/ai/useRAGChunkPreview.d.ts +57 -0
- package/dist/src/vue/ai/useRAGCitations.d.ts +8 -0
- package/dist/src/vue/ai/useRAGDocuments.d.ts +70 -0
- package/dist/src/vue/ai/useRAGIndexAdmin.d.ts +206 -0
- package/dist/src/vue/ai/useRAGIngest.d.ts +20 -2
- package/dist/src/vue/ai/useRAGSearch.d.ts +15 -0
- package/dist/src/vue/ai/useRAGSources.d.ts +9 -0
- package/dist/src/vue/ai/useRAGStatus.d.ts +1 -0
- package/dist/src/vue/ai/useRAGStream.d.ts +14 -1
- package/dist/vue/ai/index.js +460 -18
- package/dist/vue/ai/index.js.map +14 -7
- package/dist/vue/components/index.js +17 -4
- package/dist/vue/components/index.js.map +3 -3
- package/dist/vue/index.js +17 -4
- package/dist/vue/index.js.map +3 -3
- package/package.json +1 -1
|
@@ -591,7 +591,7 @@ var useAIStream = (path, conversationId) => {
|
|
|
591
591
|
send
|
|
592
592
|
};
|
|
593
593
|
};
|
|
594
|
-
// src/vue/ai/
|
|
594
|
+
// src/vue/ai/useRAGChunkPreview.ts
|
|
595
595
|
import { ref as ref2 } from "vue";
|
|
596
596
|
|
|
597
597
|
// src/ai/client/ragClient.ts
|
|
@@ -751,13 +751,220 @@ var createRAGClient = (options) => {
|
|
|
751
751
|
};
|
|
752
752
|
};
|
|
753
753
|
|
|
754
|
+
// src/vue/ai/useRAGChunkPreview.ts
|
|
755
|
+
var useRAGChunkPreview = (path) => {
|
|
756
|
+
const client = createRAGClient({ path });
|
|
757
|
+
const preview = ref2(null);
|
|
758
|
+
const error = ref2(null);
|
|
759
|
+
const isLoading = ref2(false);
|
|
760
|
+
const inspect = async (id) => {
|
|
761
|
+
isLoading.value = true;
|
|
762
|
+
error.value = null;
|
|
763
|
+
try {
|
|
764
|
+
const response = await client.documentChunks(id);
|
|
765
|
+
if (!response.ok) {
|
|
766
|
+
throw new Error(response.error);
|
|
767
|
+
}
|
|
768
|
+
preview.value = response;
|
|
769
|
+
return response;
|
|
770
|
+
} catch (caught) {
|
|
771
|
+
error.value = caught instanceof Error ? caught.message : String(caught);
|
|
772
|
+
throw caught;
|
|
773
|
+
} finally {
|
|
774
|
+
isLoading.value = false;
|
|
775
|
+
}
|
|
776
|
+
};
|
|
777
|
+
const clear = () => {
|
|
778
|
+
error.value = null;
|
|
779
|
+
isLoading.value = false;
|
|
780
|
+
preview.value = null;
|
|
781
|
+
};
|
|
782
|
+
return {
|
|
783
|
+
clear,
|
|
784
|
+
error,
|
|
785
|
+
inspect,
|
|
786
|
+
isLoading,
|
|
787
|
+
preview
|
|
788
|
+
};
|
|
789
|
+
};
|
|
790
|
+
// src/vue/ai/useRAGCitations.ts
|
|
791
|
+
import { computed } from "vue";
|
|
792
|
+
|
|
793
|
+
// src/ai/rag/presentation.ts
|
|
794
|
+
var buildSourceGroupKey = (source) => source.source ?? source.title ?? source.chunkId;
|
|
795
|
+
var buildSourceLabel = (source) => source.source ?? source.title ?? source.chunkId;
|
|
796
|
+
var getLatestAssistantMessage = (messages) => {
|
|
797
|
+
for (let index = messages.length - 1;index >= 0; index -= 1) {
|
|
798
|
+
const message = messages[index];
|
|
799
|
+
if (message?.role === "assistant") {
|
|
800
|
+
return message;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
return;
|
|
804
|
+
};
|
|
805
|
+
var getLatestRAGSources = (messages) => getLatestAssistantMessage(messages)?.sources ?? [];
|
|
806
|
+
var getLatestRetrievedMessage = (messages) => {
|
|
807
|
+
for (let index = messages.length - 1;index >= 0; index -= 1) {
|
|
808
|
+
const message = messages[index];
|
|
809
|
+
if (message?.role === "assistant" && (message.sources?.length ?? 0) > 0) {
|
|
810
|
+
return message;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
return;
|
|
814
|
+
};
|
|
815
|
+
var buildRAGSourceGroups = (sources) => {
|
|
816
|
+
const groups = new Map;
|
|
817
|
+
for (const source of sources) {
|
|
818
|
+
const key = buildSourceGroupKey(source);
|
|
819
|
+
const existing = groups.get(key);
|
|
820
|
+
if (existing) {
|
|
821
|
+
existing.bestScore = Math.max(existing.bestScore, source.score);
|
|
822
|
+
existing.count += 1;
|
|
823
|
+
existing.chunks.push(source);
|
|
824
|
+
continue;
|
|
825
|
+
}
|
|
826
|
+
groups.set(key, {
|
|
827
|
+
bestScore: source.score,
|
|
828
|
+
chunks: [source],
|
|
829
|
+
count: 1,
|
|
830
|
+
key,
|
|
831
|
+
label: buildSourceLabel(source),
|
|
832
|
+
source: source.source,
|
|
833
|
+
title: source.title
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
return [...groups.values()].sort((left, right) => {
|
|
837
|
+
if (right.bestScore !== left.bestScore) {
|
|
838
|
+
return right.bestScore - left.bestScore;
|
|
839
|
+
}
|
|
840
|
+
return left.label.localeCompare(right.label);
|
|
841
|
+
});
|
|
842
|
+
};
|
|
843
|
+
var buildRAGCitations = (sources) => {
|
|
844
|
+
const unique = new Map;
|
|
845
|
+
for (const source of sources) {
|
|
846
|
+
const key = source.chunkId;
|
|
847
|
+
const existing = unique.get(key);
|
|
848
|
+
if (existing && existing.score >= source.score) {
|
|
849
|
+
continue;
|
|
850
|
+
}
|
|
851
|
+
unique.set(key, {
|
|
852
|
+
chunkId: source.chunkId,
|
|
853
|
+
key,
|
|
854
|
+
label: buildSourceLabel(source),
|
|
855
|
+
metadata: source.metadata,
|
|
856
|
+
score: source.score,
|
|
857
|
+
source: source.source,
|
|
858
|
+
text: source.text,
|
|
859
|
+
title: source.title
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
return [...unique.values()].sort((left, right) => {
|
|
863
|
+
if (right.score !== left.score) {
|
|
864
|
+
return right.score - left.score;
|
|
865
|
+
}
|
|
866
|
+
return left.label.localeCompare(right.label);
|
|
867
|
+
});
|
|
868
|
+
};
|
|
869
|
+
var buildRAGRetrievedState = (messages) => {
|
|
870
|
+
const message = getLatestRetrievedMessage(messages);
|
|
871
|
+
if (!message) {
|
|
872
|
+
return null;
|
|
873
|
+
}
|
|
874
|
+
const sources = message.sources ?? [];
|
|
875
|
+
return {
|
|
876
|
+
citations: buildRAGCitations(sources),
|
|
877
|
+
conversationId: message.conversationId,
|
|
878
|
+
messageId: message.id,
|
|
879
|
+
retrievedAt: message.retrievedAt,
|
|
880
|
+
sourceGroups: buildRAGSourceGroups(sources),
|
|
881
|
+
sources
|
|
882
|
+
};
|
|
883
|
+
};
|
|
884
|
+
var resolveRAGStreamStage = ({
|
|
885
|
+
error,
|
|
886
|
+
isStreaming,
|
|
887
|
+
messages
|
|
888
|
+
}) => {
|
|
889
|
+
if (error) {
|
|
890
|
+
return "error";
|
|
891
|
+
}
|
|
892
|
+
const assistantMessage = getLatestAssistantMessage(messages);
|
|
893
|
+
if (!assistantMessage) {
|
|
894
|
+
return isStreaming ? "submitting" : "idle";
|
|
895
|
+
}
|
|
896
|
+
if (!isStreaming) {
|
|
897
|
+
return "complete";
|
|
898
|
+
}
|
|
899
|
+
const hasSources = (assistantMessage.sources?.length ?? 0) > 0;
|
|
900
|
+
const hasContent = assistantMessage.content.trim().length > 0 || assistantMessage.thinking?.trim().length || (assistantMessage.toolCalls?.length ?? 0) > 0 || (assistantMessage.images?.length ?? 0) > 0;
|
|
901
|
+
if (hasSources && !hasContent) {
|
|
902
|
+
return "retrieved";
|
|
903
|
+
}
|
|
904
|
+
return "streaming";
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
// src/vue/ai/useRAGCitations.ts
|
|
908
|
+
var useRAGCitations = (sources) => {
|
|
909
|
+
const citations = computed(() => buildRAGCitations(sources.value));
|
|
910
|
+
const sourceGroups = computed(() => buildRAGSourceGroups(sources.value));
|
|
911
|
+
const hasCitations = computed(() => citations.value.length > 0);
|
|
912
|
+
return {
|
|
913
|
+
citations,
|
|
914
|
+
hasCitations,
|
|
915
|
+
sourceGroups
|
|
916
|
+
};
|
|
917
|
+
};
|
|
918
|
+
|
|
919
|
+
// src/vue/ai/useRAGDocuments.ts
|
|
920
|
+
import { ref as ref3 } from "vue";
|
|
921
|
+
var useRAGDocuments = (path) => {
|
|
922
|
+
const client = createRAGClient({ path });
|
|
923
|
+
const documents = ref3([]);
|
|
924
|
+
const error = ref3(null);
|
|
925
|
+
const isLoading = ref3(false);
|
|
926
|
+
const lastResponse = ref3(null);
|
|
927
|
+
const load = async (kind) => {
|
|
928
|
+
isLoading.value = true;
|
|
929
|
+
error.value = null;
|
|
930
|
+
try {
|
|
931
|
+
const response = await client.documents(kind);
|
|
932
|
+
documents.value = response.documents;
|
|
933
|
+
lastResponse.value = response;
|
|
934
|
+
return response;
|
|
935
|
+
} catch (caught) {
|
|
936
|
+
error.value = caught instanceof Error ? caught.message : String(caught);
|
|
937
|
+
throw caught;
|
|
938
|
+
} finally {
|
|
939
|
+
isLoading.value = false;
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
const reset = () => {
|
|
943
|
+
documents.value = [];
|
|
944
|
+
error.value = null;
|
|
945
|
+
isLoading.value = false;
|
|
946
|
+
lastResponse.value = null;
|
|
947
|
+
};
|
|
948
|
+
return {
|
|
949
|
+
documents,
|
|
950
|
+
error,
|
|
951
|
+
isLoading,
|
|
952
|
+
lastResponse,
|
|
953
|
+
load,
|
|
954
|
+
reset
|
|
955
|
+
};
|
|
956
|
+
};
|
|
957
|
+
|
|
754
958
|
// src/vue/ai/useRAGIngest.ts
|
|
959
|
+
import { ref as ref4 } from "vue";
|
|
755
960
|
var useRAGIngest = (path) => {
|
|
756
961
|
const client = createRAGClient({ path });
|
|
757
|
-
const error =
|
|
758
|
-
const isIngesting =
|
|
759
|
-
const lastIngestCount =
|
|
760
|
-
const
|
|
962
|
+
const error = ref4(null);
|
|
963
|
+
const isIngesting = ref4(false);
|
|
964
|
+
const lastIngestCount = ref4(null);
|
|
965
|
+
const lastDocumentCount = ref4(null);
|
|
966
|
+
const lastResponse = ref4(null);
|
|
967
|
+
const ingestChunks = async (chunks) => {
|
|
761
968
|
isIngesting.value = true;
|
|
762
969
|
error.value = null;
|
|
763
970
|
try {
|
|
@@ -766,6 +973,27 @@ var useRAGIngest = (path) => {
|
|
|
766
973
|
throw new Error(response.error ?? "RAG ingest failed");
|
|
767
974
|
}
|
|
768
975
|
lastIngestCount.value = response.count ?? chunks.length;
|
|
976
|
+
lastDocumentCount.value = null;
|
|
977
|
+
lastResponse.value = response;
|
|
978
|
+
return response;
|
|
979
|
+
} catch (caught) {
|
|
980
|
+
error.value = caught instanceof Error ? caught.message : String(caught);
|
|
981
|
+
throw caught;
|
|
982
|
+
} finally {
|
|
983
|
+
isIngesting.value = false;
|
|
984
|
+
}
|
|
985
|
+
};
|
|
986
|
+
const ingestDocuments = async (input) => {
|
|
987
|
+
isIngesting.value = true;
|
|
988
|
+
error.value = null;
|
|
989
|
+
try {
|
|
990
|
+
const response = await client.ingestDocuments(input);
|
|
991
|
+
if (!response.ok) {
|
|
992
|
+
throw new Error(response.error ?? "RAG document ingest failed");
|
|
993
|
+
}
|
|
994
|
+
lastDocumentCount.value = response.documentCount ?? input.documents.length;
|
|
995
|
+
lastIngestCount.value = response.count ?? null;
|
|
996
|
+
lastResponse.value = response;
|
|
769
997
|
return response;
|
|
770
998
|
} catch (caught) {
|
|
771
999
|
error.value = caught instanceof Error ? caught.message : String(caught);
|
|
@@ -774,26 +1002,140 @@ var useRAGIngest = (path) => {
|
|
|
774
1002
|
isIngesting.value = false;
|
|
775
1003
|
}
|
|
776
1004
|
};
|
|
1005
|
+
const clearIndex = async () => {
|
|
1006
|
+
isIngesting.value = true;
|
|
1007
|
+
error.value = null;
|
|
1008
|
+
try {
|
|
1009
|
+
return await client.clearIndex();
|
|
1010
|
+
} catch (caught) {
|
|
1011
|
+
error.value = caught instanceof Error ? caught.message : String(caught);
|
|
1012
|
+
throw caught;
|
|
1013
|
+
} finally {
|
|
1014
|
+
isIngesting.value = false;
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
const reset = () => {
|
|
1018
|
+
error.value = null;
|
|
1019
|
+
isIngesting.value = false;
|
|
1020
|
+
lastDocumentCount.value = null;
|
|
1021
|
+
lastIngestCount.value = null;
|
|
1022
|
+
lastResponse.value = null;
|
|
1023
|
+
};
|
|
777
1024
|
return {
|
|
1025
|
+
clearIndex,
|
|
778
1026
|
error,
|
|
779
|
-
ingest,
|
|
1027
|
+
ingest: ingestChunks,
|
|
1028
|
+
ingestChunks,
|
|
1029
|
+
ingestDocuments,
|
|
780
1030
|
isIngesting,
|
|
781
|
-
|
|
1031
|
+
lastDocumentCount,
|
|
1032
|
+
lastIngestCount,
|
|
1033
|
+
lastResponse,
|
|
1034
|
+
reset
|
|
782
1035
|
};
|
|
783
1036
|
};
|
|
1037
|
+
|
|
1038
|
+
// src/vue/ai/useRAGIndexAdmin.ts
|
|
1039
|
+
import { ref as ref5 } from "vue";
|
|
1040
|
+
var useRAGIndexAdmin = (path) => {
|
|
1041
|
+
const client = createRAGClient({ path });
|
|
1042
|
+
const isLoading = ref5(false);
|
|
1043
|
+
const error = ref5(null);
|
|
1044
|
+
const lastMutation = ref5(null);
|
|
1045
|
+
const backends = ref5(null);
|
|
1046
|
+
const run = async (operation) => {
|
|
1047
|
+
isLoading.value = true;
|
|
1048
|
+
error.value = null;
|
|
1049
|
+
try {
|
|
1050
|
+
return await operation();
|
|
1051
|
+
} catch (caught) {
|
|
1052
|
+
error.value = caught instanceof Error ? caught.message : String(caught);
|
|
1053
|
+
throw caught;
|
|
1054
|
+
} finally {
|
|
1055
|
+
isLoading.value = false;
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
const createDocument = async (input) => run(async () => {
|
|
1059
|
+
const response = await client.createDocument(input);
|
|
1060
|
+
lastMutation.value = response;
|
|
1061
|
+
if (!response.ok) {
|
|
1062
|
+
throw new Error(response.error ?? "Failed to create document");
|
|
1063
|
+
}
|
|
1064
|
+
return response;
|
|
1065
|
+
});
|
|
1066
|
+
const deleteDocument = async (id) => run(async () => {
|
|
1067
|
+
const response = await client.deleteDocument(id);
|
|
1068
|
+
lastMutation.value = response;
|
|
1069
|
+
if (!response.ok) {
|
|
1070
|
+
throw new Error(response.error ?? "Failed to delete document");
|
|
1071
|
+
}
|
|
1072
|
+
return response;
|
|
1073
|
+
});
|
|
1074
|
+
const reseed = async () => run(async () => {
|
|
1075
|
+
const response = await client.reseed();
|
|
1076
|
+
lastMutation.value = response;
|
|
1077
|
+
if (!response.ok) {
|
|
1078
|
+
throw new Error(response.error ?? "Failed to reseed index");
|
|
1079
|
+
}
|
|
1080
|
+
return response;
|
|
1081
|
+
});
|
|
1082
|
+
const reset = async () => run(async () => {
|
|
1083
|
+
const response = await client.reset();
|
|
1084
|
+
lastMutation.value = response;
|
|
1085
|
+
if (!response.ok) {
|
|
1086
|
+
throw new Error(response.error ?? "Failed to reset index");
|
|
1087
|
+
}
|
|
1088
|
+
return response;
|
|
1089
|
+
});
|
|
1090
|
+
const loadBackends = async () => run(async () => {
|
|
1091
|
+
const response = await client.backends();
|
|
1092
|
+
backends.value = response;
|
|
1093
|
+
return response;
|
|
1094
|
+
});
|
|
1095
|
+
const clearIndex = async () => run(async () => {
|
|
1096
|
+
const response = await client.clearIndex();
|
|
1097
|
+
const mutation = { ok: response.ok };
|
|
1098
|
+
lastMutation.value = mutation;
|
|
1099
|
+
return mutation;
|
|
1100
|
+
});
|
|
1101
|
+
const resetState = () => {
|
|
1102
|
+
backends.value = null;
|
|
1103
|
+
error.value = null;
|
|
1104
|
+
isLoading.value = false;
|
|
1105
|
+
lastMutation.value = null;
|
|
1106
|
+
};
|
|
1107
|
+
return {
|
|
1108
|
+
backends,
|
|
1109
|
+
clearIndex,
|
|
1110
|
+
createDocument,
|
|
1111
|
+
deleteDocument,
|
|
1112
|
+
error,
|
|
1113
|
+
isLoading,
|
|
1114
|
+
lastMutation,
|
|
1115
|
+
loadBackends,
|
|
1116
|
+
reseed,
|
|
1117
|
+
reset,
|
|
1118
|
+
resetState
|
|
1119
|
+
};
|
|
1120
|
+
};
|
|
1121
|
+
|
|
784
1122
|
// src/vue/ai/useRAGSearch.ts
|
|
785
|
-
import { ref as
|
|
1123
|
+
import { ref as ref6 } from "vue";
|
|
786
1124
|
var useRAGSearch = (path) => {
|
|
787
1125
|
const client = createRAGClient({ path });
|
|
788
|
-
const results =
|
|
789
|
-
const error =
|
|
790
|
-
const isSearching =
|
|
1126
|
+
const results = ref6([]);
|
|
1127
|
+
const error = ref6(null);
|
|
1128
|
+
const isSearching = ref6(false);
|
|
1129
|
+
const hasSearched = ref6(false);
|
|
1130
|
+
const lastRequest = ref6(null);
|
|
791
1131
|
const search = async (input) => {
|
|
792
1132
|
isSearching.value = true;
|
|
793
1133
|
error.value = null;
|
|
1134
|
+
lastRequest.value = input;
|
|
794
1135
|
try {
|
|
795
1136
|
const nextResults = await client.search(input);
|
|
796
1137
|
results.value = nextResults;
|
|
1138
|
+
hasSearched.value = true;
|
|
797
1139
|
return nextResults;
|
|
798
1140
|
} catch (caught) {
|
|
799
1141
|
error.value = caught instanceof Error ? caught.message : String(caught);
|
|
@@ -802,21 +1144,47 @@ var useRAGSearch = (path) => {
|
|
|
802
1144
|
isSearching.value = false;
|
|
803
1145
|
}
|
|
804
1146
|
};
|
|
1147
|
+
const reset = () => {
|
|
1148
|
+
error.value = null;
|
|
1149
|
+
hasSearched.value = false;
|
|
1150
|
+
isSearching.value = false;
|
|
1151
|
+
lastRequest.value = null;
|
|
1152
|
+
results.value = [];
|
|
1153
|
+
};
|
|
805
1154
|
return {
|
|
806
1155
|
error,
|
|
1156
|
+
hasSearched,
|
|
807
1157
|
isSearching,
|
|
1158
|
+
lastRequest,
|
|
1159
|
+
reset,
|
|
808
1160
|
results,
|
|
809
1161
|
search
|
|
810
1162
|
};
|
|
811
1163
|
};
|
|
1164
|
+
|
|
1165
|
+
// src/vue/ai/useRAGSources.ts
|
|
1166
|
+
import { computed as computed2 } from "vue";
|
|
1167
|
+
var useRAGSources = (messages) => {
|
|
1168
|
+
const latestAssistantMessage = computed2(() => getLatestAssistantMessage(messages.value));
|
|
1169
|
+
const sources = computed2(() => getLatestRAGSources(messages.value));
|
|
1170
|
+
const sourceGroups = computed2(() => buildRAGSourceGroups(sources.value));
|
|
1171
|
+
const hasSources = computed2(() => sources.value.length > 0);
|
|
1172
|
+
return {
|
|
1173
|
+
hasSources,
|
|
1174
|
+
latestAssistantMessage,
|
|
1175
|
+
sourceGroups,
|
|
1176
|
+
sources
|
|
1177
|
+
};
|
|
1178
|
+
};
|
|
1179
|
+
|
|
812
1180
|
// src/vue/ai/useRAGStatus.ts
|
|
813
|
-
import { onMounted, ref as
|
|
1181
|
+
import { onMounted, ref as ref7 } from "vue";
|
|
814
1182
|
var useRAGStatus = (path, autoLoad = true) => {
|
|
815
1183
|
const client = createRAGClient({ path });
|
|
816
|
-
const status =
|
|
817
|
-
const capabilities =
|
|
818
|
-
const error =
|
|
819
|
-
const isLoading =
|
|
1184
|
+
const status = ref7();
|
|
1185
|
+
const capabilities = ref7();
|
|
1186
|
+
const error = ref7(null);
|
|
1187
|
+
const isLoading = ref7(autoLoad);
|
|
820
1188
|
const refresh = async () => {
|
|
821
1189
|
isLoading.value = true;
|
|
822
1190
|
error.value = null;
|
|
@@ -832,6 +1200,12 @@ var useRAGStatus = (path, autoLoad = true) => {
|
|
|
832
1200
|
isLoading.value = false;
|
|
833
1201
|
}
|
|
834
1202
|
};
|
|
1203
|
+
const reset = () => {
|
|
1204
|
+
capabilities.value = undefined;
|
|
1205
|
+
error.value = null;
|
|
1206
|
+
isLoading.value = false;
|
|
1207
|
+
status.value = undefined;
|
|
1208
|
+
};
|
|
835
1209
|
onMounted(() => {
|
|
836
1210
|
if (!autoLoad) {
|
|
837
1211
|
isLoading.value = false;
|
|
@@ -844,16 +1218,84 @@ var useRAGStatus = (path, autoLoad = true) => {
|
|
|
844
1218
|
error,
|
|
845
1219
|
isLoading,
|
|
846
1220
|
refresh,
|
|
1221
|
+
reset,
|
|
847
1222
|
status
|
|
848
1223
|
};
|
|
849
1224
|
};
|
|
1225
|
+
|
|
850
1226
|
// src/vue/ai/useRAGStream.ts
|
|
851
|
-
|
|
1227
|
+
import { computed as computed3 } from "vue";
|
|
1228
|
+
var useRAGStream = (path, conversationId) => {
|
|
1229
|
+
const stream = useAIStream(path, conversationId);
|
|
1230
|
+
const latestAssistantMessage = computed3(() => getLatestAssistantMessage(stream.messages.value));
|
|
1231
|
+
const sources = computed3(() => getLatestRAGSources(stream.messages.value));
|
|
1232
|
+
const sourceGroups = computed3(() => buildRAGSourceGroups(sources.value));
|
|
1233
|
+
const citations = computed3(() => buildRAGCitations(sources.value));
|
|
1234
|
+
const retrieval = computed3(() => buildRAGRetrievedState(stream.messages.value));
|
|
1235
|
+
const stage = computed3(() => resolveRAGStreamStage({
|
|
1236
|
+
error: stream.error.value,
|
|
1237
|
+
isStreaming: stream.isStreaming.value,
|
|
1238
|
+
messages: stream.messages.value
|
|
1239
|
+
}));
|
|
1240
|
+
const query = (content, attachments) => {
|
|
1241
|
+
stream.send(content, attachments);
|
|
1242
|
+
};
|
|
1243
|
+
const hasRetrieved = computed3(() => (retrieval.value?.sources.length ?? 0) > 0);
|
|
1244
|
+
const isRetrieving = computed3(() => stage.value === "submitting" || stage.value === "retrieved");
|
|
1245
|
+
const isAnswerStreaming = computed3(() => stage.value === "streaming");
|
|
1246
|
+
const isComplete = computed3(() => stage.value === "complete");
|
|
1247
|
+
const hasSources = computed3(() => sources.value.length > 0);
|
|
1248
|
+
return {
|
|
1249
|
+
...stream,
|
|
1250
|
+
citations,
|
|
1251
|
+
hasRetrieved,
|
|
1252
|
+
hasSources,
|
|
1253
|
+
isAnswerStreaming,
|
|
1254
|
+
isComplete,
|
|
1255
|
+
isRetrieving,
|
|
1256
|
+
latestAssistantMessage,
|
|
1257
|
+
query,
|
|
1258
|
+
retrieval,
|
|
1259
|
+
sourceGroups,
|
|
1260
|
+
sources,
|
|
1261
|
+
stage
|
|
1262
|
+
};
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1265
|
+
// src/vue/ai/useRAG.ts
|
|
1266
|
+
var useRAG = (path, options = {}) => {
|
|
1267
|
+
const search = useRAGSearch(path);
|
|
1268
|
+
const ingest = useRAGIngest(path);
|
|
1269
|
+
const status = useRAGStatus(path, options.autoLoadStatus ?? true);
|
|
1270
|
+
const documents = useRAGDocuments(path);
|
|
1271
|
+
const chunkPreview = useRAGChunkPreview(path);
|
|
1272
|
+
const index = useRAGIndexAdmin(path);
|
|
1273
|
+
const stream = useRAGStream(options.streamPath ?? path, options.conversationId);
|
|
1274
|
+
const sources = useRAGSources(stream.messages);
|
|
1275
|
+
const citations = useRAGCitations(sources.sources);
|
|
1276
|
+
return {
|
|
1277
|
+
citations,
|
|
1278
|
+
chunkPreview,
|
|
1279
|
+
documents,
|
|
1280
|
+
ingest,
|
|
1281
|
+
index,
|
|
1282
|
+
search,
|
|
1283
|
+
sources,
|
|
1284
|
+
status,
|
|
1285
|
+
stream
|
|
1286
|
+
};
|
|
1287
|
+
};
|
|
852
1288
|
export {
|
|
853
1289
|
useRAGStream,
|
|
854
1290
|
useRAGStatus,
|
|
1291
|
+
useRAGSources,
|
|
855
1292
|
useRAGSearch,
|
|
856
1293
|
useRAGIngest,
|
|
1294
|
+
useRAGIndexAdmin,
|
|
1295
|
+
useRAGDocuments,
|
|
1296
|
+
useRAGCitations,
|
|
1297
|
+
useRAGChunkPreview,
|
|
1298
|
+
useRAG,
|
|
857
1299
|
useAIStream,
|
|
858
1300
|
AIStreamKey
|
|
859
1301
|
};
|
package/dist/angular/index.js
CHANGED
|
@@ -169198,7 +169198,7 @@ ${registrations}
|
|
|
169198
169198
|
({ tsLibDir } = cached);
|
|
169199
169199
|
cached.lastUsed = Date.now();
|
|
169200
169200
|
} else {
|
|
169201
|
-
const tsPath = __require.resolve("
|
|
169201
|
+
const tsPath = __require.resolve("typescript");
|
|
169202
169202
|
const tsRootDir = dirname(tsPath);
|
|
169203
169203
|
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve(tsRootDir, "lib");
|
|
169204
169204
|
const config = readConfiguration("./tsconfig.json");
|
|
@@ -181950,5 +181950,5 @@ export {
|
|
|
181950
181950
|
DeferErrorTemplateDirective
|
|
181951
181951
|
};
|
|
181952
181952
|
|
|
181953
|
-
//# debugId=
|
|
181953
|
+
//# debugId=62B3E18205C5708564756E2164756E21
|
|
181954
181954
|
//# sourceMappingURL=index.js.map
|