@fe-free/ai 6.0.8 → 6.0.9
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/CHANGELOG.md +9 -0
- package/package.json +4 -4
- package/src/m_sender/m_sender.stories.tsx +12 -11
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fe-free/ai",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"lodash-es": "^4.17.21",
|
|
18
18
|
"uuid": "^13.0.0",
|
|
19
19
|
"zustand": "^4.5.7",
|
|
20
|
-
"@fe-free/core": "6.0.
|
|
20
|
+
"@fe-free/core": "6.0.9"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"antd": "^6.2.1",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"i18next-icu": "^2.4.1",
|
|
28
28
|
"react": "^19.2.0",
|
|
29
29
|
"react-i18next": "^16.4.0",
|
|
30
|
-
"@fe-free/icons": "6.0.
|
|
31
|
-
"@fe-free/tool": "6.0.
|
|
30
|
+
"@fe-free/icons": "6.0.9",
|
|
31
|
+
"@fe-free/tool": "6.0.9"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -2,6 +2,7 @@ import { getRecordAudioOfBlob, getRecordAudioOfPCM, MSender } from '@fe-free/ai'
|
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
3
|
import { App } from 'antd';
|
|
4
4
|
import { useCallback, useMemo, useState } from 'react';
|
|
5
|
+
|
|
5
6
|
import type { MSenderProps, MSenderValue } from './types';
|
|
6
7
|
|
|
7
8
|
const meta: Meta<typeof MSender> = {
|
|
@@ -18,9 +19,9 @@ function Component(props: MSenderProps) {
|
|
|
18
19
|
return (
|
|
19
20
|
<MSender
|
|
20
21
|
value={v}
|
|
21
|
-
onChange={(
|
|
22
|
-
console.log('newValue',
|
|
23
|
-
setV(
|
|
22
|
+
onChange={(nv) => {
|
|
23
|
+
console.log('newValue', nv);
|
|
24
|
+
setV(nv);
|
|
24
25
|
}}
|
|
25
26
|
onSubmit={(value) => {
|
|
26
27
|
console.log('onSubmit', value);
|
|
@@ -74,7 +75,7 @@ export const AllowSpeech: Story = {
|
|
|
74
75
|
console.log('handleRecordEnd isSend', isSend);
|
|
75
76
|
|
|
76
77
|
if (isSend) {
|
|
77
|
-
handleSubmit({ ...
|
|
78
|
+
handleSubmit({ ...props.value, text: '假设这是识别的文字' });
|
|
78
79
|
}
|
|
79
80
|
},
|
|
80
81
|
[props.value],
|
|
@@ -122,9 +123,9 @@ export const AllowSpeechPCM: Story = {
|
|
|
122
123
|
return getRecordAudioOfPCM();
|
|
123
124
|
}, []);
|
|
124
125
|
|
|
125
|
-
const handleSubmit = (value: MSenderValue) => {
|
|
126
|
+
const handleSubmit = useCallback((value: MSenderValue) => {
|
|
126
127
|
console.log('handleSubmit', value);
|
|
127
|
-
};
|
|
128
|
+
}, []);
|
|
128
129
|
|
|
129
130
|
const handleRecordStart = useCallback(async () => {
|
|
130
131
|
// 假设这是录音的文本
|
|
@@ -142,7 +143,7 @@ export const AllowSpeechPCM: Story = {
|
|
|
142
143
|
}
|
|
143
144
|
|
|
144
145
|
return;
|
|
145
|
-
}, []);
|
|
146
|
+
}, [startRecord, message]);
|
|
146
147
|
|
|
147
148
|
const handleRecordEnd = useCallback(
|
|
148
149
|
async (isSend) => {
|
|
@@ -152,10 +153,10 @@ export const AllowSpeechPCM: Story = {
|
|
|
152
153
|
console.log('voiceData', voiceData);
|
|
153
154
|
|
|
154
155
|
if (isSend) {
|
|
155
|
-
handleSubmit({ ...
|
|
156
|
+
handleSubmit({ ...props.value, text: '假设这是识别的文字' });
|
|
156
157
|
}
|
|
157
158
|
},
|
|
158
|
-
[props.value, stopRecord],
|
|
159
|
+
[props.value, stopRecord, handleSubmit],
|
|
159
160
|
);
|
|
160
161
|
|
|
161
162
|
return (
|
|
@@ -199,7 +200,7 @@ export const AllowSpeechBlob: Story = {
|
|
|
199
200
|
}
|
|
200
201
|
|
|
201
202
|
return;
|
|
202
|
-
}, []);
|
|
203
|
+
}, [startRecord, message]);
|
|
203
204
|
|
|
204
205
|
const handleRecordEnd = useCallback(
|
|
205
206
|
async (isSend) => {
|
|
@@ -209,7 +210,7 @@ export const AllowSpeechBlob: Story = {
|
|
|
209
210
|
console.log('voiceData', voiceData);
|
|
210
211
|
|
|
211
212
|
if (isSend) {
|
|
212
|
-
handleSubmit({ ...
|
|
213
|
+
handleSubmit({ ...props.value, text: '假设这是识别的文字' });
|
|
213
214
|
}
|
|
214
215
|
},
|
|
215
216
|
[props.value, stopRecord],
|