@gitlab/ui 66.25.0 → 66.26.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 +14 -0
- package/dist/components/charts/legend/legend.js +1 -1
- package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +128 -0
- package/dist/components/experimental/duo/chat/mock_data.js +41 -3
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- 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/utils/charts/constants.js +1 -1
- package/package.json +15 -15
- package/src/components/charts/legend/legend.scss +34 -19
- package/src/components/charts/legend/legend.stories.js +41 -4
- package/src/components/charts/legend/legend.vue +1 -1
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.md +60 -0
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.scss +18 -0
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.spec.js +381 -0
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.stories.js +45 -0
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.vue +107 -0
- package/src/components/experimental/duo/chat/mock_data.js +45 -2
- package/src/scss/components.scss +1 -0
- package/src/utils/charts/constants.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [66.26.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.25.1...v66.26.0) (2023-10-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlDuoChatMessage:** Implemented component ([633f36f](https://gitlab.com/gitlab-org/gitlab-ui/commit/633f36f4cb0a117beaf6d377e20fead885b6abb6))
|
|
7
|
+
|
|
8
|
+
## [66.25.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.25.0...v66.25.1) (2023-10-09)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **charts:** prevent long legends overflowing chart ([873edcf](https://gitlab.com/gitlab-org/gitlab-ui/commit/873edcf60afbd275f466a0ef200d5eb01c81eda1))
|
|
14
|
+
|
|
1
15
|
# [66.25.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.24.0...v66.25.0) (2023-10-05)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -184,7 +184,7 @@ var script = {
|
|
|
184
184
|
const __vue_script__ = script;
|
|
185
185
|
|
|
186
186
|
/* template */
|
|
187
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{"data-testid":"gl-chart-legend"}},[(_vm.layout === _vm.$options.legendLayoutTypes.LEGEND_LAYOUT_INLINE)?[_c('div',{staticClass:"gl-legend-inline"},_vm._l((_vm.seriesInfo),function(series,key){return _c('div',{key:key,staticClass:"gl-legend-inline-series",class:{
|
|
187
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-legend",attrs:{"data-testid":"gl-chart-legend"}},[(_vm.layout === _vm.$options.legendLayoutTypes.LEGEND_LAYOUT_INLINE)?[_c('div',{staticClass:"gl-legend-inline"},_vm._l((_vm.seriesInfo),function(series,key){return _c('div',{key:key,staticClass:"gl-legend-inline-series",class:{
|
|
188
188
|
'text-muted': _vm.disabledSeries[key],
|
|
189
189
|
'w-100': _vm.seriesNameIsLong(series.name),
|
|
190
190
|
'gl-hover-cursor-not-allowed!':
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { GlDuoUserFeedback } from '../../../../../../index';
|
|
2
|
+
import { SafeHtmlDirective } from '../../../../../../directives/safe_html/safe_html';
|
|
3
|
+
import { MESSAGE_MODEL_ROLES } from '../../constants';
|
|
4
|
+
import DocumentationSources from '../duo_chat_message_sources/duo_chat_message_sources';
|
|
5
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
6
|
+
|
|
7
|
+
const concatIndicesUntilEmpty = arr => {
|
|
8
|
+
const start = arr.findIndex(el => el);
|
|
9
|
+
if (start === -1 || start !== 1) return ''; // If there are no non-empty elements
|
|
10
|
+
|
|
11
|
+
const end = arr.slice(start).findIndex(el => !el);
|
|
12
|
+
return end > 0 ? arr.slice(start, end).join('') : arr.slice(start).join('');
|
|
13
|
+
};
|
|
14
|
+
var script = {
|
|
15
|
+
name: 'GlDuoChatMessage',
|
|
16
|
+
components: {
|
|
17
|
+
DocumentationSources,
|
|
18
|
+
GlDuoUserFeedback
|
|
19
|
+
},
|
|
20
|
+
directives: {
|
|
21
|
+
SafeHtml: SafeHtmlDirective
|
|
22
|
+
},
|
|
23
|
+
inject: ['renderGFM', 'renderMarkdown'],
|
|
24
|
+
props: {
|
|
25
|
+
/**
|
|
26
|
+
* A message object
|
|
27
|
+
*/
|
|
28
|
+
message: {
|
|
29
|
+
type: Object,
|
|
30
|
+
required: true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
data() {
|
|
34
|
+
return {
|
|
35
|
+
messageContent: ''
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
computed: {
|
|
39
|
+
isAssistantMessage() {
|
|
40
|
+
return this.message.role.toLowerCase() === MESSAGE_MODEL_ROLES.assistant;
|
|
41
|
+
},
|
|
42
|
+
isUserMessage() {
|
|
43
|
+
return this.message.role.toLowerCase() === MESSAGE_MODEL_ROLES.user;
|
|
44
|
+
},
|
|
45
|
+
sources() {
|
|
46
|
+
var _this$message$extras;
|
|
47
|
+
return (_this$message$extras = this.message.extras) === null || _this$message$extras === void 0 ? void 0 : _this$message$extras.sources;
|
|
48
|
+
},
|
|
49
|
+
content() {
|
|
50
|
+
return this.message.contentHtml || this.renderMarkdown(this.message.content || this.message.errors.join('; '));
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
watch: {
|
|
54
|
+
message: {
|
|
55
|
+
handler() {
|
|
56
|
+
const {
|
|
57
|
+
chunkId,
|
|
58
|
+
content
|
|
59
|
+
} = this.message;
|
|
60
|
+
if (!chunkId) {
|
|
61
|
+
this.messageChunks = [];
|
|
62
|
+
this.messageContent = this.content;
|
|
63
|
+
this.renderGFM(this.$refs.content);
|
|
64
|
+
} else {
|
|
65
|
+
this.messageChunks[chunkId] = content;
|
|
66
|
+
this.messageContent = this.renderMarkdown(concatIndicesUntilEmpty(this.messageChunks));
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
deep: true
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
beforeCreate() {
|
|
73
|
+
/**
|
|
74
|
+
* Keeps cache of previous chunks used for rerendering the AI response when streaming.
|
|
75
|
+
* Is intentionally non-reactive
|
|
76
|
+
*/
|
|
77
|
+
this.messageChunks = [];
|
|
78
|
+
},
|
|
79
|
+
mounted() {
|
|
80
|
+
this.messageContent = this.content;
|
|
81
|
+
if (this.message.chunkId) {
|
|
82
|
+
this.messageChunks[this.message.chunkId] = this.message.content;
|
|
83
|
+
}
|
|
84
|
+
this.renderGFM(this.$refs.content);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/* script */
|
|
89
|
+
const __vue_script__ = script;
|
|
90
|
+
|
|
91
|
+
/* template */
|
|
92
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-p-4 gl-mb-4 gl-rounded-lg gl-line-height-20 gl-word-break-word duo-chat-message",class:{
|
|
93
|
+
'gl-ml-auto gl-bg-blue-100 gl-text-blue-900 gl-rounded-bottom-right-none': _vm.isUserMessage,
|
|
94
|
+
'gl-rounded-bottom-left-none gl-text-gray-900 gl-bg-white gl-border-1 gl-border-solid gl-border-gray-50':
|
|
95
|
+
_vm.isAssistantMessage,
|
|
96
|
+
}},[_c('div',{directives:[{name:"safe-html",rawName:"v-safe-html",value:(_vm.messageContent),expression:"messageContent"}],ref:"content"}),_vm._v(" "),(_vm.isAssistantMessage)?[(_vm.sources)?_c('documentation-sources',{attrs:{"sources":_vm.sources}}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-display-flex gl-align-items-flex-end gl-mt-4"},[_c('gl-duo-user-feedback',{on:{"feedback":function($event){return _vm.$emit('track-feedback', $event)}}})],1)]:_vm._e()],2)};
|
|
97
|
+
var __vue_staticRenderFns__ = [];
|
|
98
|
+
|
|
99
|
+
/* style */
|
|
100
|
+
const __vue_inject_styles__ = undefined;
|
|
101
|
+
/* scoped */
|
|
102
|
+
const __vue_scope_id__ = undefined;
|
|
103
|
+
/* module identifier */
|
|
104
|
+
const __vue_module_identifier__ = undefined;
|
|
105
|
+
/* functional template */
|
|
106
|
+
const __vue_is_functional_template__ = false;
|
|
107
|
+
/* style inject */
|
|
108
|
+
|
|
109
|
+
/* style inject SSR */
|
|
110
|
+
|
|
111
|
+
/* style inject shadow dom */
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
const __vue_component__ = __vue_normalize__(
|
|
116
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
117
|
+
__vue_inject_styles__,
|
|
118
|
+
__vue_script__,
|
|
119
|
+
__vue_scope_id__,
|
|
120
|
+
__vue_is_functional_template__,
|
|
121
|
+
__vue_module_identifier__,
|
|
122
|
+
false,
|
|
123
|
+
undefined,
|
|
124
|
+
undefined,
|
|
125
|
+
undefined
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
export default __vue_component__;
|
|
@@ -17,8 +17,8 @@ const MOCK_SOURCES = [{
|
|
|
17
17
|
}];
|
|
18
18
|
const MOCK_RESPONSE_MESSAGE = {
|
|
19
19
|
id: '123',
|
|
20
|
-
content: '
|
|
21
|
-
contentHtml: '
|
|
20
|
+
content: 'To create a new template:\n\n1. Create a new Markdown (`.md`) file inside the `.gitlab/issue_templates/` or `.gitlab/merge_request_templates/` directory in your repository.\n2. Commit the template file to your default branch.\n\nTo check if this has worked correctly, create a new issue or merge request and see if you can find your template in the **Choose a template** dropdown list.',
|
|
21
|
+
contentHtml: '\u003cp data-sourcepos="1:1-1:25" dir="auto"\u003eTo create a new template:\u003c/p\u003e\n\u003col data-sourcepos="3:1-5:0" dir="auto"\u003e\n\u003cli data-sourcepos="3:1-3:143"\u003eCreate a new Markdown (\u003ccode\u003e.md\u003c/code\u003e) file inside the \u003ccode\u003e.gitlab/issue_templates/\u003c/code\u003e or \u003ccode\u003e.gitlab/merge_request_templates/\u003c/code\u003e directory in your repository.\u003c/li\u003e\n\u003cli data-sourcepos="4:1-5:0"\u003eCommit the template file to your default branch.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp data-sourcepos="6:1-6:156" dir="auto"\u003eTo check if this has worked correctly, create a new issue or merge request and see if you can find your template in the \u003cstrong\u003eChoose a template\u003c/strong\u003e dropdown list.\u003c/p\u003e',
|
|
22
22
|
role: MESSAGE_MODEL_ROLES.assistant,
|
|
23
23
|
extras: {
|
|
24
24
|
sources: MOCK_SOURCES
|
|
@@ -27,5 +27,43 @@ 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
|
+
const MOCK_RESPONSE_MESSAGE_FOR_STREAMING = {
|
|
39
|
+
id: '123',
|
|
40
|
+
content: `To change your password in GitLab:
|
|
41
|
+
|
|
42
|
+
Log in to your GitLab account.
|
|
43
|
+
Select your avatar in the top right corner and choose Edit profile.
|
|
44
|
+
On the left sidebar, select Password.
|
|
45
|
+
Enter your current password in the Current password field.
|
|
46
|
+
Enter your new password in the New password and Password confirmation fields.
|
|
47
|
+
Select Save password.
|
|
48
|
+
If you don't know your current password, select the I forgot my password link to reset it.
|
|
49
|
+
|
|
50
|
+
GitLab enforces password requirements when you choose a new password.`,
|
|
51
|
+
contentHtml: '',
|
|
52
|
+
role: 'assistant',
|
|
53
|
+
extras: {},
|
|
54
|
+
requestId: '987',
|
|
55
|
+
errors: [],
|
|
56
|
+
timestamp: '2021-04-21T12:00:00.000Z'
|
|
57
|
+
};
|
|
58
|
+
const MOCK_USER_PROMPT_MESSAGE = {
|
|
59
|
+
id: '456',
|
|
60
|
+
content: 'How to create a new template?',
|
|
61
|
+
contentHtml: '',
|
|
62
|
+
role: MESSAGE_MODEL_ROLES.user,
|
|
63
|
+
requestId: '987',
|
|
64
|
+
errors: [],
|
|
65
|
+
timestamp: '2021-04-21T12:00:00.000Z',
|
|
66
|
+
extras: null
|
|
67
|
+
};
|
|
30
68
|
|
|
31
|
-
export { MOCK_RESPONSE_MESSAGE };
|
|
69
|
+
export { MOCK_CHUNK_RESPONSE_MESSAGE, MOCK_RESPONSE_MESSAGE, MOCK_RESPONSE_MESSAGE_FOR_STREAMING, MOCK_USER_PROMPT_MESSAGE };
|