vue-element-ui-x 0.1.9-beta → 0.2.0

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 (82) hide show
  1. package/lib/components/Attachments/index.js +4 -4
  2. package/lib/components/Bubble/index.js +47 -34
  3. package/lib/components/BubbleList/index.js +65 -59
  4. package/lib/components/Conversations/index.js +29 -66
  5. package/lib/components/FilesCard/index.js +1 -1
  6. package/lib/components/Prompts/index.js +23 -23
  7. package/lib/components/Sender/index.js +6 -6
  8. package/lib/components/Think/index.js +1 -1
  9. package/lib/components/Thinking/index.js +5 -5
  10. package/lib/components/ThoughtChain/index.js +52 -41
  11. package/lib/components/Typewriter/index.js +46 -33
  12. package/lib/components/Welcome/index.js +5 -5
  13. package/lib/index.common.js +1 -1
  14. package/lib/index.esm.js +1 -1
  15. package/lib/index.js +266 -463
  16. package/lib/index.umd.js +1 -1
  17. package/lib/mixins/index.js +105 -16
  18. package/package.json +1 -1
  19. package/src/components/Attachments/index.js +8 -8
  20. package/src/components/Bubble/index.js +6 -6
  21. package/src/components/Bubble/src/main.vue +299 -299
  22. package/src/components/BubbleList/index.js +8 -8
  23. package/src/components/BubbleList/src/loading.vue +75 -75
  24. package/src/components/BubbleList/src/main.vue +461 -466
  25. package/src/components/Conversations/index.js +8 -8
  26. package/src/components/Conversations/src/components/item.vue +13 -34
  27. package/src/components/Conversations/src/main.vue +4 -18
  28. package/src/components/FilesCard/index.js +8 -8
  29. package/src/components/FilesCard/src/fileSvg/audio.vue +38 -38
  30. package/src/components/FilesCard/src/fileSvg/code.vue +35 -35
  31. package/src/components/FilesCard/src/fileSvg/database.vue +94 -94
  32. package/src/components/FilesCard/src/fileSvg/excel.vue +38 -38
  33. package/src/components/FilesCard/src/fileSvg/file.vue +40 -40
  34. package/src/components/FilesCard/src/fileSvg/image.vue +40 -40
  35. package/src/components/FilesCard/src/fileSvg/index.js +46 -46
  36. package/src/components/FilesCard/src/fileSvg/link.vue +54 -54
  37. package/src/components/FilesCard/src/fileSvg/mark.vue +38 -38
  38. package/src/components/FilesCard/src/fileSvg/pdf.vue +38 -38
  39. package/src/components/FilesCard/src/fileSvg/ppt.vue +38 -38
  40. package/src/components/FilesCard/src/fileSvg/three.vue +38 -38
  41. package/src/components/FilesCard/src/fileSvg/txt.vue +38 -38
  42. package/src/components/FilesCard/src/fileSvg/unknown.vue +54 -54
  43. package/src/components/FilesCard/src/fileSvg/video.vue +38 -38
  44. package/src/components/FilesCard/src/fileSvg/word.vue +38 -38
  45. package/src/components/FilesCard/src/fileSvg/zip.vue +38 -38
  46. package/src/components/FilesCard/src/options.js +18 -18
  47. package/src/components/Prompts/index.js +8 -8
  48. package/src/components/Prompts/src/main.vue +248 -248
  49. package/src/components/Sender/index.js +8 -8
  50. package/src/components/Sender/src/components/ClearButton.vue +28 -28
  51. package/src/components/Sender/src/components/Loading.vue +53 -53
  52. package/src/components/Sender/src/components/LoadingButton.vue +39 -39
  53. package/src/components/Sender/src/components/SendButton.vue +26 -26
  54. package/src/components/Sender/src/components/SpeechButton.vue +24 -24
  55. package/src/components/Sender/src/components/SpeechLoading.vue +87 -87
  56. package/src/components/Sender/src/components/SpeechLoadingButton.vue +43 -43
  57. package/src/components/Thinking/index.js +8 -8
  58. package/src/components/ThoughtChain/index.js +8 -8
  59. package/src/components/Typewriter/index.js +8 -8
  60. package/src/components/Typewriter/src/main.vue +10 -2
  61. package/src/components/Welcome/index.js +8 -8
  62. package/src/components/Welcome/src/main.vue +151 -151
  63. package/src/index.js +0 -2
  64. package/src/mixins/recordMixin.js +0 -1
  65. package/src/mixins/sendMixin.js +104 -11
  66. package/src/mixins/streamMixin.js +3 -5
  67. package/src/styles/Attachments.scss +236 -236
  68. package/src/styles/Bubble.scss +157 -157
  69. package/src/styles/BubbleList.scss +148 -148
  70. package/src/styles/Conversations.scss +260 -260
  71. package/src/styles/FilesCard.scss +221 -221
  72. package/src/styles/Prompts.scss +195 -195
  73. package/src/styles/Sender.scss +199 -199
  74. package/src/styles/Thinking.scss +2 -2
  75. package/src/styles/ThoughtChain.scss +113 -113
  76. package/src/styles/Typewriter.scss +66 -66
  77. package/src/theme/var.scss +72 -72
  78. package/src/components/Think/index.js +0 -8
  79. package/src/components/Think/src/main.vue +0 -190
  80. package/src/styles/Think.scss +0 -134
  81. package/src/styles/button.scss +0 -302
  82. package/src/styles/var.scss +0 -1052
@@ -1,39 +1,39 @@
1
- <template>
2
- <div class="el-x-send-button">
3
- <el-button
4
- circle
5
- @click="$emit('cancel')"
6
- size="small"
7
- >
8
- <loading class="loading-svg" />
9
- </el-button>
10
- </div>
11
- </template>
12
-
13
- <script>
14
- import Loading from './Loading.vue';
15
-
16
- export default {
17
- name: 'LoadingButton',
18
- components: {
19
- Loading,
20
- },
21
- };
22
- </script>
23
-
24
- <style scoped lang="scss">
25
- @import '~element-ui/packages/theme-chalk/src/common/var';
26
-
27
- .el-x-send-button {
28
- height: 32px;
29
- .el-button {
30
- padding: 0;
31
- width: 32px;
32
- height: 32px;
33
- }
34
- .loading-svg {
35
- color: $--color-primary;
36
- width: 100%;
37
- }
38
- }
39
- </style>
1
+ <template>
2
+ <div class="el-x-send-button">
3
+ <el-button
4
+ circle
5
+ @click="$emit('cancel')"
6
+ size="small"
7
+ >
8
+ <loading class="loading-svg" />
9
+ </el-button>
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ import Loading from './Loading.vue';
15
+
16
+ export default {
17
+ name: 'LoadingButton',
18
+ components: {
19
+ Loading,
20
+ },
21
+ };
22
+ </script>
23
+
24
+ <style scoped lang="scss">
25
+ @import '~element-ui/packages/theme-chalk/src/common/var';
26
+
27
+ .el-x-send-button {
28
+ height: 32px;
29
+ .el-button {
30
+ padding: 0;
31
+ width: 32px;
32
+ height: 32px;
33
+ }
34
+ .loading-svg {
35
+ color: $--color-primary;
36
+ width: 100%;
37
+ }
38
+ }
39
+ </style>
@@ -1,26 +1,26 @@
1
- <template>
2
- <div class="el-x-send-button">
3
- <el-button
4
- circle
5
- :disabled="disabled"
6
- @click="$emit('submit')"
7
- size="small"
8
- >
9
- <i class="el-icon-top"></i>
10
- </el-button>
11
- </div>
12
- </template>
13
-
14
- <script>
15
- export default {
16
- name: 'SendButton',
17
- props: {
18
- disabled: {
19
- type: Boolean,
20
- default: false,
21
- },
22
- },
23
- };
24
- </script>
25
-
26
- <style scoped lang="scss"></style>
1
+ <template>
2
+ <div class="el-x-send-button">
3
+ <el-button
4
+ circle
5
+ :disabled="disabled"
6
+ @click="$emit('submit')"
7
+ size="small"
8
+ >
9
+ <i class="el-icon-top"></i>
10
+ </el-button>
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ export default {
16
+ name: 'SendButton',
17
+ props: {
18
+ disabled: {
19
+ type: Boolean,
20
+ default: false,
21
+ },
22
+ },
23
+ };
24
+ </script>
25
+
26
+ <style scoped lang="scss"></style>
@@ -1,24 +1,24 @@
1
- <template>
2
- <div class="el-x-send-button">
3
- <el-button
4
- circle
5
- size="small"
6
- @click="onClick"
7
- >
8
- <i class="el-icon-microphone"></i>
9
- </el-button>
10
- </div>
11
- </template>
12
-
13
- <script>
14
- export default {
15
- name: 'SpeechButton',
16
- methods: {
17
- onClick() {
18
- this.$emit('click');
19
- },
20
- },
21
- };
22
- </script>
23
-
24
- <style scoped lang="scss"></style>
1
+ <template>
2
+ <div class="el-x-send-button">
3
+ <el-button
4
+ circle
5
+ size="small"
6
+ @click="onClick"
7
+ >
8
+ <i class="el-icon-microphone"></i>
9
+ </el-button>
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ export default {
15
+ name: 'SpeechButton',
16
+ methods: {
17
+ onClick() {
18
+ this.$emit('click');
19
+ },
20
+ },
21
+ };
22
+ </script>
23
+
24
+ <style scoped lang="scss"></style>
@@ -1,87 +1,87 @@
1
- <template>
2
- <svg
3
- :class="className"
4
- color="currentColor"
5
- :viewBox="`0 0 ${SIZE} ${SIZE}`"
6
- xmlns="http://www.w3.org/2000/svg"
7
- xmlns:xlink="http://www.w3.org/1999/xlink"
8
- >
9
- <title>Speech Recording</title>
10
-
11
- <rect
12
- v-for="(item, index) in rects"
13
- :key="index"
14
- fill="currentColor"
15
- :rx="RECT_RADIUS"
16
- :ry="RECT_RADIUS"
17
- :height="RECT_HEIGHT_MIN"
18
- :width="RECT_WIDTH"
19
- :x="item.x"
20
- :y="item.yMin"
21
- >
22
- <animate
23
- attributeName="height"
24
- :values="`${RECT_HEIGHT_MIN}; ${RECT_HEIGHT_MAX}; ${RECT_HEIGHT_MIN}`"
25
- keyTimes="0; 0.5; 1"
26
- :dur="`${DURATION}s`"
27
- :begin="`${(DURATION / COUNT) * index}s`"
28
- repeatCount="indefinite"
29
- />
30
- <animate
31
- attributeName="y"
32
- :values="`${item.yMin}; ${item.yMax}; ${item.yMin}`"
33
- keyTimes="0; 0.5; 1"
34
- :dur="`${DURATION}s`"
35
- :begin="`${(DURATION / COUNT) * index}s`"
36
- repeatCount="indefinite"
37
- />
38
- </rect>
39
- </svg>
40
- </template>
41
-
42
- <script>
43
- export default {
44
- name: 'SpeechLoading',
45
-
46
- props: {
47
- className: {
48
- type: String,
49
- default: '',
50
- },
51
- },
52
-
53
- data() {
54
- return {
55
- // 定义常量
56
- SIZE: 1000,
57
- COUNT: 4,
58
- RECT_WIDTH: 140,
59
- RECT_RADIUS: 70, // RECT_WIDTH / 2
60
- RECT_HEIGHT_MIN: 250,
61
- RECT_HEIGHT_MAX: 500,
62
- DURATION: 0.8,
63
- };
64
- },
65
-
66
- computed: {
67
- // 计算矩形的位置和高度范围
68
- rects() {
69
- const dest = (this.SIZE - this.RECT_WIDTH * this.COUNT) / (this.COUNT - 1);
70
- return Array.from({
71
- length: this.COUNT,
72
- }).map((_, index) => {
73
- const x = index * (dest + this.RECT_WIDTH);
74
- const yMin = this.SIZE / 2 - this.RECT_HEIGHT_MIN / 2;
75
- const yMax = this.SIZE / 2 - this.RECT_HEIGHT_MAX / 2;
76
- return {
77
- x,
78
- yMin,
79
- yMax,
80
- };
81
- });
82
- },
83
- },
84
- };
85
- </script>
86
-
87
- <style scoped></style>
1
+ <template>
2
+ <svg
3
+ :class="className"
4
+ color="currentColor"
5
+ :viewBox="`0 0 ${SIZE} ${SIZE}`"
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ xmlns:xlink="http://www.w3.org/1999/xlink"
8
+ >
9
+ <title>Speech Recording</title>
10
+
11
+ <rect
12
+ v-for="(item, index) in rects"
13
+ :key="index"
14
+ fill="currentColor"
15
+ :rx="RECT_RADIUS"
16
+ :ry="RECT_RADIUS"
17
+ :height="RECT_HEIGHT_MIN"
18
+ :width="RECT_WIDTH"
19
+ :x="item.x"
20
+ :y="item.yMin"
21
+ >
22
+ <animate
23
+ attributeName="height"
24
+ :values="`${RECT_HEIGHT_MIN}; ${RECT_HEIGHT_MAX}; ${RECT_HEIGHT_MIN}`"
25
+ keyTimes="0; 0.5; 1"
26
+ :dur="`${DURATION}s`"
27
+ :begin="`${(DURATION / COUNT) * index}s`"
28
+ repeatCount="indefinite"
29
+ />
30
+ <animate
31
+ attributeName="y"
32
+ :values="`${item.yMin}; ${item.yMax}; ${item.yMin}`"
33
+ keyTimes="0; 0.5; 1"
34
+ :dur="`${DURATION}s`"
35
+ :begin="`${(DURATION / COUNT) * index}s`"
36
+ repeatCount="indefinite"
37
+ />
38
+ </rect>
39
+ </svg>
40
+ </template>
41
+
42
+ <script>
43
+ export default {
44
+ name: 'SpeechLoading',
45
+
46
+ props: {
47
+ className: {
48
+ type: String,
49
+ default: '',
50
+ },
51
+ },
52
+
53
+ data() {
54
+ return {
55
+ // 定义常量
56
+ SIZE: 1000,
57
+ COUNT: 4,
58
+ RECT_WIDTH: 140,
59
+ RECT_RADIUS: 70, // RECT_WIDTH / 2
60
+ RECT_HEIGHT_MIN: 250,
61
+ RECT_HEIGHT_MAX: 500,
62
+ DURATION: 0.8,
63
+ };
64
+ },
65
+
66
+ computed: {
67
+ // 计算矩形的位置和高度范围
68
+ rects() {
69
+ const dest = (this.SIZE - this.RECT_WIDTH * this.COUNT) / (this.COUNT - 1);
70
+ return Array.from({
71
+ length: this.COUNT,
72
+ }).map((_, index) => {
73
+ const x = index * (dest + this.RECT_WIDTH);
74
+ const yMin = this.SIZE / 2 - this.RECT_HEIGHT_MIN / 2;
75
+ const yMax = this.SIZE / 2 - this.RECT_HEIGHT_MAX / 2;
76
+ return {
77
+ x,
78
+ yMin,
79
+ yMax,
80
+ };
81
+ });
82
+ },
83
+ },
84
+ };
85
+ </script>
86
+
87
+ <style scoped></style>
@@ -1,43 +1,43 @@
1
- <template>
2
- <div class="el-x-send-button">
3
- <el-button
4
- circle
5
- size="small"
6
- @click="onClick"
7
- >
8
- <speech-loading class="loading-svg" />
9
- </el-button>
10
- </div>
11
- </template>
12
-
13
- <script>
14
- import SpeechLoading from './SpeechLoading.vue';
15
-
16
- export default {
17
- name: 'SpeechLoadingButton',
18
- components: {
19
- SpeechLoading,
20
- },
21
- methods: {
22
- onClick() {
23
- this.$emit('click');
24
- },
25
- },
26
- };
27
- </script>
28
-
29
- <style scoped lang="scss">
30
- @import '~element-ui/packages/theme-chalk/src/common/var';
31
-
32
- .el-x-send-button {
33
- .el-button {
34
- padding: 0;
35
- width: 32px;
36
- height: 32px;
37
- }
38
- .loading-svg {
39
- color: $--color-primary;
40
- width: 16px;
41
- }
42
- }
43
- </style>
1
+ <template>
2
+ <div class="el-x-send-button">
3
+ <el-button
4
+ circle
5
+ size="small"
6
+ @click="onClick"
7
+ >
8
+ <speech-loading class="loading-svg" />
9
+ </el-button>
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ import SpeechLoading from './SpeechLoading.vue';
15
+
16
+ export default {
17
+ name: 'SpeechLoadingButton',
18
+ components: {
19
+ SpeechLoading,
20
+ },
21
+ methods: {
22
+ onClick() {
23
+ this.$emit('click');
24
+ },
25
+ },
26
+ };
27
+ </script>
28
+
29
+ <style scoped lang="scss">
30
+ @import '~element-ui/packages/theme-chalk/src/common/var';
31
+
32
+ .el-x-send-button {
33
+ .el-button {
34
+ padding: 0;
35
+ width: 32px;
36
+ height: 32px;
37
+ }
38
+ .loading-svg {
39
+ color: $--color-primary;
40
+ width: 16px;
41
+ }
42
+ }
43
+ </style>
@@ -1,8 +1,8 @@
1
- import ElXThinking from './src/main.vue';
2
-
3
- /* istanbul ignore next */
4
- ElXThinking.install = function (Vue) {
5
- Vue.component(ElXThinking.name, ElXThinking);
6
- };
7
-
8
- export default ElXThinking;
1
+ import ElXThinking from './src/main.vue';
2
+
3
+ /* istanbul ignore next */
4
+ ElXThinking.install = function (Vue) {
5
+ Vue.component(ElXThinking.name, ElXThinking);
6
+ };
7
+
8
+ export default ElXThinking;
@@ -1,8 +1,8 @@
1
- import ElXThoughtChain from './src/main.vue';
2
-
3
- /* istanbul ignore next */
4
- ElXThoughtChain.install = function (Vue) {
5
- Vue.component(ElXThoughtChain.name, ElXThoughtChain);
6
- };
7
-
8
- export default ElXThoughtChain;
1
+ import ElXThoughtChain from './src/main.vue';
2
+
3
+ /* istanbul ignore next */
4
+ ElXThoughtChain.install = function (Vue) {
5
+ Vue.component(ElXThoughtChain.name, ElXThoughtChain);
6
+ };
7
+
8
+ export default ElXThoughtChain;
@@ -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;
@@ -137,8 +137,16 @@
137
137
  return;
138
138
  }
139
139
 
140
- // 仅在内容完全不同时重置
141
- if (!oldVal || newVal !== oldVal) {
140
+ // 流式更新优化:如果新内容是旧内容的扩展,则不重置
141
+ if (oldVal && newVal && newVal.startsWith(oldVal)) {
142
+ // 增量更新,只更新缓存,不重置打字状态
143
+ this.contentCache = newVal;
144
+ // 如果当前没在打字,且有新内容,继续打字
145
+ if (!this.isTyping && this.typingIndex < newVal.length) {
146
+ this.startTyping();
147
+ }
148
+ } else if (!oldVal || newVal !== oldVal) {
149
+ // 完全不同的内容才重置
142
150
  this.contentCache = newVal || '';
143
151
  if (!this.isTyping) {
144
152
  this.typingIndex = 0;
@@ -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;