@epam/ai-dial-chat-hooks 1.2.0-dev.123 → 1.2.0-dev.133
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.
|
@@ -1,35 +1,42 @@
|
|
|
1
1
|
import { MessageRole as e, messageAttachmentToDisplayAttachment as t } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import {
|
|
3
|
-
import { useMemo as
|
|
2
|
+
import { getAnnotationPdfPage as n, isReferenceOnlyAttachment as r, parsePdfPageReference as i, resolveMessageAnnotations as a } from "@epam/ai-dial-quotations";
|
|
3
|
+
import { useMemo as o } from "react";
|
|
4
4
|
//#region src/conversation-sources/useConversationSources/useConversationSources.ts
|
|
5
|
-
var
|
|
6
|
-
let
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
var s = {}, c = (e, t) => {
|
|
6
|
+
let r = n(e);
|
|
7
|
+
if (r == null) return t;
|
|
8
|
+
let a = i(t);
|
|
9
|
+
return a == null || a.page != null ? t : `${t}#page=${r}`;
|
|
10
|
+
}, l = (n, i = s) => o(() => {
|
|
11
|
+
let o = [], s = [], l = [], u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set();
|
|
12
|
+
for (let p of n) {
|
|
13
|
+
let n = p.custom_content?.attachments;
|
|
14
|
+
if (p.role === e.User) for (let e of n ?? []) {
|
|
15
|
+
let n = t(e, i);
|
|
16
|
+
d.has(n.id) || (d.add(n.id), o.push(n));
|
|
12
17
|
}
|
|
13
|
-
else if (
|
|
14
|
-
let e =
|
|
18
|
+
else if (p.role === e.Assistant) {
|
|
19
|
+
let e = n?.filter((e) => !r(e));
|
|
15
20
|
for (let n of e ?? []) {
|
|
16
|
-
let e = t(n,
|
|
17
|
-
|
|
21
|
+
let e = t(n, i);
|
|
22
|
+
f.has(e.id) || (f.add(e.id), s.push(e));
|
|
18
23
|
}
|
|
19
|
-
for (let e of
|
|
20
|
-
if (!
|
|
24
|
+
for (let e of n ?? []) {
|
|
25
|
+
if (!r(e)) continue;
|
|
21
26
|
let t = e.reference_url;
|
|
22
|
-
|
|
27
|
+
u.has(t) || (u.add(t), l.push({
|
|
23
28
|
url: t,
|
|
24
29
|
title: e.title ?? t,
|
|
25
30
|
contentType: e.reference_type ?? e.type ?? "",
|
|
26
31
|
quote: e.data
|
|
27
32
|
}));
|
|
28
33
|
}
|
|
29
|
-
for (let e of
|
|
34
|
+
for (let e of a(p)) {
|
|
30
35
|
let t = e?.body?.source?.attachment, n = t?.url;
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
if (!n) continue;
|
|
37
|
+
let r = c(e, n);
|
|
38
|
+
u.has(r) || (u.add(r), l.push({
|
|
39
|
+
url: r,
|
|
33
40
|
title: t?.title ?? n.split("/").pop() ?? n,
|
|
34
41
|
contentType: t?.type ?? "",
|
|
35
42
|
quote: e.body?.quote
|
|
@@ -38,10 +45,10 @@ var a = {}, o = (o, s = a) => i(() => {
|
|
|
38
45
|
}
|
|
39
46
|
}
|
|
40
47
|
return {
|
|
41
|
-
uploaded:
|
|
42
|
-
generated:
|
|
43
|
-
sources:
|
|
48
|
+
uploaded: o,
|
|
49
|
+
generated: s,
|
|
50
|
+
sources: l
|
|
44
51
|
};
|
|
45
|
-
}, [
|
|
52
|
+
}, [n, i]);
|
|
46
53
|
//#endregion
|
|
47
|
-
export {
|
|
54
|
+
export { l as useConversationSources };
|
|
@@ -18,7 +18,7 @@ export declare interface UseConversationSourcesResult {
|
|
|
18
18
|
uploaded: DisplayAttachment[];
|
|
19
19
|
/** Deduplicated attachments the assistant generated across the conversation. */
|
|
20
20
|
generated: DisplayAttachment[];
|
|
21
|
-
/** Quotation sources referenced by assistant messages, deduplicated by URL
|
|
21
|
+
/** Quotation sources referenced by assistant messages, deduplicated by URL; PDF sources are qualified with `#page=N`. */
|
|
22
22
|
sources: QuotationSource[];
|
|
23
23
|
}
|
|
24
24
|
|
package/index.d.ts
CHANGED
|
@@ -4990,7 +4990,7 @@ export declare interface UseConversationSourcesResult {
|
|
|
4990
4990
|
uploaded: DisplayAttachment[];
|
|
4991
4991
|
/** Deduplicated attachments the assistant generated across the conversation. */
|
|
4992
4992
|
generated: DisplayAttachment[];
|
|
4993
|
-
/** Quotation sources referenced by assistant messages, deduplicated by URL
|
|
4993
|
+
/** Quotation sources referenced by assistant messages, deduplicated by URL; PDF sources are qualified with `#page=N`. */
|
|
4994
4994
|
sources: QuotationSource[];
|
|
4995
4995
|
}
|
|
4996
4996
|
|
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.2.0-dev.
|
|
4
|
+
"version": "1.2.0-dev.133",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
113
|
"dependencies": {
|
|
114
|
-
"@epam/ai-dial-chat-api-client": "1.2.0-dev.
|
|
114
|
+
"@epam/ai-dial-chat-api-client": "1.2.0-dev.133",
|
|
115
115
|
"dompurify": "3.4.15",
|
|
116
116
|
"fflate": "^0.8.3",
|
|
117
117
|
"lru-cache": "^10.4.3",
|
|
@@ -120,22 +120,22 @@
|
|
|
120
120
|
},
|
|
121
121
|
"peerDependencies": {
|
|
122
122
|
"react": "^19.2.8",
|
|
123
|
-
"@epam/ai-dial-attachment-canvas": "1.2.0-dev.
|
|
124
|
-
"@epam/ai-dial-attachment-input": "1.2.0-dev.
|
|
125
|
-
"@epam/ai-dial-builder-form": "1.2.0-dev.
|
|
126
|
-
"@epam/ai-dial-catalog": "1.2.0-dev.
|
|
127
|
-
"@epam/ai-dial-chat-overlay": "1.2.0-dev.
|
|
128
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
129
|
-
"@epam/ai-dial-mcp-apps": "1.2.0-dev.
|
|
130
|
-
"@epam/ai-dial-publish-panel": "1.2.0-dev.
|
|
131
|
-
"@epam/ai-dial-quotations": "1.2.0-dev.
|
|
123
|
+
"@epam/ai-dial-attachment-canvas": "1.2.0-dev.133",
|
|
124
|
+
"@epam/ai-dial-attachment-input": "1.2.0-dev.133",
|
|
125
|
+
"@epam/ai-dial-builder-form": "1.2.0-dev.133",
|
|
126
|
+
"@epam/ai-dial-catalog": "1.2.0-dev.133",
|
|
127
|
+
"@epam/ai-dial-chat-overlay": "1.2.0-dev.133",
|
|
128
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.133",
|
|
129
|
+
"@epam/ai-dial-mcp-apps": "1.2.0-dev.133",
|
|
130
|
+
"@epam/ai-dial-publish-panel": "1.2.0-dev.133",
|
|
131
|
+
"@epam/ai-dial-quotations": "1.2.0-dev.133",
|
|
132
132
|
"@epam/ai-dial-react-file-manager": "^0.3.0-dev.4",
|
|
133
|
-
"@epam/ai-dial-scheduled-tasks": "1.2.0-dev.
|
|
134
|
-
"@epam/ai-dial-share": "1.2.0-dev.
|
|
135
|
-
"@epam/ai-dial-skill-editor": "1.2.0-dev.
|
|
136
|
-
"@epam/ai-dial-source-panel": "1.2.0-dev.
|
|
133
|
+
"@epam/ai-dial-scheduled-tasks": "1.2.0-dev.133",
|
|
134
|
+
"@epam/ai-dial-share": "1.2.0-dev.133",
|
|
135
|
+
"@epam/ai-dial-skill-editor": "1.2.0-dev.133",
|
|
136
|
+
"@epam/ai-dial-source-panel": "1.2.0-dev.133",
|
|
137
137
|
"@epam/ai-dial-ui-kit": "^0.15.0-dev.18",
|
|
138
|
-
"@epam/ai-dial-usage-dashboard": "1.2.0-dev.
|
|
138
|
+
"@epam/ai-dial-usage-dashboard": "1.2.0-dev.133",
|
|
139
139
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
140
140
|
"@epam/pdf-highlighter-kit": "^0.0.19",
|
|
141
141
|
"@mcp-ui/client": "^7.1.1"
|