@trustgraph/react-state 0.2.0 → 0.3.0
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/README.md +6 -372
- package/dist/index.cjs +15 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +15 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/state/collections.d.ts.map +1 -1
- package/dist/state/inference.d.ts.map +1 -1
- package/dist/state/processing.d.ts +2 -2
- package/dist/state/vector-search.d.ts.map +1 -1
- package/package.json +13 -24
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { SocketProvider, SocketContext, ConnectionStateContext, } from "@trustgraph/react-provider";
|
|
2
2
|
export type { SocketProviderProps } from "@trustgraph/react-provider";
|
|
3
|
-
export type { BaseApi, Triple, Value, ConnectionState } from "@trustgraph/client";
|
|
3
|
+
export type { BaseApi, Triple, Value, ConnectionState, } from "@trustgraph/client";
|
|
4
4
|
export { NotificationProvider } from "./NotificationProvider";
|
|
5
5
|
export type { NotificationProviderProps } from "./NotificationProvider";
|
|
6
6
|
export type { NotificationHandler } from "./types";
|
|
@@ -27,7 +27,7 @@ export { useGraphEmbeddings } from "./state/graph-embeddings";
|
|
|
27
27
|
export { useVectorSearch } from "./state/vector-search";
|
|
28
28
|
export { useEntityDetail } from "./state/entity-query";
|
|
29
29
|
export { useInference } from "./state/inference";
|
|
30
|
-
export type { GraphRagOptions, GraphRagResult, AgentCallbacks } from "./state/inference";
|
|
30
|
+
export type { GraphRagOptions, GraphRagResult, AgentCallbacks, } from "./state/inference";
|
|
31
31
|
export { useChatSession, useChat } from "./state/chat-session";
|
|
32
32
|
export { useStructuredQuery } from "./state/structured-query";
|
|
33
33
|
export { useObjectsQuery } from "./state/objects-query";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,aAAa,EACb,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,aAAa,EACb,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,YAAY,EACV,OAAO,EACP,MAAM,EACN,KAAK,EACL,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACxE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,YAAY,EAAE,SAAS,EAA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C;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACL,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGxE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACzE,YAAY,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -2666,7 +2666,7 @@ const useGraphSubgraph = (entityUri, flowId, collection) => {
|
|
|
2666
2666
|
},
|
|
2667
2667
|
onSuccess: (newGraph) => {
|
|
2668
2668
|
// Update the cache with the new graph data
|
|
2669
|
-
queryClient.setQueryData(["graph-subgraph", { entityUri, flowId }], newGraph);
|
|
2669
|
+
queryClient.setQueryData(["graph-subgraph", { entityUri, flowId, collection }], newGraph);
|
|
2670
2670
|
},
|
|
2671
2671
|
onError: (err) => {
|
|
2672
2672
|
console.log("Graph update error:", err);
|
|
@@ -2683,7 +2683,7 @@ const useGraphSubgraph = (entityUri, flowId, collection) => {
|
|
|
2683
2683
|
},
|
|
2684
2684
|
onSuccess: (newGraph) => {
|
|
2685
2685
|
// Update the cache with the new graph data
|
|
2686
|
-
queryClient.setQueryData(["graph-subgraph", { entityUri, flowId }], newGraph);
|
|
2686
|
+
queryClient.setQueryData(["graph-subgraph", { entityUri, flowId, collection }], newGraph);
|
|
2687
2687
|
},
|
|
2688
2688
|
onError: (err) => {
|
|
2689
2689
|
console.log("Relationship navigation error:", err);
|
|
@@ -3236,7 +3236,12 @@ const useVectorSearch = () => {
|
|
|
3236
3236
|
setSearchParams(null);
|
|
3237
3237
|
return;
|
|
3238
3238
|
}
|
|
3239
|
-
setSearchParams({
|
|
3239
|
+
setSearchParams({
|
|
3240
|
+
flow: flow || "default",
|
|
3241
|
+
term,
|
|
3242
|
+
limit: limit || 10,
|
|
3243
|
+
collection,
|
|
3244
|
+
});
|
|
3240
3245
|
};
|
|
3241
3246
|
// Return vector search state and operations for use in components
|
|
3242
3247
|
return {
|
|
@@ -3315,7 +3320,9 @@ const useInference = () => {
|
|
|
3315
3320
|
const graphRagMutation = useMutation({
|
|
3316
3321
|
mutationFn: async ({ input, options, collection, }) => {
|
|
3317
3322
|
// Execute Graph RAG request
|
|
3318
|
-
const response = await socket
|
|
3323
|
+
const response = await socket
|
|
3324
|
+
.flow(flowId)
|
|
3325
|
+
.graphRag(input, options || {}, collection);
|
|
3319
3326
|
// Get embeddings for entity discovery
|
|
3320
3327
|
const embeddings = await socket.flow(flowId).embeddings(input);
|
|
3321
3328
|
// Query graph embeddings to find entities
|
|
@@ -3353,7 +3360,9 @@ const useInference = () => {
|
|
|
3353
3360
|
callbacks?.onError?.(error);
|
|
3354
3361
|
reject(new Error(error));
|
|
3355
3362
|
};
|
|
3356
|
-
socket
|
|
3363
|
+
socket
|
|
3364
|
+
.flow(flowId)
|
|
3365
|
+
.agent(input, onThink, onObserve, onAnswer, onError);
|
|
3357
3366
|
});
|
|
3358
3367
|
},
|
|
3359
3368
|
});
|
|
@@ -3790,9 +3799,7 @@ const useCollections = () => {
|
|
|
3790
3799
|
const deleteCollectionsMutation = useMutation({
|
|
3791
3800
|
mutationFn: ({ collections, onSuccess }) => {
|
|
3792
3801
|
// Execute deletion requests in parallel for all collection IDs
|
|
3793
|
-
return Promise.all(collections.map((collection) => socket
|
|
3794
|
-
.collectionManagement()
|
|
3795
|
-
.deleteCollection(collection))).then(() => {
|
|
3802
|
+
return Promise.all(collections.map((collection) => socket.collectionManagement().deleteCollection(collection))).then(() => {
|
|
3796
3803
|
// Execute success callback if provided
|
|
3797
3804
|
if (onSuccess)
|
|
3798
3805
|
onSuccess();
|