@epam/ai-dial-chat-hooks 1.2.1 → 1.2.3
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/get-model-id-from-conversation-id.d.ts.map +1 -1
- package/conversation/get-model-id-from-conversation-id.js +1 -1
- package/conversation/useTranscribeAudio/useTranscribeAudio.d.ts.map +1 -1
- package/conversation/useTranscribeAudio/useTranscribeAudio.js +30 -27
- package/package.json +16 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-model-id-from-conversation-id.d.ts","sourceRoot":"","sources":["../../src/conversation/get-model-id-from-conversation-id.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AA+CvE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,4BAA4B,GACvC,IAAI,MAAM,KACT,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"get-model-id-from-conversation-id.d.ts","sourceRoot":"","sources":["../../src/conversation/get-model-id-from-conversation-id.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AA+CvE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,4BAA4B,GACvC,IAAI,MAAM,KACT,MAAM,GAAG,SA0CX,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sCAAsC,GACjD,IAAI,MAAM,KACT,MAAM,EAYR,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,+BAA+B,GAC1C,aAAa,iBAAiB,EAAE,EAChC,gBAAgB,MAAM,KACrB,iBAAiB,GAAG,SAGL,CAAC"}
|
|
@@ -8,7 +8,7 @@ var t = "__", n = /[-+]/, r = /^\d+$/, i = ".scheduler", a = "applications", o =
|
|
|
8
8
|
if (n.length < 3) return;
|
|
9
9
|
let r = n.slice(2), o = r[0] === i ? r.slice(2) : r, c = o.findIndex((e) => e.includes(t));
|
|
10
10
|
if (c === -1) return;
|
|
11
|
-
let l = o[c], u = o.slice(0, c).filter(Boolean), d = s(l, u.
|
|
11
|
+
let l = o[c], u = o.slice(0, c).filter(Boolean), d = s(l, u.slice(0, -1).includes(a)), f = [...u, d].filter(Boolean);
|
|
12
12
|
return f.length > 0 ? f.join("/") : void 0;
|
|
13
13
|
}, l = (e) => {
|
|
14
14
|
let t = c(e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTranscribeAudio.d.ts","sourceRoot":"","sources":["../../../src/conversation/useTranscribeAudio/useTranscribeAudio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"useTranscribeAudio.d.ts","sourceRoot":"","sources":["../../../src/conversation/useTranscribeAudio/useTranscribeAudio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAShF,6EAA6E;AAC7E,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,iDAAiD;AACjD,MAAM,WAAW,wBAAwB;IACvC,gFAAgF;IAChF,gBAAgB,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAC7D,iFAAiF;IACjF,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACvC;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,CACzB,MAAM,EAAE,8BAA8B,KACnC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,uDAAuD;IACvD,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAClC,4FAA4F;IAC5F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,8EAA8E;IAC9E,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,kDAAkD;AAClD,MAAM,WAAW,wBAAwB;IACvC,sGAAsG;IACtG,eAAe,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACvE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,mHAQhC,wBAAwB,KAAG,wBAyE7B,CAAC"}
|
|
@@ -1,41 +1,44 @@
|
|
|
1
1
|
import { AudioTranscriptionError as e, AudioTranscriptionErrorReason as t } from "./audio-transcription-error.js";
|
|
2
2
|
import { withTranscriptionRetry as n } from "./transcription-retry.js";
|
|
3
|
-
import {
|
|
3
|
+
import { normalizeMimeType as r } from "@epam/ai-dial-chat-shared";
|
|
4
|
+
import { useCallback as i } from "react";
|
|
4
5
|
//#region src/conversation/useTranscribeAudio/useTranscribeAudio.ts
|
|
5
|
-
var
|
|
6
|
-
if (
|
|
7
|
-
if (
|
|
6
|
+
var a = ({ transcriptionApi: a, filesApi: o, transcribeWithDeployment: s, bucket: c, asrModelId: l, selectedDeploymentId: u, maxSizeBytes: d }) => ({ transcribeAudio: i(async (i, f) => {
|
|
7
|
+
if (f.throwIfAborted(), !c || !l && !u) throw new e(t.Unavailable);
|
|
8
|
+
if (i.size > d) throw new e(t.TooLarge, d);
|
|
8
9
|
try {
|
|
9
|
-
let
|
|
10
|
-
bucket:
|
|
11
|
-
path:
|
|
12
|
-
file:
|
|
13
|
-
}, { signal:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
let d = `uploads/${(/* @__PURE__ */ new Date()).toISOString().slice(0, 7)}/${encodeURIComponent(i.name)}`, { url: p } = await o.uploadFile({
|
|
11
|
+
bucket: c,
|
|
12
|
+
path: d,
|
|
13
|
+
file: i
|
|
14
|
+
}, { signal: f });
|
|
15
|
+
f.throwIfAborted();
|
|
16
|
+
let m = r(i.type);
|
|
17
|
+
if (l) {
|
|
18
|
+
if (!a) throw new e(t.Unavailable);
|
|
19
|
+
return await n(async () => (await a.transcribeAudio({ transcribeAudioDto: {
|
|
20
|
+
audioUrl: p,
|
|
21
|
+
mimeType: m
|
|
22
|
+
} }, { signal: f })).transcript ?? "", f);
|
|
20
23
|
}
|
|
21
|
-
if (!
|
|
22
|
-
return await n(() =>
|
|
23
|
-
audioUrl:
|
|
24
|
-
mimeType:
|
|
25
|
-
deployment:
|
|
26
|
-
signal:
|
|
27
|
-
}),
|
|
24
|
+
if (!u || !s) throw new e(t.Unavailable);
|
|
25
|
+
return await n(() => s({
|
|
26
|
+
audioUrl: p,
|
|
27
|
+
mimeType: m,
|
|
28
|
+
deployment: u,
|
|
29
|
+
signal: f
|
|
30
|
+
}), f);
|
|
28
31
|
} catch (n) {
|
|
29
|
-
throw
|
|
32
|
+
throw f.aborted || n instanceof e ? n : new e(t.Failed);
|
|
30
33
|
}
|
|
31
34
|
}, [
|
|
32
|
-
s,
|
|
33
35
|
c,
|
|
34
36
|
l,
|
|
35
37
|
u,
|
|
38
|
+
d,
|
|
39
|
+
o,
|
|
36
40
|
a,
|
|
37
|
-
|
|
38
|
-
o
|
|
41
|
+
s
|
|
39
42
|
]) });
|
|
40
43
|
//#endregion
|
|
41
|
-
export {
|
|
44
|
+
export { a as useTranscribeAudio };
|
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.
|
|
4
|
+
"version": "1.2.3",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
118
|
"dependencies": {
|
|
119
|
-
"@epam/ai-dial-chat-api-client": "1.2.
|
|
119
|
+
"@epam/ai-dial-chat-api-client": "1.2.3",
|
|
120
120
|
"dompurify": "3.4.16",
|
|
121
121
|
"fflate": "^0.8.3",
|
|
122
122
|
"lru-cache": "^10.4.3",
|
|
@@ -125,22 +125,22 @@
|
|
|
125
125
|
},
|
|
126
126
|
"peerDependencies": {
|
|
127
127
|
"react": "^19.2.8",
|
|
128
|
-
"@epam/ai-dial-attachment-canvas": "1.2.
|
|
129
|
-
"@epam/ai-dial-attachment-input": "1.2.
|
|
130
|
-
"@epam/ai-dial-catalog": "1.2.
|
|
131
|
-
"@epam/ai-dial-chat-overlay": "1.2.
|
|
132
|
-
"@epam/ai-dial-chat-shared": "1.2.
|
|
133
|
-
"@epam/ai-dial-conversation-input": "1.2.
|
|
134
|
-
"@epam/ai-dial-mcp-apps": "1.2.
|
|
135
|
-
"@epam/ai-dial-publish-panel": "1.2.
|
|
136
|
-
"@epam/ai-dial-quotations": "1.2.
|
|
128
|
+
"@epam/ai-dial-attachment-canvas": "1.2.3",
|
|
129
|
+
"@epam/ai-dial-attachment-input": "1.2.3",
|
|
130
|
+
"@epam/ai-dial-catalog": "1.2.3",
|
|
131
|
+
"@epam/ai-dial-chat-overlay": "1.2.3",
|
|
132
|
+
"@epam/ai-dial-chat-shared": "1.2.3",
|
|
133
|
+
"@epam/ai-dial-conversation-input": "1.2.3",
|
|
134
|
+
"@epam/ai-dial-mcp-apps": "1.2.3",
|
|
135
|
+
"@epam/ai-dial-publish-panel": "1.2.3",
|
|
136
|
+
"@epam/ai-dial-quotations": "1.2.3",
|
|
137
137
|
"@epam/ai-dial-react-file-manager": "^0.3.5",
|
|
138
|
-
"@epam/ai-dial-scheduled-tasks": "1.2.
|
|
139
|
-
"@epam/ai-dial-share": "1.2.
|
|
140
|
-
"@epam/ai-dial-skill-editor": "1.2.
|
|
141
|
-
"@epam/ai-dial-source-panel": "1.2.
|
|
138
|
+
"@epam/ai-dial-scheduled-tasks": "1.2.3",
|
|
139
|
+
"@epam/ai-dial-share": "1.2.3",
|
|
140
|
+
"@epam/ai-dial-skill-editor": "1.2.3",
|
|
141
|
+
"@epam/ai-dial-source-panel": "1.2.3",
|
|
142
142
|
"@epam/ai-dial-ui-kit": "^0.15.4",
|
|
143
|
-
"@epam/ai-dial-usage-dashboard": "1.2.
|
|
143
|
+
"@epam/ai-dial-usage-dashboard": "1.2.3",
|
|
144
144
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
145
145
|
"@epam/pdf-highlighter-kit": "^0.0.19",
|
|
146
146
|
"@mcp-ui/client": "^7.1.1"
|