@trustgraph/react-state 1.6.1 → 1.7.1
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 +8 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +8 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/state/collections.d.ts +14 -3
- package/dist/state/collections.d.ts.map +1 -1
- package/dist/state/inference.d.ts +4 -3
- package/dist/state/inference.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1844,20 +1844,20 @@ const useInference = ({ flow } = {}) => {
|
|
|
1844
1844
|
* Agent inference with streaming callbacks and optional explainability
|
|
1845
1845
|
*/
|
|
1846
1846
|
const agentMutation = reactQuery.useMutation({
|
|
1847
|
-
mutationFn: async ({ input, callbacks, }) => {
|
|
1847
|
+
mutationFn: async ({ input, collection, callbacks, }) => {
|
|
1848
1848
|
const wantsExplainability = !!callbacks?.onExplain;
|
|
1849
1849
|
const explainEvents = wantsExplainability ? [] : undefined;
|
|
1850
1850
|
return new Promise((resolve, reject) => {
|
|
1851
1851
|
let fullAnswer = "";
|
|
1852
|
-
const onThink = (thought, complete) => {
|
|
1853
|
-
callbacks?.onThink?.(thought, complete);
|
|
1852
|
+
const onThink = (thought, complete, messageId) => {
|
|
1853
|
+
callbacks?.onThink?.(thought, complete, messageId);
|
|
1854
1854
|
};
|
|
1855
|
-
const onObserve = (observation, complete) => {
|
|
1856
|
-
callbacks?.onObserve?.(observation, complete);
|
|
1855
|
+
const onObserve = (observation, complete, messageId) => {
|
|
1856
|
+
callbacks?.onObserve?.(observation, complete, messageId);
|
|
1857
1857
|
};
|
|
1858
|
-
const onAnswer = (answer, complete) => {
|
|
1858
|
+
const onAnswer = (answer, complete, messageId) => {
|
|
1859
1859
|
fullAnswer += answer;
|
|
1860
|
-
callbacks?.onAnswer?.(answer, complete);
|
|
1860
|
+
callbacks?.onAnswer?.(answer, complete, messageId);
|
|
1861
1861
|
if (complete) {
|
|
1862
1862
|
resolve(fullAnswer);
|
|
1863
1863
|
}
|
|
@@ -1874,7 +1874,7 @@ const useInference = ({ flow } = {}) => {
|
|
|
1874
1874
|
: undefined;
|
|
1875
1875
|
socket
|
|
1876
1876
|
.flow(effectiveFlow)
|
|
1877
|
-
.agent(input, onThink, onObserve, onAnswer, onError, onExplain);
|
|
1877
|
+
.agent(input, onThink, onObserve, onAnswer, onError, onExplain, collection);
|
|
1878
1878
|
});
|
|
1879
1879
|
},
|
|
1880
1880
|
});
|
|
@@ -3061,11 +3061,9 @@ const useEmbeddings = ({ flow, term }) => {
|
|
|
3061
3061
|
};
|
|
3062
3062
|
};
|
|
3063
3063
|
|
|
3064
|
-
// @ts-nocheck
|
|
3065
3064
|
/**
|
|
3066
3065
|
* Custom hook for managing collection operations
|
|
3067
3066
|
* Provides functionality for fetching, creating, updating, and deleting collections
|
|
3068
|
-
* @returns {Object} Collections state and operations
|
|
3069
3067
|
*/
|
|
3070
3068
|
const useCollections = () => {
|
|
3071
3069
|
// WebSocket connection for communicating with the collection management service
|