@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.
@@ -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 { useAgentSessionValue, useAttachmentInput, useChatAgent, useEmitEvent, useIsUnmounted, useOnEvent, useTranslate } from '../../hooks';
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 [hasMore] = useAgentSessionValue('multiModal');
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
- setRecord({
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 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="20" height="18" viewBox="0 0 20 18"><g><path d="M7.82843,2L5.82843,4L2,4L2,16L18,16L18,4L14.1716,4L12.1716,2L7.82843,2ZM7,0L13,0L15,2L19,2C19.5523,2,20,2.44772,20,3L20,17C20,17.5523,19.5523,18,19,18L1,18C0.44772,18,0,17.5523,0,17L0,3C0,2.44772,0.44772,2,1,2L5,2L7,0ZM10,15C6.96243,15,4.5,12.5376,4.5,9.5C4.5,6.46243,6.96243,4,10,4C13.0376,4,15.5,6.46243,15.5,9.5C15.5,12.5376,13.0376,15,10,15ZM10,13C11.933,13,13.5,11.433,13.5,9.5C13.5,7.567,11.933,6,10,6C8.067,6,6.5,7.567,6.5,9.5C6.5,11.433,8.067,13,10,13Z" fill="#3D3D3D" fill-opacity="1"/></g></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 React from 'react';
2
- interface Props {
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;
@@ -1,5 +1,2 @@
1
- import React from 'react';
2
1
  import MessageInputAIStream from './MessageInputAIStream';
3
- export default function MessageInput(props) {
4
- return /*#__PURE__*/React.createElement(MessageInputAIStream, props);
5
- }
2
+ export default MessageInputAIStream;
@@ -31,6 +31,8 @@
31
31
  .t-agent-bubble-tile-error-alert-text {
32
32
  flex: 0 1 auto;
33
33
  min-width: 0;
34
+ word-break: normal;
35
+ overflow-wrap: break-word;
34
36
  }
35
37
  }
36
38
 
@@ -42,7 +42,8 @@
42
42
  }
43
43
 
44
44
  .t-agent-file-tile-filename {
45
- word-break: break-all; /* 允许单词内断行 */
45
+ word-break: normal;
46
+ overflow-wrap: break-word;
46
47
 
47
48
  /* 限制两行 */
48
49
  display: -webkit-box;
@@ -1,3 +1,5 @@
1
1
  .t-agent-text-tile {
2
2
  display: inline;
3
+ word-break: normal;
4
+ overflow-wrap: break-word;
3
5
  }
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-7",
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": "622a593292ba773b94c6257f7c117d6a2c7baff9"
43
+ "gitHead": "cfe00de066a09da4a63e7c965d42a622f95cda4c"
44
44
  }