@ray-js/t-agent-ui-ray 0.2.0-beta-7 → 0.2.0-beta-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/dist/MessageInput/MessageInputAIStream/index.d.ts +2 -0
- package/dist/MessageInput/MessageInputAIStream/index.js +13 -5
- package/dist/MessageInput/icons/video.svg +10 -1
- package/dist/MessageInput/index.d.ts +2 -9
- package/dist/MessageInput/index.js +1 -4
- package/dist/tiles/BubbleTile/index.less +2 -0
- package/dist/tiles/FileTile/index.less +2 -1
- package/dist/tiles/TextTile/index.less +2 -0
- package/package.json +2 -2
|
@@ -12,6 +12,8 @@ interface Props {
|
|
|
12
12
|
placeholder?: string;
|
|
13
13
|
style?: React.CSSProperties;
|
|
14
14
|
attachment?: boolean | AttachmentOptions;
|
|
15
|
+
maxTextLength?: number;
|
|
16
|
+
maxAudioMs?: number;
|
|
15
17
|
}
|
|
16
18
|
export default function MessageInputAIStream(props: Props): React.JSX.Element;
|
|
17
19
|
export {};
|
|
@@ -12,7 +12,7 @@ import { Emitter, EmitterEvent } from '@ray-js/t-agent';
|
|
|
12
12
|
import cx from 'clsx';
|
|
13
13
|
import imageSvg from '../icons/image.svg';
|
|
14
14
|
import videoSvg from '../icons/video.svg';
|
|
15
|
-
import {
|
|
15
|
+
import { useAttachmentInput, useChatAgent, useEmitEvent, useIsUnmounted, useOnEvent, useTranslate } from '../../hooks';
|
|
16
16
|
import AsrInput from './AsrInput';
|
|
17
17
|
import { useSleep } from '../../hooks/useSleep';
|
|
18
18
|
const AMPLITUDE_COUNT = 60;
|
|
@@ -61,7 +61,7 @@ export default function MessageInputAIStream(props) {
|
|
|
61
61
|
setResponding(false);
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
|
-
const
|
|
64
|
+
const hasMore = attachmentOptions.image || attachmentOptions.video;
|
|
65
65
|
const isMore = !text.trim().length && hasMore;
|
|
66
66
|
const send = async inputBlocks => {
|
|
67
67
|
if (!(inputBlocks !== null && inputBlocks !== void 0 && inputBlocks.length)) {
|
|
@@ -166,7 +166,7 @@ export default function MessageInputAIStream(props) {
|
|
|
166
166
|
}]);
|
|
167
167
|
}
|
|
168
168
|
},
|
|
169
|
-
maxLength: 200,
|
|
169
|
+
maxLength: props.maxTextLength || 200,
|
|
170
170
|
placeholderStyle: "color: var(--app-B1-N4)",
|
|
171
171
|
onFocus: () => {
|
|
172
172
|
setMoreOpen(false);
|
|
@@ -232,10 +232,16 @@ export default function MessageInputAIStream(props) {
|
|
|
232
232
|
await sleep(50);
|
|
233
233
|
}
|
|
234
234
|
const emitter = new Emitter();
|
|
235
|
-
|
|
235
|
+
setTimeout(() => {
|
|
236
|
+
if (r.recording) {
|
|
237
|
+
r.confirm();
|
|
238
|
+
}
|
|
239
|
+
}, props.maxAudioMs || 30000);
|
|
240
|
+
const r = {
|
|
236
241
|
startAt: Date.now(),
|
|
237
242
|
recording: true,
|
|
238
243
|
confirm: () => {
|
|
244
|
+
r.recording = false;
|
|
239
245
|
emitter.dispatchEvent(new EmitterEvent('confirm'));
|
|
240
246
|
setRecord({
|
|
241
247
|
startAt: 0,
|
|
@@ -245,6 +251,7 @@ export default function MessageInputAIStream(props) {
|
|
|
245
251
|
});
|
|
246
252
|
},
|
|
247
253
|
cancel: () => {
|
|
254
|
+
r.recording = false;
|
|
248
255
|
emitter.dispatchEvent(new EmitterEvent('cancel'));
|
|
249
256
|
setRecord({
|
|
250
257
|
startAt: 0,
|
|
@@ -253,7 +260,8 @@ export default function MessageInputAIStream(props) {
|
|
|
253
260
|
cancel: null
|
|
254
261
|
});
|
|
255
262
|
}
|
|
256
|
-
}
|
|
263
|
+
};
|
|
264
|
+
setRecord(r);
|
|
257
265
|
emitter.addEventListener('error', () => {
|
|
258
266
|
ty.showToast({
|
|
259
267
|
icon: 'error',
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
<svg
|
|
1
|
+
<svg width="200" height="200" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_1_4)">
|
|
3
|
+
<path d="M0 0H200V200H0V0.015V0ZM20.009 20.009V179.991H179.991V20.024H20.009V20.009ZM59.997 43.7078L157.492 100L59.997 156.292V43.7078ZM80.006 78.3561V121.659L117.504 100L80.006 78.3561Z" fill="#3D3D3D"/>
|
|
4
|
+
</g>
|
|
5
|
+
<defs>
|
|
6
|
+
<clipPath id="clip0_1_4">
|
|
7
|
+
<rect width="200" height="200" fill="white"/>
|
|
8
|
+
</clipPath>
|
|
9
|
+
</defs>
|
|
10
|
+
</svg>
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
className?: string;
|
|
4
|
-
renderTop?: React.ReactNode;
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
style?: React.CSSProperties;
|
|
7
|
-
}
|
|
8
|
-
export default function MessageInput(props: Props): React.JSX.Element;
|
|
9
|
-
export {};
|
|
1
|
+
import MessageInputAIStream from './MessageInputAIStream';
|
|
2
|
+
export default MessageInputAIStream;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/t-agent-ui-ray",
|
|
3
|
-
"version": "0.2.0-beta-
|
|
3
|
+
"version": "0.2.0-beta-9",
|
|
4
4
|
"author": "Tuya.inc",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"@types/echarts": "^4.9.22",
|
|
41
41
|
"@types/markdown-it": "^14.1.1"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "cfe00de066a09da4a63e7c965d42a622f95cda4c"
|
|
44
44
|
}
|