@epam/ai-dial-chat-hooks 1.3.0-dev.357 → 1.3.0-dev.358
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/conversation/useConversationStream/conversation-stream.types.d.ts +136 -0
- package/conversation/useConversationStream/conversation-stream.types.d.ts.map +1 -0
- package/conversation/useConversationStream/generation-resume.d.ts +1 -1
- package/conversation/useConversationStream/generation-resume.d.ts.map +1 -1
- package/conversation/useConversationStream/stream-errors.d.ts +10 -0
- package/conversation/useConversationStream/stream-errors.d.ts.map +1 -0
- package/conversation/useConversationStream/stream-errors.js +10 -0
- package/conversation/useConversationStream/stream-session.d.ts +51 -0
- package/conversation/useConversationStream/stream-session.d.ts.map +1 -0
- package/conversation/useConversationStream/stream-session.js +179 -0
- package/conversation/useConversationStream/useConversationReloadErrors.d.ts +25 -0
- package/conversation/useConversationStream/useConversationReloadErrors.d.ts.map +1 -0
- package/conversation/useConversationStream/useConversationReloadErrors.js +38 -0
- package/conversation/useConversationStream/useConversationStream.d.ts +2 -135
- package/conversation/useConversationStream/useConversationStream.d.ts.map +1 -1
- package/conversation/useConversationStream/useConversationStream.js +134 -332
- package/conversation/useConversationStream/useStopGeneration.d.ts +29 -0
- package/conversation/useConversationStream/useStopGeneration.d.ts.map +1 -0
- package/conversation/useConversationStream/useStopGeneration.js +48 -0
- package/conversation/useConversationStream/useStreamPathState.d.ts +39 -0
- package/conversation/useConversationStream/useStreamPathState.d.ts.map +1 -0
- package/conversation/useConversationStream/useStreamPathState.js +55 -0
- package/package.json +17 -17
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { getConversationPath as e } from "./conversation-path.js";
|
|
2
|
+
import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
|
|
3
|
+
//#region src/conversation/useConversationStream/useStreamPathState.ts
|
|
4
|
+
var a = ({ conversationId: a, frameScheduler: o, mountedRef: s, clearReloadError: c }) => {
|
|
5
|
+
let [l, u] = i(() => /* @__PURE__ */ new Set()), d = r(l);
|
|
6
|
+
d.current = l;
|
|
7
|
+
let [f, p] = i(() => /* @__PURE__ */ new Set()), m = r(/* @__PURE__ */ new Map()), h = r(/* @__PURE__ */ new Map()), g = r(/* @__PURE__ */ new Set()), _ = r(/* @__PURE__ */ new Map()), v = r(/* @__PURE__ */ new Set()), y = r(/* @__PURE__ */ new Set()), b = r(/* @__PURE__ */ new Map()), x = r(a);
|
|
8
|
+
n(() => (x.current = a, () => o.cancelAll()), [a, o]);
|
|
9
|
+
let S = t((t) => s.current && e(x.current ?? "") === t, [s]), C = t((e) => {
|
|
10
|
+
c(e), u((t) => {
|
|
11
|
+
if (t.has(e)) return t;
|
|
12
|
+
let n = new Set(t);
|
|
13
|
+
return n.add(e), n;
|
|
14
|
+
});
|
|
15
|
+
}, [c]), w = t((e) => {
|
|
16
|
+
u((t) => {
|
|
17
|
+
if (!t.has(e)) return t;
|
|
18
|
+
let n = new Set(t);
|
|
19
|
+
return n.delete(e), n;
|
|
20
|
+
});
|
|
21
|
+
}, []), T = t((e, t) => {
|
|
22
|
+
p((n) => {
|
|
23
|
+
if (n.has(e) === t) return n;
|
|
24
|
+
let r = new Set(n);
|
|
25
|
+
return t ? r.add(e) : r.delete(e), r;
|
|
26
|
+
});
|
|
27
|
+
}, []);
|
|
28
|
+
return {
|
|
29
|
+
streamingPaths: l,
|
|
30
|
+
streamingPathsRef: d,
|
|
31
|
+
stoppablePaths: f,
|
|
32
|
+
activeGenerationIdsRef: m,
|
|
33
|
+
resumedGenerationIdsRef: h,
|
|
34
|
+
resumingPathsRef: g,
|
|
35
|
+
bufferedGenerationsRef: _,
|
|
36
|
+
stoppedGenerationIdsRef: v,
|
|
37
|
+
stopRequestedIdsRef: y,
|
|
38
|
+
latestGenerationIdsRef: b,
|
|
39
|
+
isPathDisplayed: S,
|
|
40
|
+
addStreamingPath: C,
|
|
41
|
+
removeStreamingPath: w,
|
|
42
|
+
setPathStoppable: T,
|
|
43
|
+
releaseActiveGeneration: t((e, t) => {
|
|
44
|
+
m.current.get(e) === t && (m.current.delete(e), T(e, !1));
|
|
45
|
+
}, [T]),
|
|
46
|
+
rememberResumedGenerationId: t((e, t) => {
|
|
47
|
+
m.current.has(e) || (h.current.set(e, t), T(e, !0));
|
|
48
|
+
}, [T]),
|
|
49
|
+
forgetResumedGenerationId: t((e, t) => {
|
|
50
|
+
h.current.get(e) === t && (h.current.delete(e), m.current.has(e) || T(e, !1));
|
|
51
|
+
}, [T])
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { a as useStreamPathState };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-chat-hooks",
|
|
3
3
|
"description": "Framework-level React hooks extracted from AI DIAL Chat for building custom chat interfaces",
|
|
4
|
-
"version": "1.3.0-dev.
|
|
4
|
+
"version": "1.3.0-dev.358",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
}
|
|
132
132
|
},
|
|
133
133
|
"dependencies": {
|
|
134
|
-
"@epam/ai-dial-chat-api-client": "1.3.0-dev.
|
|
134
|
+
"@epam/ai-dial-chat-api-client": "1.3.0-dev.358",
|
|
135
135
|
"dompurify": "3.4.17",
|
|
136
136
|
"fflate": "^0.8.3",
|
|
137
137
|
"lru-cache": "^10.4.3",
|
|
@@ -140,23 +140,23 @@
|
|
|
140
140
|
},
|
|
141
141
|
"peerDependencies": {
|
|
142
142
|
"react": "^19.2.8",
|
|
143
|
-
"@epam/ai-dial-attachment-canvas": "1.3.0-dev.
|
|
144
|
-
"@epam/ai-dial-attachment-input": "1.3.0-dev.
|
|
145
|
-
"@epam/ai-dial-catalog": "1.3.0-dev.
|
|
146
|
-
"@epam/ai-dial-chat-overlay": "1.3.0-dev.
|
|
147
|
-
"@epam/ai-dial-chat-shared": "1.3.0-dev.
|
|
148
|
-
"@epam/ai-dial-conversation-input": "1.3.0-dev.
|
|
149
|
-
"@epam/ai-dial-mcp-apps": "1.3.0-dev.
|
|
150
|
-
"@epam/ai-dial-projects": "1.3.0-dev.
|
|
151
|
-
"@epam/ai-dial-publish-panel": "1.3.0-dev.
|
|
152
|
-
"@epam/ai-dial-quotations": "1.3.0-dev.
|
|
143
|
+
"@epam/ai-dial-attachment-canvas": "1.3.0-dev.358",
|
|
144
|
+
"@epam/ai-dial-attachment-input": "1.3.0-dev.358",
|
|
145
|
+
"@epam/ai-dial-catalog": "1.3.0-dev.358",
|
|
146
|
+
"@epam/ai-dial-chat-overlay": "1.3.0-dev.358",
|
|
147
|
+
"@epam/ai-dial-chat-shared": "1.3.0-dev.358",
|
|
148
|
+
"@epam/ai-dial-conversation-input": "1.3.0-dev.358",
|
|
149
|
+
"@epam/ai-dial-mcp-apps": "1.3.0-dev.358",
|
|
150
|
+
"@epam/ai-dial-projects": "1.3.0-dev.358",
|
|
151
|
+
"@epam/ai-dial-publish-panel": "1.3.0-dev.358",
|
|
152
|
+
"@epam/ai-dial-quotations": "1.3.0-dev.358",
|
|
153
153
|
"@epam/ai-dial-react-file-manager": "^0.4.1",
|
|
154
|
-
"@epam/ai-dial-scheduled-tasks": "1.3.0-dev.
|
|
155
|
-
"@epam/ai-dial-share": "1.3.0-dev.
|
|
156
|
-
"@epam/ai-dial-skill-editor": "1.3.0-dev.
|
|
157
|
-
"@epam/ai-dial-source-panel": "1.3.0-dev.
|
|
154
|
+
"@epam/ai-dial-scheduled-tasks": "1.3.0-dev.358",
|
|
155
|
+
"@epam/ai-dial-share": "1.3.0-dev.358",
|
|
156
|
+
"@epam/ai-dial-skill-editor": "1.3.0-dev.358",
|
|
157
|
+
"@epam/ai-dial-source-panel": "1.3.0-dev.358",
|
|
158
158
|
"@epam/ai-dial-ui-kit": "^0.16.0",
|
|
159
|
-
"@epam/ai-dial-usage-dashboard": "1.3.0-dev.
|
|
159
|
+
"@epam/ai-dial-usage-dashboard": "1.3.0-dev.358",
|
|
160
160
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
161
161
|
"@epam/pdf-highlighter-kit": "^0.0.21"
|
|
162
162
|
},
|