lke-component 1.0.125-beta.4 → 1.0.125-beta.8

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 CHANGED
@@ -1,77 +1,78 @@
1
1
  # lke-component
2
2
 
3
- npm install lke-component@^1.0.92
3
+ 知识引擎大模型对话消息渲染组件,适用于基于vue2和react搭建的项目。
4
4
 
5
- 提供三个组件:LkeMsg、MsgContent、MsgLoading
5
+ 其它项目环境参考
6
+ * 基于vue3的项目参考 [链接](https://www.npmjs.com/package/lke-component-vue3)
7
+
8
+ * 基于react的项目参考 [链接](#react)
9
+
10
+ * 小程序参考 [链接](https://www.npmjs.com/package/lke-utils)
6
11
 
7
- npm install lke-utils@^0.0.4
8
12
 
9
- 提供一个小程序环境的转换方法: getMarkdownHtml
13
+ ## 组件介绍
10
14
 
15
+ 提供三个组件:LkeMsg、MsgContent、MsgLoading
11
16
 
12
- 组件使用说明:
13
17
 
14
18
  MsgLoading: 展示模型加载中的状态
15
19
 
16
20
  ```
17
21
  props:
18
- loadingIcon: String, // 消息的ICON,如果有话显示Icon,没有的话不会显示Icon
19
- loadingMessage: Boolean, // 是否处于加载中
20
- loadingText: String, // 加载中的消息内容
21
- transferStatus: Boolean // 转人工状态
22
+ loadingIcon: String, // 消息的ICON,如果有话显示Icon,没有的话不会显示Icon
23
+ loadingMessage: Boolean, // 是否处于加载中
24
+ loadingText: String, // 加载中的消息内容
25
+ transferStatus: Boolean // 转人工状态
22
26
  ```
23
27
 
24
28
  MsgContent: 展示MD内容
25
-
26
29
  ```
27
30
  props:
28
- content: String, // MD消息
29
- isFinal: Boolean, // 消息是否输出结束
30
- loadingMessage: Boolean, // 是否加载中
31
- isMdExpand: Boolean, // 是否展开所有的消息
32
- isReplaceLinks: Boolean, // 是否替换链接为第三方提示
33
- isPrintAnimate: Boolean, // 是否显示打字的图标
34
- styleObj: Object, // MD消息体的style
35
- clazzTable: String, // MD消息体的 table 样式 (后面会加上默认统一样式),props方便修改
36
- clazzMd: String, // MD消息体的class
37
- anchorAttributes: Object, // vue-markdown 的props透传,见示例
38
- linkify: Boolean // vue-markdown 的props透传,见示例
31
+ content: String, // MD消息
32
+ isFinal: Boolean, // 消息是否输出结束
33
+ loadingMessage: Boolean, // 是否加载中
34
+ isMdExpand: Boolean, // 是否展开所有的消息
35
+ isReplaceLinks: Boolean, // 是否替换链接为第三方提示
36
+ isPrintAnimate: Boolean, // 是否显示打字的图标
37
+ styleObj: Object, // MD消息体的style
38
+ clazzTable: String, // MD消息体的 table 样式 (后面会加上默认统一样式),props方便修改
39
+ clazzMd: String, // MD消息体的class
40
+ anchorAttributes: Object, // vue-markdown 的props透传,见示例
41
+ linkify: Boolean // vue-markdown 的props透传,见示例
39
42
  ```
40
43
 
41
44
  LkeMsg: 两个组件的聚合态
42
-
43
45
  ```
44
46
  props:
45
- LoadingIcon: String, // 加载中的图标CDN地址,如果没有传的话,默认不显示图标
46
- type: String, // 当前消息的类型,type透传,一般为 reply 、 token_stat
47
- isReplaceLinks: Boolean, // 是否替换为大模型的第三方链接提示
48
- showProcedures: Boolean, // 是否显示模型输出的状态
49
- isPrintAnimate: Boolean, // 是否显示打字效果
50
- transferStatus: Boolean, // 转人工状态
51
- clazz: String, //外层包裹的div的类名
52
- item: Object, // 当前的消息内容
53
- styleObj: Object, // MD消息体的style
54
- clazzTable: String, // MD消息体的 table 样式 (后面会加上默认统一样式),props方便修改, 组件自带默认样式:table-style、table
55
- clazzMd: String, // MD消息体的class, 组件自带默认样式:answer-md
56
- anchorAttributes: Object, // vue-markdown 的props透传,见示例
57
- linkify: Boolean //vue-markdown 的props透传,见示例
58
- printCount: Number | undefined //每次打印的字数用于控制时间
59
- hideCursorPoint: Boolean | undefined //是否显示打印的图标
60
- ```
61
-
62
- MsgThought: 显示deepseek 的思考内容
63
-
47
+ LoadingIcon: String, // 加载中的图标CDN地址,如果没有传的话,默认不显示图标
48
+ type: String, // 当前消息的类型,type透传,一般为 reply 、 token_stat
49
+ isReplaceLinks: Boolean, // 是否替换为大模型的第三方链接提示
50
+ showProcedures: Boolean, // 是否显示模型输出的状态
51
+ isPrintAnimate: Boolean, // 是否显示打字效果
52
+ transferStatus: Boolean, // 转人工状态
53
+ clazz: String, //外层包裹的div的类名
54
+ item: Object, // 当前的消息内容
55
+ styleObj: Object, // MD消息体的style
56
+ clazzTable: String, // MD消息体的 table 样式 (后面会加上默认统一样式),props方便修改, 组件自带默认样式:table-style、table
57
+ clazzMd: String, // MD消息体的class, 组件自带默认样式:answer-md
58
+ anchorAttributes: Object, // vue-markdown 的props透传,见示例
59
+ linkify: Boolean //vue-markdown 的props透传,见示例
60
+ printCount: Number | undefined //每次打印的字数用于控制时间
61
+ hideCursorPoint: Boolean | undefined //是否显示打印的图标
62
+ ```
63
+
64
+ MsgThought: 渲染deepseek 的思考内容
64
65
  ```
65
66
  props:
66
- content: String \\ 思考内容
67
- title: String \\ 标题,如“思考完成"
68
- titleIcon: String \\ 图标小图标icon 大小16x16px
69
- nodeName: String \\ 可不填,如”deepseek“
70
- status: String \\ 思考状态,可选值'success', 'failed', 'processing', 'stop'
71
- elapsed: number \\ 思考花费时间, 毫秒,如17485
67
+ content: String // 思考内容
68
+ title: String // 标题,如“思考完成"
69
+ titleIcon: String // 图标小图标icon 大小16x16px
70
+ nodeName: String // 可不填,如”deepseek“
71
+ status: String // 思考状态,可选值'success', 'failed', 'processing', 'stop'
72
+ elapsed: number // 思考花费时间, 毫秒,如17485
72
73
  ```
73
74
 
74
- vue项目里使用
75
+ ## vue2项目里使用
75
76
  1. install方式引入
76
77
 
77
78
  ```
@@ -79,16 +80,13 @@ props:
79
80
  import lkeComponent from 'lke-component';
80
81
  Vue.use(lkeComponent);
81
82
 
82
-
83
83
  // 在对应的vue页面里面使用组件
84
-
85
84
  <!-- Loading切换 + Markdown渲染 -->
86
85
  <LkeMsg :loadingIcon="loadingIcon" :loadingMessage="item.loading_message" :loadingText="item.text" :transferStatus="transferStatus" :isReplaceLinks="true" :content="item.content" :isFinal="item.is_final" :isMdExpand="item.isMdExpand" :clazzMd="`question-text ${webIMSource === 'client' && isMobile ? 'question-text-mobile' : ''}`" :styleObj="{ 'max-width': webIMSource === 'client' && isMobile ? '352px' : '680px' }" />
87
86
 
88
87
  <!-- 非转人工情况下, 展示临时[正在思考中]消息 -->
89
88
  <MsgLoading :loadingIcon="loadingIcon" :loadingMessage="item.loading_message" :loadingText="item.text" :transferStatus="transferStatus" />
90
89
 
91
-
92
90
  <!-- deepseek 思考内容渲染 -->
93
91
  <MsgThought
94
92
  :content="思考内容"
@@ -106,13 +104,14 @@ Vue.use(lkeComponent);
106
104
  2. import方式引入
107
105
  ```
108
106
  // 在需要使用此组件的vue文件,比如component.vue中引入
109
- import { MsgLoading, MsgContent } from 'lke-component';
107
+ import { MsgLoading, MsgContent, MsgThought } from '@tencent/lke-component';
110
108
 
111
109
  // components中注册此组件
112
110
  export default {
113
111
  components: {
114
112
  MsgContent,
115
113
  MsgLoading,
114
+ MsgThought,
116
115
  }
117
116
  }
118
117
 
@@ -122,30 +121,26 @@ export default {
122
121
 
123
122
  <!-- Markdown渲染 -->
124
123
  <MsgContent :isReplaceLinks="true" :loadingMessage="item.loading_message" :content="item.content" :isFinal="item.is_final" :isMdExpand="item.isMdExpand" :clazzMd="`question-text ${webIMSource === 'client' && isMobile ? 'question-text-mobile' : ''}`" :styleObj="{ 'max-width': webIMSource === 'client' && isMobile ? '352px' : '680px' }" />
125
- ```
126
-
127
124
 
128
- 小程序转换方法使用说明:
125
+ <!-- deepseek 思考内容渲染 -->
126
+ <MsgThought
127
+ :content="思考内容"
128
+ :title="思考标题"
129
+ :titleIcon="test.png"
130
+ :nodeName="deepseek"
131
+ :status="success"
132
+ :elapsed="17485"
133
+ />
129
134
 
130
- getMarkdownHtml 提供一个方法,传入MD格式的字符串,返回Html格式的字符串。
135
+ ```
131
136
 
132
137
 
133
138
 
134
- import { getMarkdownHtml } from 'lke-utils';
135
139
 
136
- ```
137
- /**
138
- * 传入MD格式的字符串,返回Html格式的字符串
139
- * @param {String} markdownStr markdown字符串
140
- * @param {Boolean} isMsgComplete 是否最终的消息
141
- * @param {Object} marked 引入 marked-it 返回的marked对象:import { marked } from '@/utils/marked.min.js';
142
- * @returns {String} html字符串
143
- */
144
- getMarkdownHtml(markdownStr, isMsgComplete, marked = null)
145
- ```
140
+ ## 在react项目中使用
146
141
 
142
+ <div id="react"></div>
147
143
 
148
- ### 在react组件中使用
149
144
  ```
150
145
  import { MsgContent, MsgThought } from "lke-component/react";
151
146
  import "lke-component/css";