vue-element-ui-x 0.1.5 → 0.1.7-beta

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.
Files changed (92) hide show
  1. package/lib/attachments.js +3082 -0
  2. package/lib/bubble-list.js +13840 -0
  3. package/lib/bubble.js +13125 -0
  4. package/lib/components/Attachments/index.js +6 -6
  5. package/lib/components/Bubble/index.js +188 -192
  6. package/lib/components/BubbleList/index.js +189 -194
  7. package/lib/components/Conversations/index.js +6 -6
  8. package/lib/components/FilesCard/index.js +5 -5
  9. package/lib/components/Prompts/index.js +21 -21
  10. package/lib/components/Sender/index.js +4 -4
  11. package/lib/components/Think/index.js +1 -1
  12. package/lib/components/Thinking/index.js +1 -1
  13. package/lib/components/ThoughtChain/index.js +186 -191
  14. package/lib/components/Typewriter/index.js +182 -186
  15. package/lib/components/Welcome/index.js +1 -1
  16. package/lib/conversations.js +18825 -0
  17. package/lib/files-card.js +2471 -0
  18. package/lib/index.common.js +1 -1
  19. package/lib/index.esm.js +1 -1
  20. package/lib/index.js +1707 -1691
  21. package/lib/index.umd.js +1 -1
  22. package/lib/mixins/index.js +2 -2
  23. package/lib/mixins.js +1016 -0
  24. package/lib/prompts.js +832 -0
  25. package/lib/sender.js +1911 -0
  26. package/lib/think.js +799 -0
  27. package/lib/thinking.js +809 -0
  28. package/lib/thought-chain.js +30391 -0
  29. package/lib/typewriter.js +12788 -0
  30. package/lib/welcome.js +755 -0
  31. package/package.json +3 -4
  32. package/src/components/Attachments/index.js +8 -8
  33. package/src/components/Bubble/index.js +6 -6
  34. package/src/components/Bubble/src/main.vue +299 -299
  35. package/src/components/BubbleList/index.js +8 -8
  36. package/src/components/BubbleList/src/loading.vue +75 -75
  37. package/src/components/BubbleList/src/main.vue +466 -466
  38. package/src/components/Conversations/index.js +8 -8
  39. package/src/components/Conversations/src/main.vue +635 -635
  40. package/src/components/FilesCard/index.js +8 -8
  41. package/src/components/FilesCard/src/fileSvg/audio.vue +38 -38
  42. package/src/components/FilesCard/src/fileSvg/code.vue +35 -35
  43. package/src/components/FilesCard/src/fileSvg/database.vue +94 -94
  44. package/src/components/FilesCard/src/fileSvg/excel.vue +38 -38
  45. package/src/components/FilesCard/src/fileSvg/file.vue +40 -40
  46. package/src/components/FilesCard/src/fileSvg/image.vue +40 -40
  47. package/src/components/FilesCard/src/fileSvg/index.js +46 -46
  48. package/src/components/FilesCard/src/fileSvg/link.vue +54 -54
  49. package/src/components/FilesCard/src/fileSvg/mark.vue +38 -38
  50. package/src/components/FilesCard/src/fileSvg/pdf.vue +38 -38
  51. package/src/components/FilesCard/src/fileSvg/ppt.vue +38 -38
  52. package/src/components/FilesCard/src/fileSvg/three.vue +38 -38
  53. package/src/components/FilesCard/src/fileSvg/txt.vue +38 -38
  54. package/src/components/FilesCard/src/fileSvg/unknown.vue +54 -54
  55. package/src/components/FilesCard/src/fileSvg/video.vue +38 -38
  56. package/src/components/FilesCard/src/fileSvg/word.vue +38 -38
  57. package/src/components/FilesCard/src/fileSvg/zip.vue +38 -38
  58. package/src/components/FilesCard/src/options.js +18 -18
  59. package/src/components/Prompts/index.js +8 -8
  60. package/src/components/Prompts/src/main.vue +248 -248
  61. package/src/components/Sender/index.js +8 -8
  62. package/src/components/Sender/src/components/ClearButton.vue +28 -28
  63. package/src/components/Sender/src/components/Loading.vue +53 -53
  64. package/src/components/Sender/src/components/LoadingButton.vue +39 -39
  65. package/src/components/Sender/src/components/SendButton.vue +26 -26
  66. package/src/components/Sender/src/components/SpeechButton.vue +24 -24
  67. package/src/components/Sender/src/components/SpeechLoading.vue +87 -87
  68. package/src/components/Sender/src/components/SpeechLoadingButton.vue +43 -43
  69. package/src/components/Think/index.js +8 -8
  70. package/src/components/Think/src/main.vue +190 -190
  71. package/src/components/Thinking/index.js +8 -8
  72. package/src/components/Thinking/src/main.vue +195 -195
  73. package/src/components/ThoughtChain/index.js +8 -8
  74. package/src/components/ThoughtChain/src/main.vue +293 -293
  75. package/src/components/Typewriter/index.js +8 -8
  76. package/src/components/Welcome/index.js +8 -8
  77. package/src/components/Welcome/src/main.vue +151 -151
  78. package/src/index.js +23 -3
  79. package/src/styles/Attachments.scss +236 -236
  80. package/src/styles/Bubble.scss +157 -157
  81. package/src/styles/BubbleList.scss +148 -148
  82. package/src/styles/Conversations.scss +260 -260
  83. package/src/styles/FilesCard.scss +221 -221
  84. package/src/styles/Prompts.scss +195 -195
  85. package/src/styles/Sender.scss +199 -199
  86. package/src/styles/Think.scss +134 -134
  87. package/src/styles/Thinking.scss +112 -112
  88. package/src/styles/ThoughtChain.scss +113 -113
  89. package/src/styles/Typewriter.scss +66 -66
  90. package/src/styles/button.scss +302 -0
  91. package/src/styles/var.scss +1052 -0
  92. package/src/theme/var.scss +72 -72
@@ -1,293 +1,293 @@
1
- <template>
2
- <div class="el-x-thoughtchain">
3
- <el-timeline
4
- ref="timelineRef"
5
- :style="{
6
- maxWidth: maxWidth,
7
- }"
8
- >
9
- <transition-group
10
- name="thought-chain"
11
- tag="div"
12
- >
13
- <el-timeline-item
14
- v-for="item in thinkingItems"
15
- :key="getId(item)"
16
- :type="getType(item)"
17
- :icon="dotIsIcon ? item.icon : 'el-icon-more'"
18
- :color="dotIsIcon ? item.iconColor : null"
19
- :size="dotIsIcon ? item.iconSize : 'normal'"
20
- :timestamp="getTitle(item)"
21
- :hide-timestamp="item.hideTitle"
22
- :placement="item.placement || 'top'"
23
- >
24
- <div v-if="!item.isCanExpand">
25
- <el-x-typewriter
26
- :content="getThinkTitle(item)"
27
- :is-markdown="item.isMarkdown"
28
- :typing="item.typing"
29
- />
30
- </div>
31
- <el-collapse
32
- v-else-if="!item.isDefaultExpand"
33
- @change="() => handleExpand(item)"
34
- >
35
- <el-collapse-item :title="getThinkTitle(item)">
36
- <el-x-typewriter
37
- :content="getThinkContent(item)"
38
- :is-markdown="item.isMarkdown"
39
- :typing="item.typing"
40
- />
41
- </el-collapse-item>
42
- </el-collapse>
43
- <el-collapse
44
- v-else
45
- v-model="defaultActiveNodes"
46
- @change="() => handleExpand(item)"
47
- >
48
- <el-collapse-item
49
- :title="getThinkTitle(item)"
50
- :name="String(getId(item))"
51
- >
52
- <el-x-typewriter
53
- :content="getThinkContent(item)"
54
- :is-markdown="item.isMarkdown"
55
- :typing="item.typing"
56
- />
57
- </el-collapse-item>
58
- </el-collapse>
59
-
60
- <template
61
- v-if="!dotIsIcon"
62
- slot="dot"
63
- >
64
- <div
65
- class="el-x-thoughtchain-item-dot"
66
- :style="{ margin: dotMargin }"
67
- >
68
- <slot
69
- name="icon"
70
- :item="item"
71
- >
72
- <el-button
73
- circle
74
- :type="getType(item)"
75
- :loading="isLoading(item)"
76
- :size="dotSize"
77
- >
78
- <template slot="loading">
79
- <i class="el-icon-loading el-x-thoughtchain-loading"></i>
80
- </template>
81
-
82
- <i
83
- v-if="!isLoading(item) && !isError(item)"
84
- class="el-icon-check"
85
- ></i>
86
- <i
87
- v-if="!isLoading(item) && isError(item)"
88
- class="el-icon-close"
89
- ></i>
90
- </el-button>
91
- </slot>
92
- </div>
93
- </template>
94
- </el-timeline-item>
95
- </transition-group>
96
- </el-timeline>
97
- </div>
98
- </template>
99
-
100
- <script>
101
- import { get } from 'lodash';
102
- import ElXTypewriter from '../../Typewriter/index.js';
103
- export default {
104
- name: 'ElXThoughtChain',
105
- components: {
106
- ElXTypewriter,
107
- },
108
- props: {
109
- thinkingItems: {
110
- type: Array,
111
- default: () => [],
112
- },
113
- dotIsIcon: {
114
- type: Boolean,
115
- default: false,
116
- },
117
- dotSize: {
118
- type: String,
119
- default: 'small',
120
- },
121
- maxWidth: {
122
- type: String,
123
- default: '600px',
124
- },
125
- lineGradient: {
126
- type: Boolean,
127
- default: false,
128
- },
129
- rowKey: {
130
- type: String,
131
- default: 'id',
132
- },
133
- statusKey: {
134
- type: String,
135
- default: 'status',
136
- },
137
- statusEnum: {
138
- type: Object,
139
- default: () => ({
140
- loading: {
141
- value: 'loading',
142
- type: 'warning',
143
- },
144
- error: {
145
- value: 'error',
146
- type: 'danger',
147
- },
148
- success: {
149
- value: 'success',
150
- type: 'success',
151
- },
152
- }),
153
- },
154
- titleKey: {
155
- type: String,
156
- default: 'title',
157
- },
158
- thinkTitleKey: {
159
- type: String,
160
- default: 'thinkTitle',
161
- },
162
- thinkContentKey: {
163
- type: String,
164
- default: 'thinkContent',
165
- },
166
- },
167
- data() {
168
- return {
169
- colorArr: {
170
- // 使用与SCSS变量对应的字符串表示
171
- info: 'var(--color-info, #909399)',
172
- success: 'var(--color-success, #67C23A)',
173
- warning: 'var(--color-warning, #E6A23C)',
174
- danger: 'var(--color-danger, #F56C6C)',
175
- primary: 'var(--color-primary, #409EFF)',
176
- },
177
- defaultActiveNodes: [],
178
- };
179
- },
180
- computed: {
181
- dotMargin() {
182
- switch (this.dotSize) {
183
- case 'mini':
184
- return '-8px 0 0 -9px';
185
- case 'small':
186
- return '-8px 0 0 -11px';
187
- case 'medium':
188
- return '-8px 0 0 -13px';
189
- default:
190
- return '-8px 0 0 -16px';
191
- }
192
- },
193
- getLineColor() {
194
- if (this.thinkingItems.length) {
195
- const arr = this.thinkingItems.map(item => {
196
- const _type_ = this.getType(item);
197
- if (_type_) {
198
- return this.colorArr[_type_];
199
- }
200
- return '';
201
- });
202
- return arr;
203
- }
204
- return [];
205
- },
206
- activeNamesComputed() {
207
- return this.thinkingItems
208
- .filter(item => item.isCanExpand && item.isDefaultExpand)
209
- .map(item => String(this.getId(item)));
210
- },
211
- },
212
- watch: {
213
- activeNamesComputed: {
214
- handler(v) {
215
- this.defaultActiveNodes = [...v];
216
- },
217
- immediate: true,
218
- },
219
- getLineColor() {
220
- this.$nextTick(() => {
221
- this.getEle();
222
- });
223
- },
224
- },
225
- mounted() {
226
- this.$nextTick(() => {
227
- this.getEle();
228
- });
229
- },
230
- methods: {
231
- handleExpand(item) {
232
- this.$emit('handleExpand', item);
233
- },
234
- setRadialGradient(colors, ele) {
235
- const length = ele.length;
236
- Array.from(ele).forEach((item, index) => {
237
- const line = item.children[0];
238
- if (line) {
239
- line.setAttribute(
240
- 'style',
241
- `
242
- border: none;
243
- width:2px;
244
- background: linear-gradient(to bottom, ${colors[index]} 0% , ${
245
- colors[index < length ? index + 1 : index]
246
- } 100%);
247
- `,
248
- );
249
- }
250
- });
251
- },
252
- getEle() {
253
- if (this.getLineColor && this.$refs.timelineRef && this.lineGradient) {
254
- const ele = this.$refs.timelineRef.$el.children[0].children;
255
- this.setRadialGradient(this.getLineColor, ele);
256
- }
257
- },
258
- isLoading(item) {
259
- const status = this.getStatus(item);
260
- return status === this.statusEnum.loading.value;
261
- },
262
- isError(item) {
263
- const status = this.getStatus(item);
264
- return status === this.statusEnum.error.value;
265
- },
266
- getId(item) {
267
- return get(item, this.rowKey);
268
- },
269
- getType(item) {
270
- const status = this.getStatus(item);
271
- // 优先查找statusEnum中value匹配的项
272
- const matchedStatus = Object.values(this.statusEnum).find(s => s.value === status);
273
- return matchedStatus ? matchedStatus.type : 'success';
274
- },
275
-
276
- getTitle(item) {
277
- return get(item, this.titleKey) || '';
278
- },
279
- getThinkTitle(item) {
280
- return get(item, this.thinkTitleKey) || '';
281
- },
282
- getThinkContent(item) {
283
- return get(item, this.thinkContentKey) || '';
284
- },
285
- getStatus(item) {
286
- return get(item, this.statusKey);
287
- },
288
- },
289
- };
290
- </script>
291
- <style lang="scss" scoped>
292
- @import '../../../styles/ThoughtChain.scss';
293
- </style>
1
+ <template>
2
+ <div class="el-x-thoughtchain">
3
+ <el-timeline
4
+ ref="timelineRef"
5
+ :style="{
6
+ maxWidth: maxWidth,
7
+ }"
8
+ >
9
+ <transition-group
10
+ name="thought-chain"
11
+ tag="div"
12
+ >
13
+ <el-timeline-item
14
+ v-for="item in thinkingItems"
15
+ :key="getId(item)"
16
+ :type="getType(item)"
17
+ :icon="dotIsIcon ? item.icon : 'el-icon-more'"
18
+ :color="dotIsIcon ? item.iconColor : null"
19
+ :size="dotIsIcon ? item.iconSize : 'normal'"
20
+ :timestamp="getTitle(item)"
21
+ :hide-timestamp="item.hideTitle"
22
+ :placement="item.placement || 'top'"
23
+ >
24
+ <div v-if="!item.isCanExpand">
25
+ <el-x-typewriter
26
+ :content="getThinkTitle(item)"
27
+ :is-markdown="item.isMarkdown"
28
+ :typing="item.typing"
29
+ />
30
+ </div>
31
+ <el-collapse
32
+ v-else-if="!item.isDefaultExpand"
33
+ @change="() => handleExpand(item)"
34
+ >
35
+ <el-collapse-item :title="getThinkTitle(item)">
36
+ <el-x-typewriter
37
+ :content="getThinkContent(item)"
38
+ :is-markdown="item.isMarkdown"
39
+ :typing="item.typing"
40
+ />
41
+ </el-collapse-item>
42
+ </el-collapse>
43
+ <el-collapse
44
+ v-else
45
+ v-model="defaultActiveNodes"
46
+ @change="() => handleExpand(item)"
47
+ >
48
+ <el-collapse-item
49
+ :title="getThinkTitle(item)"
50
+ :name="String(getId(item))"
51
+ >
52
+ <el-x-typewriter
53
+ :content="getThinkContent(item)"
54
+ :is-markdown="item.isMarkdown"
55
+ :typing="item.typing"
56
+ />
57
+ </el-collapse-item>
58
+ </el-collapse>
59
+
60
+ <template
61
+ v-if="!dotIsIcon"
62
+ slot="dot"
63
+ >
64
+ <div
65
+ class="el-x-thoughtchain-item-dot"
66
+ :style="{ margin: dotMargin }"
67
+ >
68
+ <slot
69
+ name="icon"
70
+ :item="item"
71
+ >
72
+ <el-button
73
+ circle
74
+ :type="getType(item)"
75
+ :loading="isLoading(item)"
76
+ :size="dotSize"
77
+ >
78
+ <template slot="loading">
79
+ <i class="el-icon-loading el-x-thoughtchain-loading"></i>
80
+ </template>
81
+
82
+ <i
83
+ v-if="!isLoading(item) && !isError(item)"
84
+ class="el-icon-check"
85
+ ></i>
86
+ <i
87
+ v-if="!isLoading(item) && isError(item)"
88
+ class="el-icon-close"
89
+ ></i>
90
+ </el-button>
91
+ </slot>
92
+ </div>
93
+ </template>
94
+ </el-timeline-item>
95
+ </transition-group>
96
+ </el-timeline>
97
+ </div>
98
+ </template>
99
+
100
+ <script>
101
+ import { get } from 'lodash';
102
+ import ElXTypewriter from '../../Typewriter/index.js';
103
+ export default {
104
+ name: 'ElXThoughtChain',
105
+ components: {
106
+ ElXTypewriter,
107
+ },
108
+ props: {
109
+ thinkingItems: {
110
+ type: Array,
111
+ default: () => [],
112
+ },
113
+ dotIsIcon: {
114
+ type: Boolean,
115
+ default: false,
116
+ },
117
+ dotSize: {
118
+ type: String,
119
+ default: 'small',
120
+ },
121
+ maxWidth: {
122
+ type: String,
123
+ default: '600px',
124
+ },
125
+ lineGradient: {
126
+ type: Boolean,
127
+ default: false,
128
+ },
129
+ rowKey: {
130
+ type: String,
131
+ default: 'id',
132
+ },
133
+ statusKey: {
134
+ type: String,
135
+ default: 'status',
136
+ },
137
+ statusEnum: {
138
+ type: Object,
139
+ default: () => ({
140
+ loading: {
141
+ value: 'loading',
142
+ type: 'warning',
143
+ },
144
+ error: {
145
+ value: 'error',
146
+ type: 'danger',
147
+ },
148
+ success: {
149
+ value: 'success',
150
+ type: 'success',
151
+ },
152
+ }),
153
+ },
154
+ titleKey: {
155
+ type: String,
156
+ default: 'title',
157
+ },
158
+ thinkTitleKey: {
159
+ type: String,
160
+ default: 'thinkTitle',
161
+ },
162
+ thinkContentKey: {
163
+ type: String,
164
+ default: 'thinkContent',
165
+ },
166
+ },
167
+ data() {
168
+ return {
169
+ colorArr: {
170
+ // 使用与SCSS变量对应的字符串表示
171
+ info: 'var(--color-info, #909399)',
172
+ success: 'var(--color-success, #67C23A)',
173
+ warning: 'var(--color-warning, #E6A23C)',
174
+ danger: 'var(--color-danger, #F56C6C)',
175
+ primary: 'var(--color-primary, #409EFF)',
176
+ },
177
+ defaultActiveNodes: [],
178
+ };
179
+ },
180
+ computed: {
181
+ dotMargin() {
182
+ switch (this.dotSize) {
183
+ case 'mini':
184
+ return '-8px 0 0 -9px';
185
+ case 'small':
186
+ return '-8px 0 0 -11px';
187
+ case 'medium':
188
+ return '-8px 0 0 -13px';
189
+ default:
190
+ return '-8px 0 0 -16px';
191
+ }
192
+ },
193
+ getLineColor() {
194
+ if (this.thinkingItems.length) {
195
+ const arr = this.thinkingItems.map(item => {
196
+ const _type_ = this.getType(item);
197
+ if (_type_) {
198
+ return this.colorArr[_type_];
199
+ }
200
+ return '';
201
+ });
202
+ return arr;
203
+ }
204
+ return [];
205
+ },
206
+ activeNamesComputed() {
207
+ return this.thinkingItems
208
+ .filter(item => item.isCanExpand && item.isDefaultExpand)
209
+ .map(item => String(this.getId(item)));
210
+ },
211
+ },
212
+ watch: {
213
+ activeNamesComputed: {
214
+ handler(v) {
215
+ this.defaultActiveNodes = [...v];
216
+ },
217
+ immediate: true,
218
+ },
219
+ getLineColor() {
220
+ this.$nextTick(() => {
221
+ this.getEle();
222
+ });
223
+ },
224
+ },
225
+ mounted() {
226
+ this.$nextTick(() => {
227
+ this.getEle();
228
+ });
229
+ },
230
+ methods: {
231
+ handleExpand(item) {
232
+ this.$emit('handleExpand', item);
233
+ },
234
+ setRadialGradient(colors, ele) {
235
+ const length = ele.length;
236
+ Array.from(ele).forEach((item, index) => {
237
+ const line = item.children[0];
238
+ if (line) {
239
+ line.setAttribute(
240
+ 'style',
241
+ `
242
+ border: none;
243
+ width:2px;
244
+ background: linear-gradient(to bottom, ${colors[index]} 0% , ${
245
+ colors[index < length ? index + 1 : index]
246
+ } 100%);
247
+ `,
248
+ );
249
+ }
250
+ });
251
+ },
252
+ getEle() {
253
+ if (this.getLineColor && this.$refs.timelineRef && this.lineGradient) {
254
+ const ele = this.$refs.timelineRef.$el.children[0].children;
255
+ this.setRadialGradient(this.getLineColor, ele);
256
+ }
257
+ },
258
+ isLoading(item) {
259
+ const status = this.getStatus(item);
260
+ return status === this.statusEnum.loading.value;
261
+ },
262
+ isError(item) {
263
+ const status = this.getStatus(item);
264
+ return status === this.statusEnum.error.value;
265
+ },
266
+ getId(item) {
267
+ return get(item, this.rowKey);
268
+ },
269
+ getType(item) {
270
+ const status = this.getStatus(item);
271
+ // 优先查找statusEnum中value匹配的项
272
+ const matchedStatus = Object.values(this.statusEnum).find(s => s.value === status);
273
+ return matchedStatus ? matchedStatus.type : 'success';
274
+ },
275
+
276
+ getTitle(item) {
277
+ return get(item, this.titleKey) || '';
278
+ },
279
+ getThinkTitle(item) {
280
+ return get(item, this.thinkTitleKey) || '';
281
+ },
282
+ getThinkContent(item) {
283
+ return get(item, this.thinkContentKey) || '';
284
+ },
285
+ getStatus(item) {
286
+ return get(item, this.statusKey);
287
+ },
288
+ },
289
+ };
290
+ </script>
291
+ <style lang="scss" scoped>
292
+ @import '../../../styles/ThoughtChain.scss';
293
+ </style>
@@ -1,8 +1,8 @@
1
- import ElXTypewriter from './src/main.vue';
2
-
3
- /* istanbul ignore next */
4
- ElXTypewriter.install = function (Vue) {
5
- Vue.component(ElXTypewriter.name, ElXTypewriter);
6
- };
7
-
8
- export default ElXTypewriter;
1
+ import ElXTypewriter from './src/main.vue';
2
+
3
+ /* istanbul ignore next */
4
+ ElXTypewriter.install = function (Vue) {
5
+ Vue.component(ElXTypewriter.name, ElXTypewriter);
6
+ };
7
+
8
+ export default ElXTypewriter;
@@ -1,8 +1,8 @@
1
- import ElXWelcome from './src/main.vue';
2
-
3
- /* istanbul ignore next */
4
- ElXWelcome.install = function (Vue) {
5
- Vue.component(ElXWelcome.name, ElXWelcome);
6
- };
7
-
8
- export default ElXWelcome;
1
+ import ElXWelcome from './src/main.vue';
2
+
3
+ /* istanbul ignore next */
4
+ ElXWelcome.install = function (Vue) {
5
+ Vue.component(ElXWelcome.name, ElXWelcome);
6
+ };
7
+
8
+ export default ElXWelcome;