@gitlab/ui 71.11.1 → 72.1.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.
- package/CHANGELOG.md +29 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +17 -45
- package/dist/components/experimental/duo/chat/mock_data.js +1 -9
- package/dist/tokens/css/tokens.css +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/js/tokens.dark.js +1 -1
- package/dist/tokens/js/tokens.js +1 -1
- package/dist/tokens/scss/_tokens.dark.scss +1 -1
- package/dist/tokens/scss/_tokens.scss +1 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/package.json +1 -1
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.spec.js +69 -259
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.vue +22 -43
- package/src/components/experimental/duo/chat/mock_data.js +0 -9
- package/src/scss/utilities.scss +16 -0
- package/src/scss/utility-mixins/flex.scss +4 -0
- package/src/scss/utility-mixins/sizing.scss +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
# [72.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v72.0.0...v72.1.0) (2023-12-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **css:** Add gl-align-self-baseline utility class ([7291f50](https://gitlab.com/gitlab-org/gitlab-ui/commit/7291f50cac7a4f9a2ca5e43390fad6896906022a))
|
|
7
|
+
* **CSS:** add `gl-h-10` utility CSS class ([75c253a](https://gitlab.com/gitlab-org/gitlab-ui/commit/75c253abc389a126e9ffa37ec4d64a6c87ffc807))
|
|
8
|
+
|
|
9
|
+
# [72.0.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v71.11.1...v72.0.0) (2023-12-18)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* Merge branch 'force-release' into 'main' ([7df9bbe](https://gitlab.com/gitlab-org/gitlab-ui/commit/7df9bbececf3e79513be7d022269fc84864cc7a2))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* Force a release ([090865a](https://gitlab.com/gitlab-org/gitlab-ui/commit/090865a92acbefa8b1891331651bfb27e430e0d8))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### BREAKING CHANGES
|
|
21
|
+
|
|
22
|
+
* This changes the API the GitLab duo chat component expects
|
|
23
|
+
|
|
24
|
+
See merge request https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/3868
|
|
25
|
+
|
|
26
|
+
Merged-by: Lukas 'Eipi' Eipert <leipert@gitlab.com>
|
|
27
|
+
Approved-by: Lukas 'Eipi' Eipert <leipert@gitlab.com>
|
|
28
|
+
Co-authored-by: Pavel Shutsin <pshutsin@gitlab.com>
|
|
29
|
+
|
|
1
30
|
## [71.11.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v71.11.0...v71.11.1) (2023-12-15)
|
|
2
31
|
|
|
3
32
|
|
package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js
CHANGED
|
@@ -5,12 +5,11 @@ import DocumentationSources from '../duo_chat_message_sources/duo_chat_message_s
|
|
|
5
5
|
import { CopyCodeElement } from './copy_code_element';
|
|
6
6
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return end > 0 ? arr.slice(start, end).join('') : arr.slice(start).join('');
|
|
8
|
+
const concatUntilEmpty = arr => {
|
|
9
|
+
if (!arr) return '';
|
|
10
|
+
let end = arr.findIndex(el => !el);
|
|
11
|
+
if (end < 0) end = arr.length;
|
|
12
|
+
return arr.slice(0, end).join('');
|
|
14
13
|
};
|
|
15
14
|
var script = {
|
|
16
15
|
name: 'GlDuoChatMessage',
|
|
@@ -34,12 +33,6 @@ var script = {
|
|
|
34
33
|
required: true
|
|
35
34
|
}
|
|
36
35
|
},
|
|
37
|
-
data() {
|
|
38
|
-
return {
|
|
39
|
-
messageContent: '',
|
|
40
|
-
messageWatcher: null
|
|
41
|
-
};
|
|
42
|
-
},
|
|
43
36
|
computed: {
|
|
44
37
|
isAssistantMessage() {
|
|
45
38
|
return this.message.role.toLowerCase() === MESSAGE_MODEL_ROLES.assistant;
|
|
@@ -51,50 +44,29 @@ var script = {
|
|
|
51
44
|
var _this$message$extras;
|
|
52
45
|
return (_this$message$extras = this.message.extras) === null || _this$message$extras === void 0 ? void 0 : _this$message$extras.sources;
|
|
53
46
|
},
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
messageContent() {
|
|
48
|
+
if (this.message.errors.length > 0) return this.renderMarkdown(this.message.errors.join('; '));
|
|
49
|
+
if (this.message.contentHtml) {
|
|
50
|
+
return this.message.contentHtml;
|
|
51
|
+
}
|
|
52
|
+
return this.renderMarkdown(this.message.content || concatUntilEmpty(this.message.chunks));
|
|
56
53
|
}
|
|
57
54
|
},
|
|
58
|
-
created() {
|
|
59
|
-
this.messageWatcher = this.$watch('message', this.messageUpdateHandler, {
|
|
60
|
-
deep: true
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
55
|
beforeCreate() {
|
|
64
|
-
/**
|
|
65
|
-
* Keeps cache of previous chunks used for rerendering the AI response when streaming.
|
|
66
|
-
* Is intentionally non-reactive
|
|
67
|
-
*/
|
|
68
|
-
this.messageChunks = [];
|
|
69
56
|
if (!customElements.get('copy-code')) {
|
|
70
57
|
customElements.define('copy-code', CopyCodeElement);
|
|
71
58
|
}
|
|
72
59
|
},
|
|
73
60
|
mounted() {
|
|
74
|
-
this
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
this.hydrateContentWithGFM();
|
|
61
|
+
this.$nextTick(this.hydrateContentWithGFM);
|
|
62
|
+
},
|
|
63
|
+
updated() {
|
|
64
|
+
this.$nextTick(this.hydrateContentWithGFM);
|
|
79
65
|
},
|
|
80
66
|
methods: {
|
|
81
67
|
async hydrateContentWithGFM() {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
},
|
|
85
|
-
async messageUpdateHandler() {
|
|
86
|
-
const {
|
|
87
|
-
chunkId,
|
|
88
|
-
content
|
|
89
|
-
} = this.message;
|
|
90
|
-
if (!chunkId) {
|
|
91
|
-
this.messageChunks = [];
|
|
92
|
-
this.messageContent = this.content;
|
|
93
|
-
this.messageWatcher();
|
|
94
|
-
this.hydrateContentWithGFM();
|
|
95
|
-
} else {
|
|
96
|
-
this.messageChunks[chunkId] = content;
|
|
97
|
-
this.messageContent = this.renderMarkdown(concatIndicesUntilEmpty(this.messageChunks));
|
|
68
|
+
if (this.message.contentHtml) {
|
|
69
|
+
this.renderGFM(this.$refs.content);
|
|
98
70
|
}
|
|
99
71
|
}
|
|
100
72
|
}
|
|
@@ -27,14 +27,6 @@ const MOCK_RESPONSE_MESSAGE = {
|
|
|
27
27
|
errors: [],
|
|
28
28
|
timestamp: '2021-04-21T12:00:00.000Z'
|
|
29
29
|
};
|
|
30
|
-
const MOCK_CHUNK_RESPONSE_MESSAGE = {
|
|
31
|
-
chunkId: 1,
|
|
32
|
-
content: 'chunk',
|
|
33
|
-
role: MESSAGE_MODEL_ROLES.assistant,
|
|
34
|
-
requestId: '987',
|
|
35
|
-
errors: [],
|
|
36
|
-
timestamp: '2021-04-21T12:00:00.000Z'
|
|
37
|
-
};
|
|
38
30
|
const MOCK_RESPONSE_MESSAGE_FOR_STREAMING = {
|
|
39
31
|
id: '123',
|
|
40
32
|
content: `To change your password in GitLab:
|
|
@@ -88,4 +80,4 @@ const renderGFM = el => {
|
|
|
88
80
|
});
|
|
89
81
|
};
|
|
90
82
|
|
|
91
|
-
export {
|
|
83
|
+
export { MOCK_RESPONSE_MESSAGE, MOCK_RESPONSE_MESSAGE_FOR_STREAMING, MOCK_USER_PROMPT_MESSAGE, generateMockResponseChunks, renderGFM, renderMarkdown };
|
package/dist/tokens/js/tokens.js
CHANGED