@ray-js/t-agent-ui-ray 0.0.5-beta-1
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/LICENSE.md +21 -0
- package/README-zh_CN.md +14 -0
- package/README.md +14 -0
- package/dist/ChatContainer/index.d.ts +9 -0
- package/dist/ChatContainer/index.js +124 -0
- package/dist/ChatContainer/index.less +10 -0
- package/dist/CustomCardRender/index.d.ts +8 -0
- package/dist/CustomCardRender/index.js +21 -0
- package/dist/CustomCardRender/index.less +2 -0
- package/dist/EchartsBlockRender/index.js +73 -0
- package/dist/EchartsBlockRender/index.json +3 -0
- package/dist/EchartsBlockRender/index.less +26 -0
- package/dist/EchartsBlockRender/index.rjs +15 -0
- package/dist/EchartsBlockRender/index.tyml +12 -0
- package/dist/EchartsBlockRender/loading.svg +1 -0
- package/dist/LowCodeCardRender/index.d.ts +8 -0
- package/dist/LowCodeCardRender/index.js +14 -0
- package/dist/LowCodeCardRender/index.less +2 -0
- package/dist/MarkdownRender/BlockParser.d.ts +18 -0
- package/dist/MarkdownRender/BlockParser.js +261 -0
- package/dist/MarkdownRender/index.d.ts +14 -0
- package/dist/MarkdownRender/index.js +72 -0
- package/dist/MarkdownRender/index.less +417 -0
- package/dist/MarkdownRender/theme/dark.less +65 -0
- package/dist/MarkdownRender/theme/light.less +64 -0
- package/dist/MessageInput/AsrInput.d.ts +14 -0
- package/dist/MessageInput/AsrInput.js +78 -0
- package/dist/MessageInput/icons/close-circle.svg +1 -0
- package/dist/MessageInput/icons/image.svg +1 -0
- package/dist/MessageInput/icons/loading.svg +1 -0
- package/dist/MessageInput/icons/plus.svg +1 -0
- package/dist/MessageInput/icons/send.svg +1 -0
- package/dist/MessageInput/icons/text.svg +11 -0
- package/dist/MessageInput/icons/video.svg +1 -0
- package/dist/MessageInput/icons/voice-active.svg +9 -0
- package/dist/MessageInput/icons/voice.svg +1 -0
- package/dist/MessageInput/index.d.ts +9 -0
- package/dist/MessageInput/index.js +246 -0
- package/dist/MessageInput/index.less +289 -0
- package/dist/MessageList/index.d.ts +12 -0
- package/dist/MessageList/index.js +61 -0
- package/dist/MessageList/index.less +19 -0
- package/dist/MessageRender/index.d.ts +10 -0
- package/dist/MessageRender/index.js +34 -0
- package/dist/MessageRender/index.less +14 -0
- package/dist/PrivateImage/index.d.ts +8 -0
- package/dist/PrivateImage/index.js +113 -0
- package/dist/TileRender/index.d.ts +11 -0
- package/dist/TileRender/index.js +32 -0
- package/dist/TileRender/index.less +4 -0
- package/dist/cards/WorkflowReplyCard/index.d.ts +11 -0
- package/dist/cards/WorkflowReplyCard/index.js +67 -0
- package/dist/cards/WorkflowReplyCard/index.less +37 -0
- package/dist/cards/map.d.ts +5 -0
- package/dist/cards/map.js +4 -0
- package/dist/contexts.d.ts +11 -0
- package/dist/contexts.js +16 -0
- package/dist/global.d.ts +19 -0
- package/dist/hooks/context.d.ts +11 -0
- package/dist/hooks/context.js +40 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/useAsrInput.d.ts +38 -0
- package/dist/hooks/useAsrInput.js +111 -0
- package/dist/hooks/useBlockInput.d.ts +18 -0
- package/dist/hooks/useBlockInput.js +148 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +14 -0
- package/dist/logger.d.ts +2 -0
- package/dist/logger.js +3 -0
- package/dist/renderOption.d.ts +2 -0
- package/dist/renderOption.js +76 -0
- package/dist/tiles/BubbleTile/Feedback.d.ts +8 -0
- package/dist/tiles/BubbleTile/Feedback.js +39 -0
- package/dist/tiles/BubbleTile/feedback.less +35 -0
- package/dist/tiles/BubbleTile/index.d.ts +6 -0
- package/dist/tiles/BubbleTile/index.js +123 -0
- package/dist/tiles/BubbleTile/index.less +56 -0
- package/dist/tiles/BubbleTile/notice.svg +1 -0
- package/dist/tiles/BubbleTile/thumb-down-empty.svg +1 -0
- package/dist/tiles/BubbleTile/thumb-up-fill.svg +1 -0
- package/dist/tiles/ButtonsTile/index.d.ts +5 -0
- package/dist/tiles/ButtonsTile/index.js +18 -0
- package/dist/tiles/ButtonsTile/index.less +25 -0
- package/dist/tiles/CardTile/index.d.ts +6 -0
- package/dist/tiles/CardTile/index.js +20 -0
- package/dist/tiles/CardTile/index.less +3 -0
- package/dist/tiles/DocumentsTile/index.d.ts +5 -0
- package/dist/tiles/DocumentsTile/index.js +23 -0
- package/dist/tiles/DocumentsTile/index.less +13 -0
- package/dist/tiles/ImageTile/index.d.ts +5 -0
- package/dist/tiles/ImageTile/index.js +37 -0
- package/dist/tiles/ImageTile/index.less +9 -0
- package/dist/tiles/RecommendationsTile/index.d.ts +5 -0
- package/dist/tiles/RecommendationsTile/index.js +31 -0
- package/dist/tiles/RecommendationsTile/index.less +13 -0
- package/dist/tiles/TextTile/index.d.ts +9 -0
- package/dist/tiles/TextTile/index.js +27 -0
- package/dist/tiles/TextTile/index.less +3 -0
- package/dist/tiles/TimeTile/index.d.ts +5 -0
- package/dist/tiles/TimeTile/index.js +35 -0
- package/dist/tiles/TimeTile/index.less +10 -0
- package/dist/tiles/TipTile/index.d.ts +6 -0
- package/dist/tiles/TipTile/index.js +12 -0
- package/dist/tiles/TipTile/index.less +9 -0
- package/dist/tiles/VideoTile/index.d.ts +5 -0
- package/dist/tiles/VideoTile/index.js +49 -0
- package/dist/tiles/VideoTile/index.less +37 -0
- package/dist/tiles/WorkflowTile/index.d.ts +11 -0
- package/dist/tiles/WorkflowTile/index.js +30 -0
- package/dist/tiles/WorkflowTile/index.less +31 -0
- package/dist/tiles/map.d.ts +3 -0
- package/dist/tiles/map.js +24 -0
- package/dist/types.d.ts +26 -0
- package/dist/types.js +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import './index.less';
|
|
2
|
+
import './theme/dark.less';
|
|
3
|
+
import './theme/light.less';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { MarkdownBlock } from '../types';
|
|
6
|
+
interface Props {
|
|
7
|
+
theme: string;
|
|
8
|
+
prefix: string;
|
|
9
|
+
text: string;
|
|
10
|
+
customBlockTypes: string[];
|
|
11
|
+
renderBlock: (block: MarkdownBlock) => React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: React.MemoExoticComponent<(props: Props) => React.JSX.Element>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import "core-js/modules/esnext.iterator.map.js";
|
|
2
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
3
|
+
import './index.less';
|
|
4
|
+
import './theme/dark.less';
|
|
5
|
+
import './theme/light.less';
|
|
6
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
7
|
+
import { RichText } from '@ray-js/ray';
|
|
8
|
+
import { View } from '@ray-js/components';
|
|
9
|
+
import { BlockParser } from './BlockParser';
|
|
10
|
+
import { useSendAction } from '../hooks';
|
|
11
|
+
const MarkdownRender = props => {
|
|
12
|
+
const {
|
|
13
|
+
theme,
|
|
14
|
+
prefix,
|
|
15
|
+
text,
|
|
16
|
+
customBlockTypes,
|
|
17
|
+
renderBlock
|
|
18
|
+
} = props;
|
|
19
|
+
const [parser, setParser] = useState(() => {
|
|
20
|
+
return new BlockParser(prefix, customBlockTypes, "h2w__main h2w__".concat(theme));
|
|
21
|
+
});
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
setParser(new BlockParser(prefix, customBlockTypes, "h2w__main h2w__".concat(theme)));
|
|
24
|
+
}, [theme]);
|
|
25
|
+
const blocks = useMemo(() => {
|
|
26
|
+
return parser.parse(text);
|
|
27
|
+
}, [text, parser]);
|
|
28
|
+
const sendAction = useSendAction();
|
|
29
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
30
|
+
className: "t-agent-markdown-render",
|
|
31
|
+
onClick: event => {
|
|
32
|
+
console.log('click', event);
|
|
33
|
+
}
|
|
34
|
+
}, blocks.map(block => {
|
|
35
|
+
const {
|
|
36
|
+
id,
|
|
37
|
+
type,
|
|
38
|
+
children
|
|
39
|
+
} = block;
|
|
40
|
+
if (type === 'rich-text') {
|
|
41
|
+
return /*#__PURE__*/React.createElement(RichText, {
|
|
42
|
+
className: "t-agent-markdown-render-rich-text-block",
|
|
43
|
+
key: id,
|
|
44
|
+
nodes: children,
|
|
45
|
+
onSelect: event => {
|
|
46
|
+
if (!(event !== null && event !== void 0 && event.detail)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
switch (event.detail.name) {
|
|
50
|
+
case 'img':
|
|
51
|
+
ty.previewImage({
|
|
52
|
+
urls: [event.detail.attrs.src],
|
|
53
|
+
current: 0
|
|
54
|
+
});
|
|
55
|
+
break;
|
|
56
|
+
case 'a':
|
|
57
|
+
sendAction({
|
|
58
|
+
type: 'openRoute',
|
|
59
|
+
url: event.detail.attrs.href
|
|
60
|
+
});
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
67
|
+
className: "t-agent-markdown-render-custom-block",
|
|
68
|
+
key: id
|
|
69
|
+
}, renderBlock(block));
|
|
70
|
+
}));
|
|
71
|
+
};
|
|
72
|
+
export default /*#__PURE__*/React.memo(MarkdownRender);
|
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
/*正文样式*/
|
|
2
|
+
.h2w {
|
|
3
|
+
font-family: PingFang SC, Lantinghei SC, Microsoft Yahei, Hiragino Sans GB, Microsoft Sans Serif,
|
|
4
|
+
WenQuanYi Micro Hei, sans-serif;
|
|
5
|
+
font-weight: normal;
|
|
6
|
+
font-size: 32rpx;
|
|
7
|
+
line-height: 1.8;
|
|
8
|
+
word-wrap: break-word;
|
|
9
|
+
word-break: normal;
|
|
10
|
+
/*text-align:justify;*/
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.h2w__main {
|
|
14
|
+
margin: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.h2w__img {
|
|
18
|
+
width: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**标题**/
|
|
22
|
+
.h2w__h1,
|
|
23
|
+
.h2w__h2,
|
|
24
|
+
.h2w__h3,
|
|
25
|
+
.h2w__h4,
|
|
26
|
+
.h2w__h5,
|
|
27
|
+
.h2w__h6 {
|
|
28
|
+
font-weight: bold;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**设置行间元素样式**/
|
|
32
|
+
.h2w__span,
|
|
33
|
+
.h2w__b,
|
|
34
|
+
.h2w__strong,
|
|
35
|
+
.h2w__i,
|
|
36
|
+
.h2w__em,
|
|
37
|
+
.h2w__code,
|
|
38
|
+
.h2w__sub,
|
|
39
|
+
.h2w__sup,
|
|
40
|
+
.h2w__g-emoji,
|
|
41
|
+
.h2w__mark,
|
|
42
|
+
.h2w__u,
|
|
43
|
+
.h2w__navigatorParent,
|
|
44
|
+
.h2w__ins {
|
|
45
|
+
display: inline;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.h2w__h1 {
|
|
49
|
+
border-bottom-style: double;
|
|
50
|
+
border-bottom-width: 6rpx;
|
|
51
|
+
font-size: 42rpx;
|
|
52
|
+
padding-bottom: 10rpx;
|
|
53
|
+
margin-bottom: 20rpx;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.h2w__h2 {
|
|
57
|
+
border-bottom-style: solid;
|
|
58
|
+
border-bottom-width: 1rpx;
|
|
59
|
+
font-size: 40rpx;
|
|
60
|
+
padding-bottom: 8rpx;
|
|
61
|
+
margin-bottom: 18rpx;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.h2w__h3 {
|
|
65
|
+
font-size: 38rpx;
|
|
66
|
+
padding-bottom: 6rpx;
|
|
67
|
+
margin-bottom: 12rpx;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.h2w__h4 {
|
|
71
|
+
font-size: 36rpx;
|
|
72
|
+
padding-bottom: 4rpx;
|
|
73
|
+
margin-bottom: 12rpx;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.h2w__h5 {
|
|
77
|
+
font-size: 34rpx;
|
|
78
|
+
padding-bottom: 2rpx;
|
|
79
|
+
margin-bottom: 12rpx;
|
|
80
|
+
margin-top: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.h2w__h6 {
|
|
84
|
+
margin-top: 0;
|
|
85
|
+
margin-bottom: 12rpx;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**组件父级容器**/
|
|
89
|
+
.h2w__textParent,
|
|
90
|
+
.h2w__viewParent {
|
|
91
|
+
display: inline;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.h2w__rich-textParent {
|
|
95
|
+
overflow-x: auto;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**表格**/
|
|
99
|
+
.h2w__tableParent {
|
|
100
|
+
width: 100%;
|
|
101
|
+
overflow-x: auto;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.h2w__table {
|
|
105
|
+
width: 99.99%;
|
|
106
|
+
border-collapse: collapse;
|
|
107
|
+
border-spacing: 0;
|
|
108
|
+
display: table;
|
|
109
|
+
margin-bottom: 40rpx;
|
|
110
|
+
white-space: nowrap;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.h2w__table .h2w__tr:nth-child(2n) {
|
|
114
|
+
background-color: red;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.h2w__colgroup {
|
|
118
|
+
display: table-column-group;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.h2w__col {
|
|
122
|
+
display: table-column;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.h2w__thead {
|
|
126
|
+
display: table-header-group;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.h2w__tbody {
|
|
130
|
+
display: table-row-group;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.h2w__tfoot {
|
|
134
|
+
display: table-footer-group;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.h2w__tr {
|
|
138
|
+
display: table-row;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.h2w__th,
|
|
142
|
+
.h2w__td {
|
|
143
|
+
padding: 8rpx 16rpx;
|
|
144
|
+
font-size: 28rpx;
|
|
145
|
+
border-width: 2rpx;
|
|
146
|
+
border-style: solid;
|
|
147
|
+
display: table-cell;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.h2w__th {
|
|
151
|
+
font-weight: bold;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**代码块**/
|
|
155
|
+
.h2w__pre {
|
|
156
|
+
display: block;
|
|
157
|
+
white-space: pre;
|
|
158
|
+
padding: 10rpx 14rpx 10rpx 10rpx;
|
|
159
|
+
font-size: 28rpx;
|
|
160
|
+
word-break: normal;
|
|
161
|
+
border-width: 1rpx;
|
|
162
|
+
border-style: solid;
|
|
163
|
+
margin-bottom: 40rpx;
|
|
164
|
+
overflow-x: auto;
|
|
165
|
+
tab-size: 4;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.h2w__pre .h2w__p {
|
|
169
|
+
margin: 0;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.h2w__pre .h2w__code {
|
|
173
|
+
padding: 0;
|
|
174
|
+
border: 0;
|
|
175
|
+
font-size: 100%;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.h2w__pre,
|
|
179
|
+
.h2w__code {
|
|
180
|
+
font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace,
|
|
181
|
+
'STHeitiTC-Light', 'Microsoft YaHei Light', -apple-system, system-ui, BlinkMacSystemFont;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.h2w__code {
|
|
185
|
+
padding: 4rpx 8rpx;
|
|
186
|
+
margin: 0 4rpx;
|
|
187
|
+
border-width: 1rpx;
|
|
188
|
+
border-style: solid;
|
|
189
|
+
border-radius: 8rpx;
|
|
190
|
+
font-size: 80%;
|
|
191
|
+
overflow-x: auto;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.h2w__pre .h2w__span,
|
|
195
|
+
.h2w__pre .h2w__a,
|
|
196
|
+
.h2w__pre .h2w__span,
|
|
197
|
+
.h2w__pre .h2w__b,
|
|
198
|
+
.h2w__pre .h2w__strong,
|
|
199
|
+
.h2w__pre .h2w__i,
|
|
200
|
+
.h2w__pre .h2w__em {
|
|
201
|
+
display: inline;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.h2w__pre .h2w__code {
|
|
205
|
+
white-space: pre-wrap;
|
|
206
|
+
/* width: 9999px; */
|
|
207
|
+
display: block;
|
|
208
|
+
font-size: 80%;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**列表**/
|
|
212
|
+
.h2w__ul,
|
|
213
|
+
.h2w__ol {
|
|
214
|
+
/*margin-bottom: 40rpx;*/
|
|
215
|
+
padding-left: 1rem;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.h2w__ul .h2w__ol,
|
|
219
|
+
.h2w__ol .h2w__ul {
|
|
220
|
+
margin-bottom: 0;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.h2w__li {
|
|
224
|
+
display: list-item;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**todo**/
|
|
228
|
+
.h2w__todogroup {
|
|
229
|
+
margin-bottom: 40rpx;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.h2w__todogroup .h2w__todogroup {
|
|
233
|
+
padding-left: 1.6rem;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**一级ol样式**/
|
|
237
|
+
.h2w__ol {
|
|
238
|
+
list-style-type: decimal;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**二级ol样式**/
|
|
242
|
+
.h2w__ul .h2w__ol,
|
|
243
|
+
.h2w__ol .h2w__ol {
|
|
244
|
+
list-style-type: lower-roman;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**三级ol样式**/
|
|
248
|
+
.h2w__ul .h2w__ul .h2w__ol,
|
|
249
|
+
.h2w__ul .h2w__ol .h2w__ol,
|
|
250
|
+
.h2w__ol .h2w__ul .h2w__ol,
|
|
251
|
+
.h2w__ol .h2w__ol .h2w__ol {
|
|
252
|
+
list-style-type: lower-alpha;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**一级ul样式**/
|
|
256
|
+
.h2w__ul {
|
|
257
|
+
list-style-type: disc;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**二级ul样式**/
|
|
261
|
+
.h2w__ul .h2w__ul,
|
|
262
|
+
.h2w__ol .h2w__ul {
|
|
263
|
+
list-style-type: circle;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**三级样式**/
|
|
267
|
+
.h2w__ol .h2w__ol .h2w__ul,
|
|
268
|
+
.h2w__ol .h2w__ul .h2w__ul,
|
|
269
|
+
.h2w__ul .h2w__ol .h2w__ul,
|
|
270
|
+
.h2w__ul .h2w__ul .h2w__ul {
|
|
271
|
+
list-style-type: square;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**块元素**/
|
|
275
|
+
/*.h2w__p {*/
|
|
276
|
+
/* margin: 0 0 20rpx 0;*/
|
|
277
|
+
/*}*/
|
|
278
|
+
|
|
279
|
+
.h2w__blockquote {
|
|
280
|
+
border-left-width: 8rpx;
|
|
281
|
+
border-left-style: solid;
|
|
282
|
+
padding: 0 20rpx;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**内连元素**/
|
|
286
|
+
.h2w__a,
|
|
287
|
+
.h2w__span,
|
|
288
|
+
.h2w__s,
|
|
289
|
+
.h2w__b,
|
|
290
|
+
.h2w__strong,
|
|
291
|
+
.h2w__i,
|
|
292
|
+
.h2w__em {
|
|
293
|
+
display: inline;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.h2w__b,
|
|
297
|
+
.h2w__strong {
|
|
298
|
+
font-weight: bold;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.h2w__i,
|
|
302
|
+
.h2w__em {
|
|
303
|
+
font-style: italic;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**文本删除线**/
|
|
307
|
+
.h2w__s,
|
|
308
|
+
.h2w__strike,
|
|
309
|
+
.h2w__del {
|
|
310
|
+
text-decoration: line-through;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**文本下划线**/
|
|
314
|
+
.h2w__ins,
|
|
315
|
+
.h2w__u {
|
|
316
|
+
text-decoration: underline;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**链接**/
|
|
320
|
+
.h2w__a {
|
|
321
|
+
margin: 0 8rpx;
|
|
322
|
+
border-bottom-width: 1rpx;
|
|
323
|
+
border-bottom-style: solid;
|
|
324
|
+
line-height: 1;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.h2w__hr {
|
|
328
|
+
height: 8rpx;
|
|
329
|
+
margin: 40rpx 0;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**荧光标记**/
|
|
333
|
+
.h2w__mark {
|
|
334
|
+
border-radius: 4rpx;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**上标、下标**/
|
|
338
|
+
.h2w__sup,
|
|
339
|
+
.h2w__sub {
|
|
340
|
+
font-size: 75%;
|
|
341
|
+
position: relative;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.h2w__sup {
|
|
345
|
+
top: -0.5em;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.h2w__sub {
|
|
349
|
+
bottom: -0.25em;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**emoji表情**/
|
|
353
|
+
.h2w__g-emoji {
|
|
354
|
+
margin: 0 0.1em;
|
|
355
|
+
font-family: 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**内置元素**/
|
|
359
|
+
/*image,*/
|
|
360
|
+
/*video {*/
|
|
361
|
+
/* max-width: 100%;*/
|
|
362
|
+
/*}*/
|
|
363
|
+
|
|
364
|
+
/*video {*/
|
|
365
|
+
/* width: 100%;*/
|
|
366
|
+
/* margin: 10rpx auto;*/
|
|
367
|
+
/*}*/
|
|
368
|
+
|
|
369
|
+
/*image {*/
|
|
370
|
+
/* height: auto;*/
|
|
371
|
+
/* vertical-align: middle;*/
|
|
372
|
+
/*}*/
|
|
373
|
+
|
|
374
|
+
/*video {*/
|
|
375
|
+
/* height: 220px;*/
|
|
376
|
+
/* font-size: 0;*/
|
|
377
|
+
/*}*/
|
|
378
|
+
|
|
379
|
+
.h2w__latex--line {
|
|
380
|
+
margin: 4rpx 8rpx;
|
|
381
|
+
vertical-align: middle;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.h2w__latex--block {
|
|
385
|
+
display: block;
|
|
386
|
+
margin: 1em auto;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.h2w__yuml {
|
|
390
|
+
display: block;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.h2w__yumlBox {
|
|
394
|
+
width: 100%;
|
|
395
|
+
overflow-x: auto;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.h2w__yumlView {
|
|
399
|
+
margin: 0 auto;
|
|
400
|
+
padding-bottom: 40rpx;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**代码行号**/
|
|
404
|
+
.h2w__lineNum {
|
|
405
|
+
text-align: right;
|
|
406
|
+
float: left;
|
|
407
|
+
padding: 0;
|
|
408
|
+
margin: 0 1em 0 0;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.h2w__lineNumLine {
|
|
412
|
+
list-style: none;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.t-agent-markdown-render-rich-text-block {
|
|
416
|
+
//pointer-events: none;
|
|
417
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*正文样式*/
|
|
2
|
+
.h2w__dark {
|
|
3
|
+
/*color:#ddd;*/
|
|
4
|
+
/*background-color:#000;*/
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**标题**/
|
|
8
|
+
.h2w__dark .h2w__h1,
|
|
9
|
+
.h2w__dark .h2w__h2 {
|
|
10
|
+
border-color:#3d3d3d;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**表格**/
|
|
15
|
+
.h2w__dark .h2w__thead .h2w__tr {
|
|
16
|
+
background-color:#1f1f1f;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.h2w__dark .h2w__table .h2w__tr:nth-child(2n){
|
|
20
|
+
background-color:#090909;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.h2w__dark .h2w__th,
|
|
24
|
+
.h2w__dark .h2w__td {
|
|
25
|
+
border-color:#333;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/**代码块**/
|
|
30
|
+
.h2w__dark .h2w__pre,
|
|
31
|
+
.h2w__dark .h2w__pre .h2w__code {
|
|
32
|
+
background-color: #1b1b1b;
|
|
33
|
+
border-color: #262626;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.h2w__dark .h2w__code {
|
|
37
|
+
background-color:#272822;
|
|
38
|
+
border-color:#1b1c18;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**块元素**/
|
|
42
|
+
.h2w__dark .h2w__blockquote {
|
|
43
|
+
border-left-color:#10230f;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**内连元素**/
|
|
47
|
+
.h2w__dark .h2w__a {
|
|
48
|
+
color: #1aad16;
|
|
49
|
+
border-color: #4d804b;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.h2w__dark .h2w__hr {
|
|
53
|
+
background-color:#242424;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.h2w__dark .h2w__mark {
|
|
57
|
+
background:yellow;
|
|
58
|
+
color:black;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.h2w__dark .h2w__lineNum {
|
|
62
|
+
color:#494949;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**代码高亮样式**/
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*正文样式*/
|
|
2
|
+
.h2w__light {
|
|
3
|
+
/*color: #000;*/
|
|
4
|
+
/*background-color: white;*/
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**标题**/
|
|
8
|
+
.h2w__light .h2w__h1,
|
|
9
|
+
.h2w__light .h2w__h2 {
|
|
10
|
+
border-color: #eee;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**表格**/
|
|
15
|
+
.h2w__light .h2w__thead .h2w__tr {
|
|
16
|
+
background-color: #f6f8fa;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.h2w__light .h2w__table .h2w__tr:nth-child(2n) {
|
|
20
|
+
background-color: #fbfcfd;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.h2w__light .h2w__th,
|
|
24
|
+
.h2w__light .h2w__td {
|
|
25
|
+
border-color: #dfe2e5;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/**代码块**/
|
|
30
|
+
.h2w__light .h2w__pre {
|
|
31
|
+
background-color: #f6f8fa;
|
|
32
|
+
border-color: #eaedf0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.h2w__light .h2w__code {
|
|
36
|
+
background-color: #f6f8fa;
|
|
37
|
+
border-color: #eaedf0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**块元素**/
|
|
41
|
+
.h2w__light .h2w__blockquote {
|
|
42
|
+
border-left-color: #dfe2e5;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**内连元素**/
|
|
46
|
+
.h2w__light .h2w__a {
|
|
47
|
+
color: #427ff7;
|
|
48
|
+
border: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.h2w__light .h2w__hr {
|
|
52
|
+
background-color: #eee;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.h2w__light .h2w__mark {
|
|
56
|
+
background: yellow;
|
|
57
|
+
color: black;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.h2w__light .h2w__lineNum {
|
|
61
|
+
color: #ccc;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**代码高亮样式**/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import './index.less';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface Props {
|
|
4
|
+
onBack: () => void;
|
|
5
|
+
sendDisabled: boolean;
|
|
6
|
+
onSend: (text: string) => Promise<any>;
|
|
7
|
+
onError: (error: Error) => void;
|
|
8
|
+
onMoreClick: () => void;
|
|
9
|
+
closeMore: () => void;
|
|
10
|
+
moreOpen: boolean;
|
|
11
|
+
hasMore: boolean;
|
|
12
|
+
}
|
|
13
|
+
export default function AsrInput(props: Props): React.JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import './index.less';
|
|
2
|
+
import { Button, Text, View, Textarea } from '@ray-js/components';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import cx from 'clsx';
|
|
5
|
+
import { useAsrInput } from '../hooks';
|
|
6
|
+
export default function AsrInput(props) {
|
|
7
|
+
const {
|
|
8
|
+
sendDisabled,
|
|
9
|
+
onMoreClick,
|
|
10
|
+
moreOpen,
|
|
11
|
+
closeMore,
|
|
12
|
+
hasMore
|
|
13
|
+
} = props;
|
|
14
|
+
const {
|
|
15
|
+
state,
|
|
16
|
+
press,
|
|
17
|
+
release,
|
|
18
|
+
clear,
|
|
19
|
+
text,
|
|
20
|
+
setText,
|
|
21
|
+
currentText,
|
|
22
|
+
incomingText
|
|
23
|
+
} = useAsrInput(props);
|
|
24
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
25
|
+
className: "t-agent-message-input-voice-bar"
|
|
26
|
+
}, (state === 'recording' || state === 'pending') && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, {
|
|
27
|
+
className: "t-agent-message-input-voice-mask"
|
|
28
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
29
|
+
className: "t-agent-message-input-voice-bubble"
|
|
30
|
+
}, state === 'recording' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, currentText), /*#__PURE__*/React.createElement(Text, {
|
|
31
|
+
className: "t-agent-message-input-voice-bubble-predicted"
|
|
32
|
+
}, incomingText)) : /*#__PURE__*/React.createElement(Textarea, {
|
|
33
|
+
autoHeight: true,
|
|
34
|
+
className: "t-agent-message-input-voice-bubble-input",
|
|
35
|
+
value: text,
|
|
36
|
+
onInput: event => setText(event.value)
|
|
37
|
+
}))), /*#__PURE__*/React.createElement(Button, {
|
|
38
|
+
className: cx('t-agent-message-input-button', {
|
|
39
|
+
't-agent-message-input-button-text': state === 'init',
|
|
40
|
+
't-agent-message-input-button-hide': state === 'recording',
|
|
41
|
+
't-agent-message-input-button-clear': state === 'pending'
|
|
42
|
+
}),
|
|
43
|
+
onClick: () => {
|
|
44
|
+
if (state === 'init') {
|
|
45
|
+
clear();
|
|
46
|
+
props.onBack();
|
|
47
|
+
} else if (state === 'pending') {
|
|
48
|
+
clear();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
52
|
+
className: "t-agent-message-input-button t-agent-message-input-button-voice-active",
|
|
53
|
+
disabled: sendDisabled,
|
|
54
|
+
onTouchStart: () => {
|
|
55
|
+
press();
|
|
56
|
+
closeMore();
|
|
57
|
+
},
|
|
58
|
+
onClick: release,
|
|
59
|
+
onTouchCancel: release,
|
|
60
|
+
onTouchEnd: release
|
|
61
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
62
|
+
disabled: sendDisabled,
|
|
63
|
+
className: cx('t-agent-message-input-button', {
|
|
64
|
+
't-agent-message-input-button-voice-send': state === 'pending',
|
|
65
|
+
't-agent-message-input-button-hide': state === 'recording',
|
|
66
|
+
't-agent-message-input-button-more': state === 'init' && hasMore,
|
|
67
|
+
't-agent-message-input-button-more-open': state === 'init' && moreOpen
|
|
68
|
+
}),
|
|
69
|
+
onClick: () => {
|
|
70
|
+
if (state === 'init' && hasMore) {
|
|
71
|
+
onMoreClick();
|
|
72
|
+
} else {
|
|
73
|
+
props.onSend(text);
|
|
74
|
+
clear();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}));
|
|
78
|
+
}
|