@epam/ai-dial-chat-hooks 1.2.2 → 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.
@@ -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;AAQhF,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,wBAqE7B,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 { useCallback as r } from "react";
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 i = ({ transcriptionApi: i, filesApi: a, transcribeWithDeployment: o, bucket: s, asrModelId: c, selectedDeploymentId: l, maxSizeBytes: u }) => ({ transcribeAudio: r(async (r, d) => {
6
- if (d.throwIfAborted(), !s || !c && !l) throw new e(t.Unavailable);
7
- if (r.size > u) throw new e(t.TooLarge, u);
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 u = `uploads/${(/* @__PURE__ */ new Date()).toISOString().slice(0, 7)}/${encodeURIComponent(r.name)}`, { url: f } = await a.uploadFile({
10
- bucket: s,
11
- path: u,
12
- file: r
13
- }, { signal: d });
14
- if (d.throwIfAborted(), c) {
15
- if (!i) throw new e(t.Unavailable);
16
- return await n(async () => (await i.transcribeAudio({ transcribeAudioDto: {
17
- audioUrl: f,
18
- mimeType: r.type
19
- } }, { signal: d })).transcript ?? "", d);
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 (!l || !o) throw new e(t.Unavailable);
22
- return await n(() => o({
23
- audioUrl: f,
24
- mimeType: r.type,
25
- deployment: l,
26
- signal: d
27
- }), d);
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 d.aborted || n instanceof e ? n : new e(t.Failed);
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
- i,
38
- o
41
+ s
39
42
  ]) });
40
43
  //#endregion
41
- export { i as useTranscribeAudio };
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.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.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.2",
129
- "@epam/ai-dial-attachment-input": "1.2.2",
130
- "@epam/ai-dial-catalog": "1.2.2",
131
- "@epam/ai-dial-chat-overlay": "1.2.2",
132
- "@epam/ai-dial-chat-shared": "1.2.2",
133
- "@epam/ai-dial-conversation-input": "1.2.2",
134
- "@epam/ai-dial-mcp-apps": "1.2.2",
135
- "@epam/ai-dial-publish-panel": "1.2.2",
136
- "@epam/ai-dial-quotations": "1.2.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.2",
139
- "@epam/ai-dial-share": "1.2.2",
140
- "@epam/ai-dial-skill-editor": "1.2.2",
141
- "@epam/ai-dial-source-panel": "1.2.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.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"