@trustgraph/react-state 1.4.2 → 1.4.4
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/index.cjs +147 -111
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +147 -112
- package/dist/index.esm.js.map +1 -1
- package/dist/state/chat-session.d.ts +6 -2
- package/dist/state/chat-session.d.ts.map +1 -1
- package/dist/state/document-embeddings-query.d.ts +27 -0
- package/dist/state/document-embeddings-query.d.ts.map +1 -0
- package/dist/state/embeddings.d.ts.map +1 -1
- package/dist/state/entity-query.d.ts +6 -2
- package/dist/state/entity-query.d.ts.map +1 -1
- package/dist/state/graph-embeddings.d.ts +4 -6
- package/dist/state/graph-embeddings.d.ts.map +1 -1
- package/dist/state/graph-query.d.ts +6 -2
- package/dist/state/graph-query.d.ts.map +1 -1
- package/dist/state/inference.d.ts +3 -1
- package/dist/state/inference.d.ts.map +1 -1
- package/dist/state/nlp-query.d.ts +3 -1
- package/dist/state/nlp-query.d.ts.map +1 -1
- package/dist/state/row-embeddings-query.d.ts +7 -6
- package/dist/state/row-embeddings-query.d.ts.map +1 -1
- package/dist/state/rows-query.d.ts +3 -1
- package/dist/state/rows-query.d.ts.map +1 -1
- package/dist/state/triples.d.ts.map +1 -1
- package/dist/state/vector-search.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export type { GraphRagOptions, GraphRagResult, GraphRagCallbacks, TextCompletion
|
|
|
31
31
|
export { useChatSession, useChat } from "./state/chat-session";
|
|
32
32
|
export { useStructuredQuery } from "./state/structured-query";
|
|
33
33
|
export { useRowEmbeddingsQuery } from "./state/row-embeddings-query";
|
|
34
|
+
export { useDocumentEmbeddingsQuery } from "./state/document-embeddings-query";
|
|
34
35
|
export { useRowsQuery } from "./state/rows-query";
|
|
35
36
|
export { useEmbeddings } from "./state/embeddings";
|
|
36
37
|
export { useCollections } from "./state/collections";
|
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,EACV,OAAO,EACP,MAAM,EACN,IAAI,EACJ,OAAO,EACP,SAAS,EACT,WAAW,EACX,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,kBAAkB,GACnB,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,EAAE,MAAM,cAAc,CAAC;AAC9C,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AAM,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,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACrF,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,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC/E,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACzE,YAAY,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -925,17 +925,19 @@ const useTriples = ({ flow, s, p, o, limit, collection }) => {
|
|
|
925
925
|
const notify = useNotification();
|
|
926
926
|
// Settings for default collection
|
|
927
927
|
const { settings } = useSettings();
|
|
928
|
-
|
|
929
|
-
|
|
928
|
+
// Session state for default flow ID
|
|
929
|
+
const sessionFlowId = useSessionStore((state) => state.flowId);
|
|
930
|
+
// Use explicit param if provided, otherwise fall back to session state
|
|
931
|
+
const effectiveFlow = flow ?? sessionFlowId;
|
|
930
932
|
/**
|
|
931
933
|
* Query for fetching all token costs
|
|
932
934
|
* Uses React Query for caching and background refetching
|
|
933
935
|
*/
|
|
934
936
|
const query = useQuery({
|
|
935
|
-
queryKey: ["triples", { flow, s, p, o, limit }],
|
|
937
|
+
queryKey: ["triples", { flow: effectiveFlow, s, p, o, limit }],
|
|
936
938
|
queryFn: () => {
|
|
937
939
|
return socket
|
|
938
|
-
.flow(
|
|
940
|
+
.flow(effectiveFlow)
|
|
939
941
|
.triplesQuery(s, p, o, limit, collection || settings.collection)
|
|
940
942
|
.then((x) => {
|
|
941
943
|
if (x["error"]) {
|
|
@@ -1301,13 +1303,17 @@ const updateSubgraphByRelationship = (socket, selectedNodeId, relationshipUri, d
|
|
|
1301
1303
|
* Custom hook for managing graph visualization operations using React Query
|
|
1302
1304
|
* Provides functionality for fetching and updating graph subgraphs
|
|
1303
1305
|
* @param entityUri - The URI of the entity to build the graph around
|
|
1304
|
-
* @param
|
|
1306
|
+
* @param flow - Optional flow ID to use for the query (defaults to session state)
|
|
1305
1307
|
* @param collection - The collection to query
|
|
1306
1308
|
* @returns {Object} Graph state and operations
|
|
1307
1309
|
*/
|
|
1308
|
-
const useGraphSubgraph = (entityUri,
|
|
1310
|
+
const useGraphSubgraph = ({ entityUri, flow, collection, }) => {
|
|
1309
1311
|
// WebSocket connection for communicating with the graph service
|
|
1310
1312
|
const socket = useSocket();
|
|
1313
|
+
// Session state for default flow ID
|
|
1314
|
+
const sessionFlowId = useSessionStore((state) => state.flowId);
|
|
1315
|
+
// Use explicit param if provided, otherwise fall back to session state
|
|
1316
|
+
const effectiveFlow = flow ?? sessionFlowId;
|
|
1311
1317
|
const addActivity = useProgressStateStore((state) => state.addActivity);
|
|
1312
1318
|
const removeActivity = useProgressStateStore((state) => state.removeActivity);
|
|
1313
1319
|
// Hook for displaying user notifications
|
|
@@ -1319,29 +1325,29 @@ const useGraphSubgraph = (entityUri, flowId, collection) => {
|
|
|
1319
1325
|
* Uses React Query for caching and background refetching
|
|
1320
1326
|
*/
|
|
1321
1327
|
const query = useQuery({
|
|
1322
|
-
queryKey: ["graph-subgraph", { entityUri,
|
|
1328
|
+
queryKey: ["graph-subgraph", { entityUri, flow: effectiveFlow, collection }],
|
|
1323
1329
|
queryFn: async () => {
|
|
1324
1330
|
if (!entityUri) {
|
|
1325
1331
|
throw new Error("Entity URI is required");
|
|
1326
1332
|
}
|
|
1327
1333
|
const sg = createSubgraph();
|
|
1328
1334
|
// Use the existing updateSubgraph utility function for initial load
|
|
1329
|
-
const api = socket.flow(
|
|
1335
|
+
const api = socket.flow(effectiveFlow);
|
|
1330
1336
|
return updateSubgraph(api, entityUri, sg, addActivity, removeActivity, collection);
|
|
1331
1337
|
},
|
|
1332
|
-
enabled: !!entityUri && !!
|
|
1338
|
+
enabled: !!entityUri && !!effectiveFlow, // Only run query if both entityUri and effectiveFlow are available
|
|
1333
1339
|
});
|
|
1334
1340
|
/**
|
|
1335
1341
|
* Mutation for updating the graph subgraph when nodes are clicked
|
|
1336
1342
|
*/
|
|
1337
1343
|
const updateMutation = useMutation({
|
|
1338
1344
|
mutationFn: async ({ nodeId, currentGraph, }) => {
|
|
1339
|
-
const api = socket.flow(
|
|
1345
|
+
const api = socket.flow(effectiveFlow);
|
|
1340
1346
|
return updateSubgraph(api, nodeId, currentGraph, addActivity, removeActivity);
|
|
1341
1347
|
},
|
|
1342
1348
|
onSuccess: (newGraph) => {
|
|
1343
1349
|
// Update the cache with the new graph data
|
|
1344
|
-
queryClient.setQueryData(["graph-subgraph", { entityUri,
|
|
1350
|
+
queryClient.setQueryData(["graph-subgraph", { entityUri, flow: effectiveFlow, collection }], newGraph);
|
|
1345
1351
|
},
|
|
1346
1352
|
onError: (err) => {
|
|
1347
1353
|
console.log("Graph update error:", err);
|
|
@@ -1353,12 +1359,12 @@ const useGraphSubgraph = (entityUri, flowId, collection) => {
|
|
|
1353
1359
|
*/
|
|
1354
1360
|
const relationshipNavigationMutation = useMutation({
|
|
1355
1361
|
mutationFn: async ({ selectedNodeId, relationshipUri, direction, currentGraph, }) => {
|
|
1356
|
-
const api = socket.flow(
|
|
1362
|
+
const api = socket.flow(effectiveFlow);
|
|
1357
1363
|
return updateSubgraphByRelationship(api, selectedNodeId, relationshipUri, direction, currentGraph, addActivity, removeActivity, collection);
|
|
1358
1364
|
},
|
|
1359
1365
|
onSuccess: (newGraph) => {
|
|
1360
1366
|
// Update the cache with the new graph data
|
|
1361
|
-
queryClient.setQueryData(["graph-subgraph", { entityUri,
|
|
1367
|
+
queryClient.setQueryData(["graph-subgraph", { entityUri, flow: effectiveFlow, collection }], newGraph);
|
|
1362
1368
|
},
|
|
1363
1369
|
onError: (err) => {
|
|
1364
1370
|
console.log("Relationship navigation error:", err);
|
|
@@ -1392,51 +1398,36 @@ const useGraphSubgraph = (entityUri, flowId, collection) => {
|
|
|
1392
1398
|
};
|
|
1393
1399
|
|
|
1394
1400
|
/**
|
|
1395
|
-
* Custom hook for
|
|
1396
|
-
*
|
|
1397
|
-
* for AI models
|
|
1398
|
-
* @returns {Object} Token cost state and operations
|
|
1401
|
+
* Custom hook for querying graph embeddings
|
|
1402
|
+
* Finds graph entities similar to the provided embedding vectors
|
|
1399
1403
|
*/
|
|
1400
|
-
const useGraphEmbeddings = ({ flow, vecs, limit, collection }) => {
|
|
1401
|
-
// WebSocket connection for communicating with the configuration service
|
|
1404
|
+
const useGraphEmbeddings = ({ flow, vecs, limit = 10, collection }) => {
|
|
1402
1405
|
const socket = useSocket();
|
|
1403
|
-
// Hook for displaying user notifications
|
|
1404
1406
|
const notify = useNotification();
|
|
1405
|
-
// Settings for default collection
|
|
1406
1407
|
const { settings } = useSettings();
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
* Query for fetching graph embeddings
|
|
1411
|
-
* Uses React Query for caching and background refetching
|
|
1412
|
-
*/
|
|
1408
|
+
const sessionFlowId = useSessionStore((state) => state.flowId);
|
|
1409
|
+
const effectiveFlow = flow ?? sessionFlowId;
|
|
1410
|
+
const effectiveCollection = collection ?? settings.collection;
|
|
1413
1411
|
const query = useQuery({
|
|
1414
|
-
queryKey: ["graph-embeddings", { vecs, limit }],
|
|
1412
|
+
queryKey: ["graph-embeddings", { flow: effectiveFlow, vecs, limit, collection: effectiveCollection }],
|
|
1413
|
+
enabled: !!vecs && vecs.length > 0 && !!effectiveFlow,
|
|
1415
1414
|
queryFn: () => {
|
|
1416
1415
|
return socket
|
|
1417
|
-
.flow(
|
|
1418
|
-
.graphEmbeddingsQuery(vecs, limit,
|
|
1419
|
-
.then((x) => {
|
|
1420
|
-
return x;
|
|
1421
|
-
})
|
|
1416
|
+
.flow(effectiveFlow)
|
|
1417
|
+
.graphEmbeddingsQuery(vecs, limit, effectiveCollection)
|
|
1422
1418
|
.catch((err) => {
|
|
1423
|
-
console.log("Error:", err);
|
|
1424
1419
|
const message = err instanceof Error ? err.message : String(err);
|
|
1425
1420
|
notify.error(message);
|
|
1426
1421
|
throw err;
|
|
1427
1422
|
});
|
|
1428
1423
|
},
|
|
1429
1424
|
});
|
|
1430
|
-
// Show loading indicators for long-running operations
|
|
1431
1425
|
useActivity(query.isLoading, "Loading graph embeddings");
|
|
1432
|
-
// Return token cost state and operations for use in components
|
|
1433
1426
|
return {
|
|
1434
|
-
// Token cost query state
|
|
1435
1427
|
graphEmbeddings: query.data,
|
|
1436
1428
|
isLoading: query.isLoading,
|
|
1437
1429
|
isError: query.isError,
|
|
1438
1430
|
error: query.error,
|
|
1439
|
-
// Manual refetch function
|
|
1440
1431
|
refetch: query.refetch,
|
|
1441
1432
|
};
|
|
1442
1433
|
};
|
|
@@ -1620,6 +1611,8 @@ const useVectorSearch = () => {
|
|
|
1620
1611
|
const removeActivity = useProgressStateStore((state) => state.removeActivity);
|
|
1621
1612
|
// Hook for displaying user notifications
|
|
1622
1613
|
const notify = useNotification();
|
|
1614
|
+
// Session state for default flow ID
|
|
1615
|
+
const sessionFlowId = useSessionStore((state) => state.flowId);
|
|
1623
1616
|
// State to track current search parameters
|
|
1624
1617
|
const [searchParams, setSearchParams] = useState(null);
|
|
1625
1618
|
/**
|
|
@@ -1631,7 +1624,7 @@ const useVectorSearch = () => {
|
|
|
1631
1624
|
enabled: !!searchParams?.term,
|
|
1632
1625
|
queryFn: () => {
|
|
1633
1626
|
const { flow, term, limit, collection } = searchParams;
|
|
1634
|
-
return vectorSearch(socket, flow
|
|
1627
|
+
return vectorSearch(socket, flow ?? sessionFlowId, addActivity, removeActivity, term, collection, limit)
|
|
1635
1628
|
.then((x) => {
|
|
1636
1629
|
if (x["error"]) {
|
|
1637
1630
|
console.log("Error:", x);
|
|
@@ -1653,7 +1646,7 @@ const useVectorSearch = () => {
|
|
|
1653
1646
|
return;
|
|
1654
1647
|
}
|
|
1655
1648
|
setSearchParams({
|
|
1656
|
-
flow: flow
|
|
1649
|
+
flow: flow ?? sessionFlowId,
|
|
1657
1650
|
term,
|
|
1658
1651
|
limit: limit || 10,
|
|
1659
1652
|
collection,
|
|
@@ -1677,13 +1670,17 @@ const useVectorSearch = () => {
|
|
|
1677
1670
|
* Custom hook for managing entity detail operations using React Query
|
|
1678
1671
|
* Provides functionality for fetching entity details and related triples
|
|
1679
1672
|
* @param entityUri - The URI of the entity to fetch details for
|
|
1680
|
-
* @param
|
|
1673
|
+
* @param flow - Optional flow ID to use for the query (defaults to session state)
|
|
1681
1674
|
* @param collection - The collection to query
|
|
1682
1675
|
* @returns {Object} Entity detail state and operations
|
|
1683
1676
|
*/
|
|
1684
|
-
const useEntityDetail = (entityUri,
|
|
1677
|
+
const useEntityDetail = ({ entityUri, flow, collection, }) => {
|
|
1685
1678
|
// WebSocket connection for communicating with the graph service
|
|
1686
1679
|
const socket = useSocket();
|
|
1680
|
+
// Session state for default flow ID
|
|
1681
|
+
const sessionFlowId = useSessionStore((state) => state.flowId);
|
|
1682
|
+
// Use explicit param if provided, otherwise fall back to session state
|
|
1683
|
+
const effectiveFlow = flow ?? sessionFlowId;
|
|
1687
1684
|
const addActivity = useProgressStateStore((state) => state.addActivity);
|
|
1688
1685
|
const removeActivity = useProgressStateStore((state) => state.removeActivity);
|
|
1689
1686
|
// Hook for displaying user notifications
|
|
@@ -1693,17 +1690,17 @@ const useEntityDetail = (entityUri, flowId, collection) => {
|
|
|
1693
1690
|
* Uses React Query for caching and background refetching
|
|
1694
1691
|
*/
|
|
1695
1692
|
const query = useQuery({
|
|
1696
|
-
queryKey: ["entity-detail", { entityUri,
|
|
1693
|
+
queryKey: ["entity-detail", { entityUri, flow: effectiveFlow, collection }],
|
|
1697
1694
|
queryFn: async () => {
|
|
1698
1695
|
if (!entityUri) {
|
|
1699
1696
|
throw new Error("Entity URI is required");
|
|
1700
1697
|
}
|
|
1701
1698
|
// Use the existing getTriples utility function
|
|
1702
|
-
const api = socket.flow(
|
|
1699
|
+
const api = socket.flow(effectiveFlow);
|
|
1703
1700
|
return getTriples(api, entityUri, addActivity, removeActivity, undefined, collection);
|
|
1704
1701
|
},
|
|
1705
|
-
// Only run query if both entityUri and
|
|
1706
|
-
enabled: !!entityUri && !!
|
|
1702
|
+
// Only run query if both entityUri and effectiveFlow are available
|
|
1703
|
+
enabled: !!entityUri && !!effectiveFlow,
|
|
1707
1704
|
});
|
|
1708
1705
|
// Show loading indicators for long-running operations
|
|
1709
1706
|
useActivity(query.isLoading, entityUri ? `Knowledge graph search: ${entityUri}` : "Loading entity");
|
|
@@ -1727,9 +1724,11 @@ const useEntityDetail = (entityUri, flowId, collection) => {
|
|
|
1727
1724
|
* Hook providing low-level access to LLM inference services
|
|
1728
1725
|
* No conversation state or side effects - just the API calls
|
|
1729
1726
|
*/
|
|
1730
|
-
const useInference = () => {
|
|
1727
|
+
const useInference = ({ flow } = {}) => {
|
|
1731
1728
|
const socket = useSocket();
|
|
1732
|
-
const
|
|
1729
|
+
const sessionFlowId = useSessionStore((state) => state.flowId);
|
|
1730
|
+
// Use explicit param if provided, otherwise fall back to session state
|
|
1731
|
+
const effectiveFlow = flow ?? sessionFlowId;
|
|
1733
1732
|
/**
|
|
1734
1733
|
* Graph RAG inference with entity discovery
|
|
1735
1734
|
*/
|
|
@@ -1751,15 +1750,15 @@ const useInference = () => {
|
|
|
1751
1750
|
reject(new Error(error));
|
|
1752
1751
|
};
|
|
1753
1752
|
socket
|
|
1754
|
-
.flow(
|
|
1753
|
+
.flow(effectiveFlow)
|
|
1755
1754
|
.graphRagStreaming(input, onChunk, onError, options, collection);
|
|
1756
1755
|
})
|
|
1757
|
-
: await socket.flow(
|
|
1756
|
+
: await socket.flow(effectiveFlow).graphRag(input, options || {}, collection);
|
|
1758
1757
|
// Get embeddings for entity discovery
|
|
1759
|
-
const embeddings = await socket.flow(
|
|
1758
|
+
const embeddings = await socket.flow(effectiveFlow).embeddings(input);
|
|
1760
1759
|
// Query graph embeddings to find entities
|
|
1761
1760
|
const entities = await socket
|
|
1762
|
-
.flow(
|
|
1761
|
+
.flow(effectiveFlow)
|
|
1763
1762
|
.graphEmbeddingsQuery(embeddings, options?.entityLimit || 10, collection);
|
|
1764
1763
|
return { response, entities };
|
|
1765
1764
|
},
|
|
@@ -1785,10 +1784,10 @@ const useInference = () => {
|
|
|
1785
1784
|
reject(new Error(error));
|
|
1786
1785
|
};
|
|
1787
1786
|
socket
|
|
1788
|
-
.flow(
|
|
1787
|
+
.flow(effectiveFlow)
|
|
1789
1788
|
.textCompletionStreaming(systemPrompt, input, onChunk, onError);
|
|
1790
1789
|
})
|
|
1791
|
-
: await socket.flow(
|
|
1790
|
+
: await socket.flow(effectiveFlow).textCompletion(systemPrompt, input);
|
|
1792
1791
|
},
|
|
1793
1792
|
});
|
|
1794
1793
|
/**
|
|
@@ -1816,7 +1815,7 @@ const useInference = () => {
|
|
|
1816
1815
|
reject(new Error(error));
|
|
1817
1816
|
};
|
|
1818
1817
|
socket
|
|
1819
|
-
.flow(
|
|
1818
|
+
.flow(effectiveFlow)
|
|
1820
1819
|
.agent(input, onThink, onObserve, onAnswer, onError);
|
|
1821
1820
|
});
|
|
1822
1821
|
},
|
|
@@ -1836,7 +1835,7 @@ const useInference = () => {
|
|
|
1836
1835
|
* Combines conversation state with inference services
|
|
1837
1836
|
* Handles routing, progress tracking, entity management, and notifications
|
|
1838
1837
|
*/
|
|
1839
|
-
const useChatSession = () => {
|
|
1838
|
+
const useChatSession = ({ flow } = {}) => {
|
|
1840
1839
|
const socket = useSocket();
|
|
1841
1840
|
const notify = useNotification();
|
|
1842
1841
|
// Conversation state
|
|
@@ -1848,12 +1847,14 @@ const useChatSession = () => {
|
|
|
1848
1847
|
const addActivity = useProgressStateStore((state) => state.addActivity);
|
|
1849
1848
|
const removeActivity = useProgressStateStore((state) => state.removeActivity);
|
|
1850
1849
|
// Session and workbench state
|
|
1851
|
-
const
|
|
1850
|
+
const sessionFlowId = useSessionStore((state) => state.flowId);
|
|
1852
1851
|
const setEntities = useWorkbenchStateStore((state) => state.setEntities);
|
|
1852
|
+
// Use explicit param if provided, otherwise fall back to session state
|
|
1853
|
+
const effectiveFlow = flow ?? sessionFlowId;
|
|
1853
1854
|
// Settings for GraphRAG configuration
|
|
1854
1855
|
const { settings } = useSettings();
|
|
1855
1856
|
// Inference services
|
|
1856
|
-
const inference = useInference();
|
|
1857
|
+
const inference = useInference({ flow });
|
|
1857
1858
|
/**
|
|
1858
1859
|
* Graph RAG chat handling with entity discovery
|
|
1859
1860
|
*/
|
|
@@ -1898,7 +1899,7 @@ const useChatSession = () => {
|
|
|
1898
1899
|
addActivity(labelActivity);
|
|
1899
1900
|
try {
|
|
1900
1901
|
const triples = await socket
|
|
1901
|
-
.flow(
|
|
1902
|
+
.flow(effectiveFlow)
|
|
1902
1903
|
.triplesQuery(entity, { t: "i", i: RDFS_LABEL }, undefined, 1, settings.collection);
|
|
1903
1904
|
removeActivity(labelActivity);
|
|
1904
1905
|
return triples;
|
|
@@ -2154,69 +2155,97 @@ const useStructuredQuery = () => {
|
|
|
2154
2155
|
};
|
|
2155
2156
|
|
|
2156
2157
|
// @ts-nocheck
|
|
2157
|
-
// React Query hooks for data fetching and mutation management
|
|
2158
2158
|
/**
|
|
2159
|
-
* Custom hook for
|
|
2160
|
-
*
|
|
2161
|
-
* First converts query text to embeddings, then searches for similar records
|
|
2159
|
+
* Custom hook for querying row embeddings using vectors.
|
|
2160
|
+
* Searches for similar records in structured data indexes.
|
|
2162
2161
|
*/
|
|
2163
|
-
const useRowEmbeddingsQuery = () => {
|
|
2164
|
-
// Socket connection for API calls
|
|
2162
|
+
const useRowEmbeddingsQuery = ({ flow } = {}) => {
|
|
2165
2163
|
const socket = useSocket();
|
|
2166
2164
|
const connectionState = useConnectionState();
|
|
2167
|
-
// Notification system for user feedback
|
|
2168
2165
|
const notify = useNotification();
|
|
2169
|
-
|
|
2170
|
-
const flowId = useSessionStore((state) => state.flowId);
|
|
2171
|
-
// Settings for default collection
|
|
2166
|
+
const sessionFlowId = useSessionStore((state) => state.flowId);
|
|
2172
2167
|
const { settings } = useSettings();
|
|
2173
|
-
|
|
2168
|
+
const effectiveFlow = flow ?? sessionFlowId;
|
|
2174
2169
|
const isSocketReady = connectionState?.status === "authenticated" ||
|
|
2175
2170
|
connectionState?.status === "unauthenticated";
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
mutationFn: async ({ query, schemaName, collection, indexName, limit, }) => {
|
|
2171
|
+
const mutation = useMutation({
|
|
2172
|
+
mutationFn: async ({ vectors, schemaName, collection, indexName, limit = 10, }) => {
|
|
2179
2173
|
if (!isSocketReady) {
|
|
2180
2174
|
throw new Error("Socket connection not ready");
|
|
2181
2175
|
}
|
|
2182
|
-
|
|
2183
|
-
// First, get embeddings for the query text
|
|
2184
|
-
const vectors = await flow.embeddings(query);
|
|
2185
|
-
// Then query row embeddings with those vectors
|
|
2186
|
-
return flow.rowEmbeddingsQuery(vectors, schemaName, collection || settings.collection, indexName, limit || 10);
|
|
2176
|
+
return socket.flow(effectiveFlow).rowEmbeddingsQuery(vectors, schemaName, collection ?? settings.collection, indexName, limit);
|
|
2187
2177
|
},
|
|
2188
2178
|
onError: (err) => {
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
? err.message
|
|
2192
|
-
: err?.toString() || "Unknown error";
|
|
2193
|
-
notify.error(`Row embeddings query failed: ${errorMessage}`);
|
|
2179
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
2180
|
+
notify.error(`Row embeddings query failed: ${message}`);
|
|
2194
2181
|
},
|
|
2195
2182
|
onSuccess: (data) => {
|
|
2196
|
-
|
|
2197
|
-
|
|
2183
|
+
const count = data?.length ?? 0;
|
|
2184
|
+
if (count > 0) {
|
|
2185
|
+
notify.success(`Found ${count} matching record${count !== 1 ? "s" : ""}`);
|
|
2198
2186
|
}
|
|
2199
2187
|
else {
|
|
2200
2188
|
notify.info("No matching records found");
|
|
2201
2189
|
}
|
|
2202
2190
|
},
|
|
2203
2191
|
});
|
|
2204
|
-
|
|
2205
|
-
useActivity(rowEmbeddingsQueryMutation.isPending, "Executing row embeddings query");
|
|
2206
|
-
// Return the public API for the hook
|
|
2192
|
+
useActivity(mutation.isPending, "Querying row embeddings");
|
|
2207
2193
|
return {
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2194
|
+
executeQuery: mutation.mutate,
|
|
2195
|
+
executeQueryAsync: mutation.mutateAsync,
|
|
2196
|
+
isExecuting: mutation.isPending,
|
|
2197
|
+
error: mutation.error,
|
|
2198
|
+
matches: mutation.data ?? [],
|
|
2199
|
+
hasResults: (mutation.data?.length ?? 0) > 0,
|
|
2200
|
+
reset: mutation.reset,
|
|
2201
|
+
isReady: isSocketReady,
|
|
2202
|
+
};
|
|
2203
|
+
};
|
|
2204
|
+
|
|
2205
|
+
// @ts-nocheck
|
|
2206
|
+
/**
|
|
2207
|
+
* Custom hook for querying document chunks using vectors.
|
|
2208
|
+
* Searches for document chunks with similar embeddings.
|
|
2209
|
+
*/
|
|
2210
|
+
const useDocumentEmbeddingsQuery = ({ flow } = {}) => {
|
|
2211
|
+
const socket = useSocket();
|
|
2212
|
+
const connectionState = useConnectionState();
|
|
2213
|
+
const notify = useNotification();
|
|
2214
|
+
const sessionFlowId = useSessionStore((state) => state.flowId);
|
|
2215
|
+
const { settings } = useSettings();
|
|
2216
|
+
const effectiveFlow = flow ?? sessionFlowId;
|
|
2217
|
+
const isSocketReady = connectionState?.status === "authenticated" ||
|
|
2218
|
+
connectionState?.status === "unauthenticated";
|
|
2219
|
+
const mutation = useMutation({
|
|
2220
|
+
mutationFn: async ({ vectors, user, collection, limit = 10, }) => {
|
|
2221
|
+
if (!isSocketReady) {
|
|
2222
|
+
throw new Error("Socket connection not ready");
|
|
2223
|
+
}
|
|
2224
|
+
return socket.flow(effectiveFlow).documentEmbeddingsQuery(vectors, user ?? settings.user, collection ?? settings.collection, limit);
|
|
2225
|
+
},
|
|
2226
|
+
onError: (err) => {
|
|
2227
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
2228
|
+
notify.error(`Document embeddings query failed: ${message}`);
|
|
2229
|
+
},
|
|
2230
|
+
onSuccess: (data) => {
|
|
2231
|
+
const count = Array.isArray(data) ? data.length : 0;
|
|
2232
|
+
if (count > 0) {
|
|
2233
|
+
notify.success(`Found ${count} matching chunk${count !== 1 ? "s" : ""}`);
|
|
2234
|
+
}
|
|
2235
|
+
else {
|
|
2236
|
+
notify.info("No matching document chunks found");
|
|
2237
|
+
}
|
|
2238
|
+
},
|
|
2239
|
+
});
|
|
2240
|
+
useActivity(mutation.isPending, "Searching document chunks");
|
|
2241
|
+
return {
|
|
2242
|
+
executeQuery: mutation.mutate,
|
|
2243
|
+
executeQueryAsync: mutation.mutateAsync,
|
|
2244
|
+
isExecuting: mutation.isPending,
|
|
2245
|
+
error: mutation.error,
|
|
2246
|
+
results: mutation.data ?? [],
|
|
2247
|
+
hasResults: Array.isArray(mutation.data) && mutation.data.length > 0,
|
|
2248
|
+
reset: mutation.reset,
|
|
2220
2249
|
isReady: isSocketReady,
|
|
2221
2250
|
};
|
|
2222
2251
|
};
|
|
@@ -2226,14 +2255,16 @@ const useRowEmbeddingsQuery = () => {
|
|
|
2226
2255
|
* Custom hook for managing GraphQL rows queries
|
|
2227
2256
|
* Provides functionality for executing GraphQL queries against structured row data
|
|
2228
2257
|
*/
|
|
2229
|
-
const useRowsQuery = () => {
|
|
2258
|
+
const useRowsQuery = ({ flow } = {}) => {
|
|
2230
2259
|
// Socket connection for API calls
|
|
2231
2260
|
const socket = useSocket();
|
|
2232
2261
|
const connectionState = useConnectionState();
|
|
2233
2262
|
// Notification system for user feedback
|
|
2234
2263
|
const notify = useNotification();
|
|
2235
2264
|
// Session state for current flow ID
|
|
2236
|
-
const
|
|
2265
|
+
const sessionFlowId = useSessionStore((state) => state.flowId);
|
|
2266
|
+
// Use explicit param if provided, otherwise fall back to session state
|
|
2267
|
+
const effectiveFlow = flow ?? sessionFlowId;
|
|
2237
2268
|
// Settings for default collection
|
|
2238
2269
|
const { settings } = useSettings();
|
|
2239
2270
|
// Only enable operations when socket is connected and ready
|
|
@@ -2246,7 +2277,7 @@ const useRowsQuery = () => {
|
|
|
2246
2277
|
throw new Error("Socket connection not ready");
|
|
2247
2278
|
}
|
|
2248
2279
|
return socket
|
|
2249
|
-
.flow(
|
|
2280
|
+
.flow(effectiveFlow)
|
|
2250
2281
|
.rowsQuery(query, collection || settings.collection, variables, operationName);
|
|
2251
2282
|
},
|
|
2252
2283
|
onError: (err) => {
|
|
@@ -2292,18 +2323,20 @@ const useEmbeddings = ({ flow, term }) => {
|
|
|
2292
2323
|
connectionState?.status === "unauthenticated";
|
|
2293
2324
|
// Hook for displaying user notifications
|
|
2294
2325
|
const notify = useNotification();
|
|
2295
|
-
|
|
2296
|
-
|
|
2326
|
+
// Session state for default flow ID
|
|
2327
|
+
const sessionFlowId = useSessionStore((state) => state.flowId);
|
|
2328
|
+
// Use explicit param if provided, otherwise fall back to session state
|
|
2329
|
+
const effectiveFlow = flow ?? sessionFlowId;
|
|
2297
2330
|
/**
|
|
2298
2331
|
* Query for fetching all token costs
|
|
2299
2332
|
* Uses React Query for caching and background refetching
|
|
2300
2333
|
*/
|
|
2301
2334
|
const query = useQuery({
|
|
2302
|
-
queryKey: ["embeddings", { flow, term }],
|
|
2303
|
-
enabled: isSocketReady && !!term && !!
|
|
2335
|
+
queryKey: ["embeddings", { flow: effectiveFlow, term }],
|
|
2336
|
+
enabled: isSocketReady && !!term && !!effectiveFlow,
|
|
2304
2337
|
queryFn: () => {
|
|
2305
2338
|
return socket
|
|
2306
|
-
.flow(
|
|
2339
|
+
.flow(effectiveFlow)
|
|
2307
2340
|
.embeddings(term)
|
|
2308
2341
|
.then((x) => {
|
|
2309
2342
|
if (x["error"]) {
|
|
@@ -2441,14 +2474,16 @@ const useCollections = () => {
|
|
|
2441
2474
|
* Custom hook for managing NLP query operations
|
|
2442
2475
|
* Provides functionality for converting natural language questions to GraphQL queries
|
|
2443
2476
|
*/
|
|
2444
|
-
const useNlpQuery = () => {
|
|
2477
|
+
const useNlpQuery = ({ flow } = {}) => {
|
|
2445
2478
|
// Socket connection for API calls
|
|
2446
2479
|
const socket = useSocket();
|
|
2447
2480
|
const connectionState = useConnectionState();
|
|
2448
2481
|
// Notification system for user feedback
|
|
2449
2482
|
const notify = useNotification();
|
|
2450
2483
|
// Session state for current flow ID
|
|
2451
|
-
const
|
|
2484
|
+
const sessionFlowId = useSessionStore((state) => state.flowId);
|
|
2485
|
+
// Use explicit param if provided, otherwise fall back to session state
|
|
2486
|
+
const effectiveFlow = flow ?? sessionFlowId;
|
|
2452
2487
|
// Only enable operations when socket is connected and ready
|
|
2453
2488
|
const isSocketReady = connectionState?.status === "authenticated" ||
|
|
2454
2489
|
connectionState?.status === "unauthenticated";
|
|
@@ -2458,7 +2493,7 @@ const useNlpQuery = () => {
|
|
|
2458
2493
|
if (!isSocketReady) {
|
|
2459
2494
|
throw new Error("Socket connection not ready");
|
|
2460
2495
|
}
|
|
2461
|
-
return socket.flow(
|
|
2496
|
+
return socket.flow(effectiveFlow).nlpQuery(question, maxResults);
|
|
2462
2497
|
},
|
|
2463
2498
|
onError: (err) => {
|
|
2464
2499
|
console.log("NLP query error:", err);
|
|
@@ -4634,5 +4669,5 @@ const useNodeDetails = (nodeId, flowId) => {
|
|
|
4634
4669
|
};
|
|
4635
4670
|
};
|
|
4636
4671
|
|
|
4637
|
-
export { DEFAULT_SETTINGS, NotificationProvider, RDFS_LABEL, SETTINGS_STORAGE_KEY, createDocId, fileToBase64, generateFlowBlueprintId, getTermValue$2 as getTermValue, getTriples, prepareMetadata, textToBase64, useActivity, useAgentTools, useChat, useChatSession, useCollections, useConversation, useEmbeddings, useEntityDetail, useFlowBlueprints, useFlowParameters, useFlows, useGraphEmbeddings, useGraphSubgraph, useInference, useKnowledgeCores, useLLMModels, useLibrary, useLoadStateStore, useMcpTools, useNlpQuery, useNodeDetails, useNotification, useOntologies, useParameterValidation, useProcessing, useProgressStateStore, usePrompts, useRowEmbeddingsQuery, useRowsQuery, useSchemas, useSearchStateStore, useSessionStore, useSettings, useStructuredQuery, useTokenCosts, useTriples, useVectorSearch, useWorkbenchStateStore, vectorSearch };
|
|
4672
|
+
export { DEFAULT_SETTINGS, NotificationProvider, RDFS_LABEL, SETTINGS_STORAGE_KEY, createDocId, fileToBase64, generateFlowBlueprintId, getTermValue$2 as getTermValue, getTriples, prepareMetadata, textToBase64, useActivity, useAgentTools, useChat, useChatSession, useCollections, useConversation, useDocumentEmbeddingsQuery, useEmbeddings, useEntityDetail, useFlowBlueprints, useFlowParameters, useFlows, useGraphEmbeddings, useGraphSubgraph, useInference, useKnowledgeCores, useLLMModels, useLibrary, useLoadStateStore, useMcpTools, useNlpQuery, useNodeDetails, useNotification, useOntologies, useParameterValidation, useProcessing, useProgressStateStore, usePrompts, useRowEmbeddingsQuery, useRowsQuery, useSchemas, useSearchStateStore, useSessionStore, useSettings, useStructuredQuery, useTokenCosts, useTriples, useVectorSearch, useWorkbenchStateStore, vectorSearch };
|
|
4638
4673
|
//# sourceMappingURL=index.esm.js.map
|