@ray-js/t-agent-ui-ray 0.1.0-beta-14 → 0.1.0-beta-16
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/MessageList/index.d.ts +0 -4
- package/dist/MessageList/index.js +1 -2
- package/dist/MessageList/index.less +0 -1
- package/dist/tiles/BubbleTile/index.js +9 -2
- package/dist/tiles/WorkflowTile/RollBack/index.d.ts +5 -0
- package/dist/tiles/WorkflowTile/RollBack/index.js +34 -0
- package/dist/tiles/WorkflowTile/RollBack/index.less +20 -0
- package/dist/tiles/WorkflowTile/RollBack/workflow-rollback.png +0 -0
- package/package.json +2 -2
|
@@ -15,10 +15,6 @@ interface Props {
|
|
|
15
15
|
count: number;
|
|
16
16
|
/** 超过限制时显示的提示文本 */
|
|
17
17
|
tipText: string;
|
|
18
|
-
/** 提示文本的样式 */
|
|
19
|
-
tipStyle?: React.CSSProperties;
|
|
20
|
-
/** 提示文本的类名 */
|
|
21
|
-
tipClassName?: string;
|
|
22
18
|
};
|
|
23
19
|
}
|
|
24
20
|
export default function MessageList(props: Props): React.JSX.Element;
|
|
@@ -109,8 +109,7 @@ export default function MessageList(props) {
|
|
|
109
109
|
side: side
|
|
110
110
|
});
|
|
111
111
|
}), historyLimit && historyLimit.count < reversed.length && /*#__PURE__*/React.createElement(View, {
|
|
112
|
-
className: "t-agent-message-list-history-tip
|
|
113
|
-
style: historyLimit.tipStyle
|
|
112
|
+
className: "t-agent-message-list-history-tip"
|
|
114
113
|
}, historyLimit.tipText), /*#__PURE__*/React.createElement(View, {
|
|
115
114
|
className: "t-agent-message-list-padding-start"
|
|
116
115
|
})));
|
|
@@ -3,6 +3,7 @@ import "core-js/modules/es.json.stringify.js";
|
|
|
3
3
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
4
4
|
import "core-js/modules/esnext.iterator.find.js";
|
|
5
5
|
import "core-js/modules/esnext.iterator.map.js";
|
|
6
|
+
import "core-js/modules/esnext.iterator.some.js";
|
|
6
7
|
import "core-js/modules/web.dom-collections.iterator.js";
|
|
7
8
|
import './index.less';
|
|
8
9
|
import { View } from '@ray-js/components';
|
|
@@ -15,8 +16,9 @@ import noticeSvg from './notice.svg';
|
|
|
15
16
|
import noticeWarnSvg from './notice-warn.svg';
|
|
16
17
|
import { useChatAgent, useTranslate, useLongPress } from '../../hooks';
|
|
17
18
|
import LongPressActionMenu from '../../LongPressActionMenu';
|
|
19
|
+
import RollBack from '../WorkflowTile/RollBack';
|
|
18
20
|
const BubbleTile = props => {
|
|
19
|
-
var _message$meta$request;
|
|
21
|
+
var _message$meta$request, _workflowTile$data;
|
|
20
22
|
const agent = useChatAgent();
|
|
21
23
|
const {
|
|
22
24
|
message,
|
|
@@ -100,6 +102,9 @@ const BubbleTile = props => {
|
|
|
100
102
|
disabled: loading
|
|
101
103
|
});
|
|
102
104
|
const showAbortedMessage = bubbleStatus === BubbleTileStatus.ABORTED;
|
|
105
|
+
const showRollBack = side === 'start' && children.some(child => child.type === 'workflow');
|
|
106
|
+
const workflowTile = children.find(child => child.type === 'workflow');
|
|
107
|
+
const workflowNode = workflowTile === null || workflowTile === void 0 || (_workflowTile$data = workflowTile.data) === null || _workflowTile$data === void 0 ? void 0 : _workflowTile$data.nodeId;
|
|
103
108
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, _extends({
|
|
104
109
|
className: "t-agent-bubble-tile t-agent-bubble-tile-".concat(side),
|
|
105
110
|
"data-testid": "t-agent-bubble-tile"
|
|
@@ -123,7 +128,9 @@ const BubbleTile = props => {
|
|
|
123
128
|
}, t('t-agent.message.bubble.aborted'))), side === 'start' && /*#__PURE__*/React.createElement(ErrorNotice, {
|
|
124
129
|
bubbleStatus: bubbleStatus,
|
|
125
130
|
showInfo: showInfo
|
|
126
|
-
})), /*#__PURE__*/React.createElement(LongPressActionMenu, menuProps)
|
|
131
|
+
})), /*#__PURE__*/React.createElement(LongPressActionMenu, menuProps), showRollBack && !isLatestMessage && workflowNode && /*#__PURE__*/React.createElement(RollBack, {
|
|
132
|
+
nodeId: workflowNode
|
|
133
|
+
}));
|
|
127
134
|
};
|
|
128
135
|
export default /*#__PURE__*/React.memo(BubbleTile);
|
|
129
136
|
const ErrorNotice = /*#__PURE__*/memo(_ref => {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Image, View } from '@ray-js/ray';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import rollback from './workflow-rollback.png';
|
|
4
|
+
import { useChatAgent } from '../../../hooks';
|
|
5
|
+
import './index.less';
|
|
6
|
+
export default function RollBack(props) {
|
|
7
|
+
const {
|
|
8
|
+
nodeId
|
|
9
|
+
} = props;
|
|
10
|
+
const agent = useChatAgent();
|
|
11
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
12
|
+
className: "t-agent-workflow-rollback-tile",
|
|
13
|
+
onClick: async () => {
|
|
14
|
+
const channel = agent.session.get('AIAssistant.channel');
|
|
15
|
+
const systemInfo = ty.getSystemInfoSync();
|
|
16
|
+
const lang = systemInfo.language;
|
|
17
|
+
await agent.plugins.assistant.runSkill('hi', 'assistant', {
|
|
18
|
+
channel,
|
|
19
|
+
domain: 'control',
|
|
20
|
+
intent: 'backNode',
|
|
21
|
+
lang,
|
|
22
|
+
'back.node.id': nodeId,
|
|
23
|
+
device_id: undefined,
|
|
24
|
+
'text.stream': 'true',
|
|
25
|
+
'tts.disable': 'true'
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
29
|
+
src: rollback,
|
|
30
|
+
className: "t-agent-workflow-rollback-tile-image"
|
|
31
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
32
|
+
className: "t-agent-workflow-rollback-tile-text"
|
|
33
|
+
}, "\u91CD\u9009"));
|
|
34
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.t-agent-workflow-rollback-tile {
|
|
2
|
+
color: var(--app-B3-N1);
|
|
3
|
+
background-color: var(--app-B3);
|
|
4
|
+
border-radius: 9999px;
|
|
5
|
+
height: 36px;
|
|
6
|
+
margin-top: 8px;
|
|
7
|
+
width: fit-content;
|
|
8
|
+
line-height: 36px;
|
|
9
|
+
padding: 0 12px;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
.t-agent-workflow-rollback-tile-image {
|
|
14
|
+
width: 20px;
|
|
15
|
+
height: 20px;
|
|
16
|
+
margin-right: 6px;
|
|
17
|
+
}
|
|
18
|
+
.t-agent-workflow-rollback-tile-text {
|
|
19
|
+
}
|
|
20
|
+
}
|
|
Binary file
|
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-16",
|
|
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": "80ca2c156cdc14a2fd880454f3b934add239f3a7"
|
|
45
45
|
}
|