@ray-js/t-agent-ui-ray 0.1.0-beta-11 → 0.1.0-beta-13
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/ChatContainer/index.d.ts +1 -0
- package/dist/ChatContainer/index.js +5 -3
- package/dist/MarkdownRender/index.d.ts +2 -0
- package/dist/MarkdownRender/index.js +5 -2
- package/dist/MessageInput/index.d.ts +1 -0
- package/dist/MessageInput/index.js +4 -2
- package/dist/MessageList/index.d.ts +3 -0
- package/dist/MessageList/index.js +8 -3
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
1
2
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
3
|
import "core-js/modules/esnext.iterator.filter.js";
|
|
3
4
|
import "core-js/modules/esnext.iterator.map.js";
|
|
@@ -16,7 +17,8 @@ export default function ChatContainer(props) {
|
|
|
16
17
|
createAgent,
|
|
17
18
|
renderOptions = defaultRenderOptions,
|
|
18
19
|
children,
|
|
19
|
-
className
|
|
20
|
+
className,
|
|
21
|
+
style
|
|
20
22
|
} = props;
|
|
21
23
|
const [messages, setMessages] = useState([]);
|
|
22
24
|
const [agent] = useState(() => {
|
|
@@ -153,10 +155,10 @@ export default function ChatContainer(props) {
|
|
|
153
155
|
};
|
|
154
156
|
}, []);
|
|
155
157
|
return /*#__PURE__*/React.createElement(View, {
|
|
156
|
-
style: {
|
|
158
|
+
style: _objectSpread({
|
|
157
159
|
// @ts-ignore
|
|
158
160
|
'--t-agent-chat-container-keyboard-height': "".concat(keyboardHeight, "px")
|
|
159
|
-
},
|
|
161
|
+
}, style),
|
|
160
162
|
className: cx('t-agent-chat-container', className, {
|
|
161
163
|
't-agent-chat-container-keyboard-show': keyboardHeight > 0
|
|
162
164
|
})
|
|
@@ -9,6 +9,8 @@ interface Props {
|
|
|
9
9
|
text: string;
|
|
10
10
|
customBlockTypes: string[];
|
|
11
11
|
renderBlock: (block: MarkdownBlock) => React.ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
style?: React.CSSProperties;
|
|
12
14
|
}
|
|
13
15
|
declare const _default: React.MemoExoticComponent<(props: Props) => React.JSX.Element>;
|
|
14
16
|
export default _default;
|
|
@@ -15,7 +15,9 @@ const MarkdownRender = props => {
|
|
|
15
15
|
prefix,
|
|
16
16
|
text,
|
|
17
17
|
customBlockTypes,
|
|
18
|
-
renderBlock
|
|
18
|
+
renderBlock,
|
|
19
|
+
className,
|
|
20
|
+
style
|
|
19
21
|
} = props;
|
|
20
22
|
const [parser, setParser] = useState(() => {
|
|
21
23
|
return new BlockParser(prefix, customBlockTypes, "h2w__main h2w__".concat(theme));
|
|
@@ -28,7 +30,8 @@ const MarkdownRender = props => {
|
|
|
28
30
|
}, [text, parser]);
|
|
29
31
|
const sendAction = useSendAction();
|
|
30
32
|
return /*#__PURE__*/React.createElement(View, {
|
|
31
|
-
className: "t-agent-markdown-render"
|
|
33
|
+
className: "t-agent-markdown-render ".concat(className || ''),
|
|
34
|
+
style: style
|
|
32
35
|
}, blocks.map(block => {
|
|
33
36
|
const {
|
|
34
37
|
id,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "core-js/modules/es.string.trim.js";
|
|
1
2
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
3
|
import "core-js/modules/esnext.iterator.filter.js";
|
|
3
4
|
import "core-js/modules/esnext.iterator.map.js";
|
|
@@ -42,7 +43,7 @@ export default function MessageInput(props) {
|
|
|
42
43
|
}
|
|
43
44
|
});
|
|
44
45
|
const hasMore = !!agent.plugins.assistant.options.multiModal;
|
|
45
|
-
const isMore = !text.length && hasMore;
|
|
46
|
+
const isMore = !text.trim().length && hasMore;
|
|
46
47
|
const send = async inputBlocks => {
|
|
47
48
|
if (!(inputBlocks !== null && inputBlocks !== void 0 && inputBlocks.length) || attachmentInput.uploading || responding) {
|
|
48
49
|
return;
|
|
@@ -228,7 +229,8 @@ export default function MessageInput(props) {
|
|
|
228
229
|
});
|
|
229
230
|
}
|
|
230
231
|
return /*#__PURE__*/React.createElement(View, {
|
|
231
|
-
className: "".concat(props.className || '', " t-agent-message-input")
|
|
232
|
+
className: "".concat(props.className || '', " t-agent-message-input"),
|
|
233
|
+
style: props.style
|
|
232
234
|
}, /*#__PURE__*/React.createElement(View, {
|
|
233
235
|
className: "t-agent-message-input-container"
|
|
234
236
|
}, props.renderTop, !!uploaded.length && /*#__PURE__*/React.createElement(ScrollView, {
|
|
@@ -2,6 +2,9 @@ import './index.less';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
interface Props {
|
|
4
4
|
className?: string;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
wrapperClassName?: string;
|
|
7
|
+
wrapperStyle?: React.CSSProperties;
|
|
5
8
|
roleSide?: {
|
|
6
9
|
user?: 'start' | 'end' | string;
|
|
7
10
|
assistant?: 'start' | 'end' | string;
|
|
@@ -16,7 +16,10 @@ import { useSleep } from '../hooks/useSleep';
|
|
|
16
16
|
export default function MessageList(props) {
|
|
17
17
|
const {
|
|
18
18
|
className,
|
|
19
|
-
roleSide
|
|
19
|
+
roleSide,
|
|
20
|
+
style,
|
|
21
|
+
wrapperClassName,
|
|
22
|
+
wrapperStyle
|
|
20
23
|
} = props;
|
|
21
24
|
const {
|
|
22
25
|
messages
|
|
@@ -76,10 +79,12 @@ export default function MessageList(props) {
|
|
|
76
79
|
scrollTop
|
|
77
80
|
};
|
|
78
81
|
return /*#__PURE__*/React.createElement(View, {
|
|
79
|
-
className: "t-agent-message-list",
|
|
80
|
-
"data-testid": "t-agent-message-list"
|
|
82
|
+
className: "t-agent-message-list ".concat(wrapperClassName || ''),
|
|
83
|
+
"data-testid": "t-agent-message-list",
|
|
84
|
+
style: wrapperStyle
|
|
81
85
|
}, /*#__PURE__*/React.createElement(ScrollView, _extends({
|
|
82
86
|
className: "".concat(className || '', " t-agent-message-list-scroll"),
|
|
87
|
+
style: style,
|
|
83
88
|
id: id
|
|
84
89
|
}, scrollProps, {
|
|
85
90
|
refresherTriggered: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/t-agent-ui-ray",
|
|
3
|
-
"version": "0.1.0-beta-
|
|
3
|
+
"version": "0.1.0-beta-13",
|
|
4
4
|
"author": "Tuya.inc",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"@types/echarts": "^4.9.22",
|
|
42
42
|
"@types/markdown-it": "^14.1.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "d2c04d4fea714b9b75420b24c0971a6f6494780a"
|
|
45
45
|
}
|