lke-component 1.1.19-beta-15 → 1.1.19-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/README.md +227 -32
- package/package.json +1 -1
- package/README.en.md +0 -206
package/README.md
CHANGED
|
@@ -1,6 +1,211 @@
|
|
|
1
1
|
# lke-component
|
|
2
2
|
|
|
3
|
-
[English](
|
|
3
|
+
[English](#english) | [中文](#中文)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<a id="english"></a>
|
|
8
|
+
|
|
9
|
+
## English
|
|
10
|
+
|
|
11
|
+
Message rendering component for LKE (Large Knowledge Engine) conversations, designed for Vue2 and React projects.
|
|
12
|
+
|
|
13
|
+
For other environments:
|
|
14
|
+
* Vue3 projects: [Link](https://www.npmjs.com/package/lke-component-vue3)
|
|
15
|
+
* React projects: [Link](#usage-in-react-projects)
|
|
16
|
+
* Mini Programs: [Link](https://www.npmjs.com/package/lke-utils)
|
|
17
|
+
|
|
18
|
+
### Components
|
|
19
|
+
|
|
20
|
+
Four components are provided: `LkeMsg`, `MsgContent`, `MsgLoading`, `MsgThought`
|
|
21
|
+
|
|
22
|
+
**MsgLoading**: Shows model loading state
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
props:
|
|
26
|
+
loadingIcon: String, // Message icon, displays if provided
|
|
27
|
+
loadingMessage: Boolean, // Whether in loading state
|
|
28
|
+
loadingText: String, // Loading message content
|
|
29
|
+
transferStatus: Boolean // Transfer to human agent status
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**MsgContent**: Renders Markdown content
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
props:
|
|
36
|
+
content: String, // Markdown message
|
|
37
|
+
isFinal: Boolean, // Whether the message output is complete
|
|
38
|
+
isReplaceLinks: Boolean, // Whether to replace links with third-party prompts
|
|
39
|
+
styleObj: Object, // Style object for MD message body
|
|
40
|
+
clazzTable: String, // Table class for MD message body (default styles will be added)
|
|
41
|
+
clazzMd: String, // Class for MD message body
|
|
42
|
+
anchorAttributes: Object, // Props passed to vue-markdown, see example
|
|
43
|
+
linkify: Boolean // Props passed to vue-markdown, see example
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**LkeMsg**: Aggregated component combining the above
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
props:
|
|
50
|
+
LoadingIcon: String, // CDN URL for loading icon, not displayed if not provided
|
|
51
|
+
type: String, // Current message type, usually 'reply' or 'token_stat'
|
|
52
|
+
isReplaceLinks: Boolean, // Whether to replace with LLM third-party link prompts
|
|
53
|
+
showProcedures: Boolean, // Whether to show model output status
|
|
54
|
+
transferStatus: Boolean, // Transfer to human agent status
|
|
55
|
+
clazz: String, // Class name for outer wrapper div
|
|
56
|
+
item: Object, // Current message content
|
|
57
|
+
styleObj: Object, // Style object for MD message body
|
|
58
|
+
clazzTable: String, // Table class for MD message body, default styles: table-style, table
|
|
59
|
+
clazzMd: String, // Class for MD message body, default style: answer-md
|
|
60
|
+
anchorAttributes: Object, // Props passed to vue-markdown, see example
|
|
61
|
+
linkify: Boolean // Props passed to vue-markdown, see example
|
|
62
|
+
printCount: Number | undefined // Characters per print for timing control
|
|
63
|
+
hideCursorPoint: Boolean | undefined // Whether to show print cursor icon
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**MsgThought**: Renders DeepSeek thinking content
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
props:
|
|
70
|
+
content: String // Thinking content
|
|
71
|
+
title: String // Title, e.g., "Thinking Complete"
|
|
72
|
+
titleIcon: String // Small icon, 16x16px
|
|
73
|
+
nodeName: String // Optional, e.g., "deepseek"
|
|
74
|
+
status: String // Thinking status: 'success', 'failed', 'processing', 'stop'
|
|
75
|
+
elapsed: number // Time spent thinking in milliseconds, e.g., 17485
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Usage in Vue2 Projects
|
|
79
|
+
|
|
80
|
+
1. Install and import
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
// Import in Vue entry file
|
|
84
|
+
import lkeComponent from 'lke-component';
|
|
85
|
+
Vue.use(lkeComponent);
|
|
86
|
+
|
|
87
|
+
// Use in Vue pages
|
|
88
|
+
<!-- Loading toggle + Markdown rendering -->
|
|
89
|
+
<LkeMsg :loadingIcon="loadingIcon" :loadingMessage="item.loading_message" :loadingText="item.text" :transferStatus="transferStatus" :isReplaceLinks="true" :content="item.content" :isFinal="item.is_final" />
|
|
90
|
+
|
|
91
|
+
<!-- Show temporary [Thinking...] message when not transferring to human -->
|
|
92
|
+
<MsgLoading :loadingIcon="loadingIcon" :loadingMessage="item.loading_message" :loadingText="item.text" :transferStatus="transferStatus" />
|
|
93
|
+
|
|
94
|
+
<!-- DeepSeek thinking content rendering -->
|
|
95
|
+
<MsgThought
|
|
96
|
+
:content="thinkingContent"
|
|
97
|
+
:title="thinkingTitle"
|
|
98
|
+
:titleIcon="test.png"
|
|
99
|
+
:nodeName="deepseek"
|
|
100
|
+
:status="success"
|
|
101
|
+
:elapsed="17485"
|
|
102
|
+
/>
|
|
103
|
+
|
|
104
|
+
<!-- Markdown rendering -->
|
|
105
|
+
<MsgContent :isReplaceLinks="true" :loadingMessage="item.loading_message" :content="item.content" :isFinal="item.is_final" :printCount="1" :hideCursorPoint="true"/>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
2. Import method
|
|
109
|
+
|
|
110
|
+
```js
|
|
111
|
+
// Import in Vue file, e.g., component.vue
|
|
112
|
+
import { MsgLoading, MsgContent, MsgThought } from '@tencent/lke-component';
|
|
113
|
+
|
|
114
|
+
// Register components
|
|
115
|
+
export default {
|
|
116
|
+
components: {
|
|
117
|
+
MsgContent,
|
|
118
|
+
MsgLoading,
|
|
119
|
+
MsgThought,
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Use in template
|
|
124
|
+
<MsgLoading :loadingIcon="loadingIcon" :loadingMessage="item.loading_message" :loadingText="item.text" :transferStatus="transferStatus" />
|
|
125
|
+
|
|
126
|
+
<!-- Markdown rendering -->
|
|
127
|
+
<MsgContent :isReplaceLinks="true" :loadingMessage="item.loading_message" :content="item.content" :isFinal="item.is_final" />
|
|
128
|
+
|
|
129
|
+
<!-- DeepSeek thinking content rendering -->
|
|
130
|
+
<MsgThought
|
|
131
|
+
:content="thinkingContent"
|
|
132
|
+
:title="thinkingTitle"
|
|
133
|
+
:titleIcon="test.png"
|
|
134
|
+
:nodeName="deepseek"
|
|
135
|
+
:status="success"
|
|
136
|
+
:elapsed="17485"
|
|
137
|
+
/>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Usage in React Projects
|
|
141
|
+
|
|
142
|
+
```jsx
|
|
143
|
+
import { MsgContent, MsgThought } from "lke-component/react";
|
|
144
|
+
import "lke-component/css";
|
|
145
|
+
|
|
146
|
+
const App = () => {
|
|
147
|
+
const [list, setList] = useState([{
|
|
148
|
+
content: "Nice weather today<b>?</b>",
|
|
149
|
+
isFinal: true,
|
|
150
|
+
loadingMessage: false,
|
|
151
|
+
isReplaceLinks: false,
|
|
152
|
+
styleObj: {},
|
|
153
|
+
clazzTable: '',
|
|
154
|
+
clazzMd: '',
|
|
155
|
+
anchorAttributes: {},
|
|
156
|
+
id: 1,
|
|
157
|
+
linkify: false,
|
|
158
|
+
thoughts: [{
|
|
159
|
+
title: "Thinking Complete",
|
|
160
|
+
titleIcon: 'test.png',
|
|
161
|
+
nodeName: "deepseek",
|
|
162
|
+
status: "success",
|
|
163
|
+
detailVisible: true,
|
|
164
|
+
elapsed: 17485,
|
|
165
|
+
content: `Okay, I need to process the user's question...`,
|
|
166
|
+
}]
|
|
167
|
+
}]);
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<div className="main">
|
|
171
|
+
{list.map((item, index) => (
|
|
172
|
+
<div>
|
|
173
|
+
{item.thoughts.map((thought, index) => (
|
|
174
|
+
<MsgThought
|
|
175
|
+
key={index}
|
|
176
|
+
detailVisible={thought.detailVisible}
|
|
177
|
+
content={thought.content}
|
|
178
|
+
title={thought.title}
|
|
179
|
+
titleIcon={thought.titleIcon}
|
|
180
|
+
nodeName={thought.nodeName}
|
|
181
|
+
status={thought.status}
|
|
182
|
+
elapsed={thought.elapsed}
|
|
183
|
+
onTitleClick={() => void 0}
|
|
184
|
+
/>
|
|
185
|
+
))}
|
|
186
|
+
</div>
|
|
187
|
+
<MsgContent
|
|
188
|
+
key={id}
|
|
189
|
+
content={item.content}
|
|
190
|
+
isFinal={item.isFinal}
|
|
191
|
+
styleObj={item.styleObj}
|
|
192
|
+
clazzTable={item.clazzTable}
|
|
193
|
+
clazzMd={item.clazzMd}
|
|
194
|
+
anchorAttributes={item.anchorAttributes}
|
|
195
|
+
linkify={item.linkify}
|
|
196
|
+
isReplaceLinks={item.isReplaceLinks}
|
|
197
|
+
/>
|
|
198
|
+
))}
|
|
199
|
+
</div>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
<a id="中文"></a>
|
|
207
|
+
|
|
208
|
+
## 中文
|
|
4
209
|
|
|
5
210
|
知识引擎大模型对话消息渲染组件,适用于基于vue2和react搭建的项目。
|
|
6
211
|
|
|
@@ -9,7 +214,7 @@
|
|
|
9
214
|
* 基于react的项目参考 [链接](#在react项目中使用)
|
|
10
215
|
* 小程序参考 [链接](https://www.npmjs.com/package/lke-utils)
|
|
11
216
|
|
|
12
|
-
|
|
217
|
+
### 组件介绍
|
|
13
218
|
|
|
14
219
|
提供四个组件:LkeMsg、MsgContent、MsgLoading、MsgThought
|
|
15
220
|
|
|
@@ -69,7 +274,7 @@ props:
|
|
|
69
274
|
elapsed: number // 思考花费时间, 毫秒,如17485
|
|
70
275
|
```
|
|
71
276
|
|
|
72
|
-
|
|
277
|
+
### 在vue2项目里使用
|
|
73
278
|
|
|
74
279
|
1. install方式引入
|
|
75
280
|
|
|
@@ -80,7 +285,7 @@ Vue.use(lkeComponent);
|
|
|
80
285
|
|
|
81
286
|
// 在对应的vue页面里面使用组件
|
|
82
287
|
<!-- Loading切换 + Markdown渲染 -->
|
|
83
|
-
<LkeMsg :loadingIcon="loadingIcon" :loadingMessage="item.loading_message" :loadingText="item.text" :transferStatus="transferStatus" :isReplaceLinks="true" :content="item.content" :isFinal="item.is_final"
|
|
288
|
+
<LkeMsg :loadingIcon="loadingIcon" :loadingMessage="item.loading_message" :loadingText="item.text" :transferStatus="transferStatus" :isReplaceLinks="true" :content="item.content" :isFinal="item.is_final" />
|
|
84
289
|
|
|
85
290
|
<!-- 非转人工情况下, 展示临时[正在思考中]消息 -->
|
|
86
291
|
<MsgLoading :loadingIcon="loadingIcon" :loadingMessage="item.loading_message" :loadingText="item.text" :transferStatus="transferStatus" />
|
|
@@ -96,7 +301,7 @@ Vue.use(lkeComponent);
|
|
|
96
301
|
/>
|
|
97
302
|
|
|
98
303
|
<!-- Markdown渲染 -->
|
|
99
|
-
<MsgContent :isReplaceLinks="true" :loadingMessage="item.loading_message" :content="item.content" :isFinal="item.is_final" :
|
|
304
|
+
<MsgContent :isReplaceLinks="true" :loadingMessage="item.loading_message" :content="item.content" :isFinal="item.is_final" :printCount="1" :hideCursorPoint="true"/>
|
|
100
305
|
```
|
|
101
306
|
|
|
102
307
|
2. import方式引入
|
|
@@ -118,7 +323,7 @@ export default {
|
|
|
118
323
|
<MsgLoading :loadingIcon="loadingIcon" :loadingMessage="item.loading_message" :loadingText="item.text" :transferStatus="transferStatus" />
|
|
119
324
|
|
|
120
325
|
<!-- Markdown渲染 -->
|
|
121
|
-
<MsgContent :isReplaceLinks="true" :loadingMessage="item.loading_message" :content="item.content" :isFinal="item.is_final"
|
|
326
|
+
<MsgContent :isReplaceLinks="true" :loadingMessage="item.loading_message" :content="item.content" :isFinal="item.is_final" />
|
|
122
327
|
|
|
123
328
|
<!-- deepseek 思考内容渲染 -->
|
|
124
329
|
<MsgThought
|
|
@@ -131,7 +336,7 @@ export default {
|
|
|
131
336
|
/>
|
|
132
337
|
```
|
|
133
338
|
|
|
134
|
-
|
|
339
|
+
### 在react项目中使用
|
|
135
340
|
|
|
136
341
|
```jsx
|
|
137
342
|
import { MsgContent, MsgThought } from "lke-component/react";
|
|
@@ -140,33 +345,23 @@ import "lke-component/css";
|
|
|
140
345
|
const App = () => {
|
|
141
346
|
const [list, setList] = useState([{
|
|
142
347
|
content: "天气不错哦<b>?</b>",
|
|
143
|
-
isFinal: true,
|
|
144
|
-
loadingMessage: false,
|
|
145
|
-
isReplaceLinks: false,
|
|
146
|
-
styleObj: {},
|
|
147
|
-
clazzTable: '',
|
|
148
|
-
clazzMd: '',
|
|
149
|
-
anchorAttributes: {},
|
|
348
|
+
isFinal: true,
|
|
349
|
+
loadingMessage: false,
|
|
350
|
+
isReplaceLinks: false,
|
|
351
|
+
styleObj: {},
|
|
352
|
+
clazzTable: '',
|
|
353
|
+
clazzMd: '',
|
|
354
|
+
anchorAttributes: {},
|
|
150
355
|
id: 1,
|
|
151
|
-
linkify: false,
|
|
356
|
+
linkify: false,
|
|
152
357
|
thoughts: [{
|
|
153
|
-
title: "思考完成",
|
|
154
|
-
titleIcon: 'test.png',
|
|
155
|
-
nodeName: "deepseek",
|
|
156
|
-
status: "success",
|
|
157
|
-
detailVisible: true,
|
|
158
|
-
elapsed: 17485,
|
|
159
|
-
content:
|
|
160
|
-
好的,我现在需要处理用户的问题"你好",并根据提供的搜索结果生成一个回答,同时正确引用来源。首先,用户的问题是一个常见的问候语,所以答案应该解释"你好"的含义和用法。
|
|
161
|
-
|
|
162
|
-
看一下搜索结果的各个条目。结果1到4、7、8都是关于"你好"这个词语的解释,包括它的拼音、用法、近义词等。而结果5、6、9是关于韩国电影《你好》的信息,和用户的问题无关,可以忽略。
|
|
163
|
-
|
|
164
|
-
接下来,我需要从相关的结果中提取关键信息。例如,结果1提到"你好"是用于礼貌的打招呼或问候,适用于非熟人群体。结果2和3也给出了类似的解释,并指出它是汉语中的常用敬语。结果4详细介绍了"你好"的不同解释,包括网络解释和基础解释。结果7和8补充了其作为打招呼的敬语用法。
|
|
165
|
-
|
|
166
|
-
需要将这些信息整合成一个连贯的回答,并用正确的引用标注。例如,综合结果1、2、3、4、7、8的内容,说明"你好"的基本含义、用法以及适用场合。注意不要提到电影相关的信息,因为与问题无关。
|
|
167
|
-
|
|
168
|
-
最后,确保回答简洁明了,使用中文口语化表达,避免使用Markdown格式,并在适当的位置添加引用,如[1](@ref)、[2](@ref)等。同时,根据当前时间2025年2月19日,用户的问题只是问候,不需要时间相关的调整,所以直接回答即可。
|
|
169
|
-
`,
|
|
358
|
+
title: "思考完成",
|
|
359
|
+
titleIcon: 'test.png',
|
|
360
|
+
nodeName: "deepseek",
|
|
361
|
+
status: "success",
|
|
362
|
+
detailVisible: true,
|
|
363
|
+
elapsed: 17485,
|
|
364
|
+
content: `好的,我现在需要处理用户的问题...`,
|
|
170
365
|
}]
|
|
171
366
|
}]);
|
|
172
367
|
|
package/package.json
CHANGED
package/README.en.md
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
# lke-component
|
|
2
|
-
|
|
3
|
-
English | [中文](./README.md)
|
|
4
|
-
|
|
5
|
-
Message rendering component for LKE (Large Knowledge Engine) conversations, designed for Vue2 and React projects.
|
|
6
|
-
|
|
7
|
-
For other environments:
|
|
8
|
-
* Vue3 projects: [Link](https://www.npmjs.com/package/lke-component-vue3)
|
|
9
|
-
* React projects: [Link](#usage-in-react-projects)
|
|
10
|
-
* Mini Programs: [Link](https://www.npmjs.com/package/lke-utils)
|
|
11
|
-
|
|
12
|
-
## Components
|
|
13
|
-
|
|
14
|
-
Four components are provided: `LkeMsg`, `MsgContent`, `MsgLoading`, `MsgThought`
|
|
15
|
-
|
|
16
|
-
**MsgLoading**: Shows model loading state
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
props:
|
|
20
|
-
loadingIcon: String, // Message icon, displays if provided
|
|
21
|
-
loadingMessage: Boolean, // Whether in loading state
|
|
22
|
-
loadingText: String, // Loading message content
|
|
23
|
-
transferStatus: Boolean // Transfer to human agent status
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
**MsgContent**: Renders Markdown content
|
|
27
|
-
|
|
28
|
-
```
|
|
29
|
-
props:
|
|
30
|
-
content: String, // Markdown message
|
|
31
|
-
isFinal: Boolean, // Whether the message output is complete
|
|
32
|
-
isReplaceLinks: Boolean, // Whether to replace links with third-party prompts
|
|
33
|
-
styleObj: Object, // Style object for MD message body
|
|
34
|
-
clazzTable: String, // Table class for MD message body (default styles will be added)
|
|
35
|
-
clazzMd: String, // Class for MD message body
|
|
36
|
-
anchorAttributes: Object, // Props passed to vue-markdown, see example
|
|
37
|
-
linkify: Boolean // Props passed to vue-markdown, see example
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
**LkeMsg**: Aggregated component combining the above
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
props:
|
|
44
|
-
LoadingIcon: String, // CDN URL for loading icon, not displayed if not provided
|
|
45
|
-
type: String, // Current message type, usually 'reply' or 'token_stat'
|
|
46
|
-
isReplaceLinks: Boolean, // Whether to replace with LLM third-party link prompts
|
|
47
|
-
showProcedures: Boolean, // Whether to show model output status
|
|
48
|
-
transferStatus: Boolean, // Transfer to human agent status
|
|
49
|
-
clazz: String, // Class name for outer wrapper div
|
|
50
|
-
item: Object, // Current message content
|
|
51
|
-
styleObj: Object, // Style object for MD message body
|
|
52
|
-
clazzTable: String, // Table class for MD message body, default styles: table-style, table
|
|
53
|
-
clazzMd: String, // Class for MD message body, default style: answer-md
|
|
54
|
-
anchorAttributes: Object, // Props passed to vue-markdown, see example
|
|
55
|
-
linkify: Boolean // Props passed to vue-markdown, see example
|
|
56
|
-
printCount: Number | undefined // Characters per print for timing control
|
|
57
|
-
hideCursorPoint: Boolean | undefined // Whether to show print cursor icon
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
**MsgThought**: Renders DeepSeek thinking content
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
props:
|
|
64
|
-
content: String // Thinking content
|
|
65
|
-
title: String // Title, e.g., "Thinking Complete"
|
|
66
|
-
titleIcon: String // Small icon, 16x16px
|
|
67
|
-
nodeName: String // Optional, e.g., "deepseek"
|
|
68
|
-
status: String // Thinking status: 'success', 'failed', 'processing', 'stop'
|
|
69
|
-
elapsed: number // Time spent thinking in milliseconds, e.g., 17485
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## Usage in Vue2 Projects
|
|
73
|
-
|
|
74
|
-
1. Install and import
|
|
75
|
-
|
|
76
|
-
```js
|
|
77
|
-
// Import in Vue entry file
|
|
78
|
-
import lkeComponent from 'lke-component';
|
|
79
|
-
Vue.use(lkeComponent);
|
|
80
|
-
|
|
81
|
-
// Use in Vue pages
|
|
82
|
-
<!-- Loading toggle + Markdown rendering -->
|
|
83
|
-
<LkeMsg :loadingIcon="loadingIcon" :loadingMessage="item.loading_message" :loadingText="item.text" :transferStatus="transferStatus" :isReplaceLinks="true" :content="item.content" :isFinal="item.is_final" :clazzMd="`question-text ${webIMSource === 'client' && isMobile ? 'question-text-mobile' : ''}`" :styleObj="{ 'max-width': webIMSource === 'client' && isMobile ? '352px' : '680px' }" />
|
|
84
|
-
|
|
85
|
-
<!-- Show temporary [Thinking...] message when not transferring to human -->
|
|
86
|
-
<MsgLoading :loadingIcon="loadingIcon" :loadingMessage="item.loading_message" :loadingText="item.text" :transferStatus="transferStatus" />
|
|
87
|
-
|
|
88
|
-
<!-- DeepSeek thinking content rendering -->
|
|
89
|
-
<MsgThought
|
|
90
|
-
:content="thinkingContent"
|
|
91
|
-
:title="thinkingTitle"
|
|
92
|
-
:titleIcon="test.png"
|
|
93
|
-
:nodeName="deepseek"
|
|
94
|
-
:status="success"
|
|
95
|
-
:elapsed="17485"
|
|
96
|
-
/>
|
|
97
|
-
|
|
98
|
-
<!-- Markdown rendering -->
|
|
99
|
-
<MsgContent :isReplaceLinks="true" :loadingMessage="item.loading_message" :content="item.content" :isFinal="item.is_final" :clazzMd="`question-text ${webIMSource === 'client' && isMobile ? 'question-text-mobile' : ''}`" :styleObj="{ 'max-width': webIMSource === 'client' && isMobile ? '352px' : '680px' }" :printCount="1" :hideCursorPoint="true"/>
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
2. Import method
|
|
103
|
-
|
|
104
|
-
```js
|
|
105
|
-
// Import in Vue file, e.g., component.vue
|
|
106
|
-
import { MsgLoading, MsgContent, MsgThought } from '@tencent/lke-component';
|
|
107
|
-
|
|
108
|
-
// Register components
|
|
109
|
-
export default {
|
|
110
|
-
components: {
|
|
111
|
-
MsgContent,
|
|
112
|
-
MsgLoading,
|
|
113
|
-
MsgThought,
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Use in template
|
|
118
|
-
<MsgLoading :loadingIcon="loadingIcon" :loadingMessage="item.loading_message" :loadingText="item.text" :transferStatus="transferStatus" />
|
|
119
|
-
|
|
120
|
-
<!-- Markdown rendering -->
|
|
121
|
-
<MsgContent :isReplaceLinks="true" :loadingMessage="item.loading_message" :content="item.content" :isFinal="item.is_final" :clazzMd="`question-text ${webIMSource === 'client' && isMobile ? 'question-text-mobile' : ''}`" :styleObj="{ 'max-width': webIMSource === 'client' && isMobile ? '352px' : '680px' }" />
|
|
122
|
-
|
|
123
|
-
<!-- DeepSeek thinking content rendering -->
|
|
124
|
-
<MsgThought
|
|
125
|
-
:content="thinkingContent"
|
|
126
|
-
:title="thinkingTitle"
|
|
127
|
-
:titleIcon="test.png"
|
|
128
|
-
:nodeName="deepseek"
|
|
129
|
-
:status="success"
|
|
130
|
-
:elapsed="17485"
|
|
131
|
-
/>
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## Usage in React Projects
|
|
135
|
-
|
|
136
|
-
```jsx
|
|
137
|
-
import { MsgContent, MsgThought } from "lke-component/react";
|
|
138
|
-
import "lke-component/css";
|
|
139
|
-
|
|
140
|
-
const App = () => {
|
|
141
|
-
const [list, setList] = useState([{
|
|
142
|
-
content: "Nice weather today<b>?</b>",
|
|
143
|
-
isFinal: true, // Whether message output is complete
|
|
144
|
-
loadingMessage: false, // Whether loading
|
|
145
|
-
isReplaceLinks: false, // Whether to replace links with third-party prompts
|
|
146
|
-
styleObj: {}, // Style object for MD message body
|
|
147
|
-
clazzTable: '', // Table class for MD message body
|
|
148
|
-
clazzMd: '', // Class for MD message body
|
|
149
|
-
anchorAttributes: {}, // Custom attributes for links, e.g., {target: '_blank'}
|
|
150
|
-
id: 1,
|
|
151
|
-
linkify: false, // Props passed to markdown-it
|
|
152
|
-
thoughts: [{
|
|
153
|
-
title: "Thinking Complete", // Title
|
|
154
|
-
titleIcon: 'test.png', // Icon next to title, usually emoji icon URL from backend
|
|
155
|
-
nodeName: "deepseek", // Optional, shows LLM name
|
|
156
|
-
status: "success", // Thinking status, shows different status icons
|
|
157
|
-
detailVisible: true, // Controls thinking content visibility, use with onTitleClick for expand/collapse
|
|
158
|
-
elapsed: 17485, // Thinking time in ms
|
|
159
|
-
content: ` // Thinking content
|
|
160
|
-
Okay, I need to process the user's question "Hello" and generate a response based on the provided search results while correctly citing sources. First, the user's question is a common greeting, so the answer should explain the meaning and usage of "Hello".
|
|
161
|
-
|
|
162
|
-
Looking at the search result entries. Results 1 to 4, 7, 8 are all about the explanation of the word "Hello", including its pinyin, usage, synonyms, etc. Results 5, 6, 9 are about the Korean movie "Hello", which is irrelevant to the user's question and can be ignored.
|
|
163
|
-
|
|
164
|
-
Next, I need to extract key information from the relevant results. For example, result 1 mentions that "Hello" is used for polite greetings, suitable for non-acquaintances. Results 2 and 3 also give similar explanations, pointing out that it is a common honorific in Chinese. Result 4 introduces different interpretations of "Hello" in detail, including network interpretation and basic interpretation. Results 7 and 8 supplement its usage as a greeting honorific.
|
|
165
|
-
|
|
166
|
-
This information needs to be integrated into a coherent answer with correct citation annotations. For example, combining the content of results 1, 2, 3, 4, 7, 8, explain the basic meaning, usage and applicable occasions of "Hello". Be careful not to mention movie-related information as it is irrelevant to the question.
|
|
167
|
-
|
|
168
|
-
Finally, ensure the answer is concise and clear, using colloquial Chinese expression, avoiding Markdown format, and adding citations at appropriate places, such as [1](@ref), [2](@ref), etc.
|
|
169
|
-
`,
|
|
170
|
-
}]
|
|
171
|
-
}]);
|
|
172
|
-
|
|
173
|
-
return (
|
|
174
|
-
<div className="main">
|
|
175
|
-
{list.map((item, index) => (
|
|
176
|
-
<div>
|
|
177
|
-
{item.thoughts.map((thought, index) => (
|
|
178
|
-
<MsgThought
|
|
179
|
-
key={index}
|
|
180
|
-
detailVisible={thought.detailVisible}
|
|
181
|
-
content={thought.content}
|
|
182
|
-
title={thought.title}
|
|
183
|
-
titleIcon={thought.titleIcon}
|
|
184
|
-
nodeName={thought.nodeName}
|
|
185
|
-
status={thought.status}
|
|
186
|
-
elapsed={thought.elapsed}
|
|
187
|
-
onTitleClick={() => void 0}
|
|
188
|
-
/>
|
|
189
|
-
))}
|
|
190
|
-
</div>
|
|
191
|
-
<MsgContent
|
|
192
|
-
key={id}
|
|
193
|
-
content={item.content}
|
|
194
|
-
isFinal={item.isFinal}
|
|
195
|
-
styleObj={item.styleObj}
|
|
196
|
-
clazzTable={item.clazzTable}
|
|
197
|
-
clazzMd={item.clazzMd}
|
|
198
|
-
anchorAttributes={item.anchorAttributes}
|
|
199
|
-
linkify={item.linkify}
|
|
200
|
-
isReplaceLinks={item.isReplaceLinks}
|
|
201
|
-
/>
|
|
202
|
-
))}
|
|
203
|
-
</div>
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
```
|