@gitlab/ui 104.2.0 → 105.0.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 +13 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +0 -5
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/package.json +1 -3
- package/src/index.js +0 -5
- package/src/scss/components.scss +0 -3
- package/translations.js +0 -57
- package/dist/components/experimental/duo/chat/components/duo_chat_context/constants.js +0 -21
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_details_modal/duo_chat_context_item_details_modal.js +0 -159
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.js +0 -273
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_category_items.js +0 -77
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_item.js +0 -89
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items.js +0 -147
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items_loading.js +0 -61
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover.js +0 -137
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.js +0 -163
- package/dist/components/experimental/duo/chat/components/duo_chat_context/mock_context_data.js +0 -308
- package/dist/components/experimental/duo/chat/components/duo_chat_context/utils.js +0 -140
- package/dist/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.js +0 -109
- package/dist/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.js +0 -111
- package/dist/components/experimental/duo/chat/components/duo_chat_message/buttons_utils.js +0 -33
- package/dist/components/experimental/duo/chat/components/duo_chat_message/constants.js +0 -14
- package/dist/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +0 -24
- package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +0 -300
- package/dist/components/experimental/duo/chat/components/duo_chat_message/insert_code_snippet_element.js +0 -56
- package/dist/components/experimental/duo/chat/components/duo_chat_message/utils.js +0 -17
- package/dist/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.js +0 -115
- package/dist/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.js +0 -72
- package/dist/components/experimental/duo/chat/constants.js +0 -35
- package/dist/components/experimental/duo/chat/duo_chat.js +0 -553
- package/dist/components/experimental/duo/chat/markdown_renderer.js +0 -25
- package/dist/components/experimental/duo/chat/mock_data.js +0 -170
- package/dist/components/experimental/duo/user_feedback/user_feedback.js +0 -106
- package/dist/components/experimental/duo/user_feedback/user_feedback_modal.js +0 -154
- package/dist/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.js +0 -106
- package/dist/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.js +0 -246
- package/src/components/experimental/duo/chat/components/duo_chat_context/constants.js +0 -21
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_details_modal/duo_chat_context_item_details_modal.vue +0 -182
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.md +0 -44
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.vue +0 -288
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_category_items.vue +0 -54
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_item.vue +0 -86
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items.vue +0 -168
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items_loading.vue +0 -43
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover.vue +0 -170
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.vue +0 -196
- package/src/components/experimental/duo/chat/components/duo_chat_context/mock_context_data.js +0 -362
- package/src/components/experimental/duo/chat/components/duo_chat_context/utils.js +0 -169
- package/src/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.md +0 -27
- package/src/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.vue +0 -99
- package/src/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.md +0 -10
- package/src/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.scss +0 -44
- package/src/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.vue +0 -112
- package/src/components/experimental/duo/chat/components/duo_chat_message/buttons_utils.js +0 -39
- package/src/components/experimental/duo/chat/components/duo_chat_message/constants.js +0 -12
- package/src/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +0 -24
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.md +0 -69
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.scss +0 -105
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.vue +0 -363
- package/src/components/experimental/duo/chat/components/duo_chat_message/insert_code_snippet_element.js +0 -51
- package/src/components/experimental/duo/chat/components/duo_chat_message/utils.js +0 -18
- package/src/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.md +0 -10
- package/src/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.vue +0 -91
- package/src/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.md +0 -10
- package/src/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.vue +0 -45
- package/src/components/experimental/duo/chat/constants.js +0 -37
- package/src/components/experimental/duo/chat/duo_chat.md +0 -202
- package/src/components/experimental/duo/chat/duo_chat.scss +0 -413
- package/src/components/experimental/duo/chat/duo_chat.vue +0 -751
- package/src/components/experimental/duo/chat/markdown_renderer.js +0 -29
- package/src/components/experimental/duo/chat/mock_data.js +0 -187
- package/src/components/experimental/duo/chat/variables.scss +0 -9
- package/src/components/experimental/duo/user_feedback/user_feedback.md +0 -90
- package/src/components/experimental/duo/user_feedback/user_feedback.vue +0 -95
- package/src/components/experimental/duo/user_feedback/user_feedback_modal.vue +0 -167
- package/src/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.md +0 -42
- package/src/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.vue +0 -96
- package/src/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.md +0 -46
- package/src/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.vue +0 -270
package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js
DELETED
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
import throttle from 'lodash/throttle';
|
|
2
|
-
import GlIcon from '../../../../../base/icon/icon';
|
|
3
|
-
import GlAnimatedLoaderIcon from '../../../../../base/animated_icon/animated_loader_icon';
|
|
4
|
-
import { GlTooltipDirective } from '../../../../../../directives/tooltip';
|
|
5
|
-
import GlDuoChatContextItemSelections from '../duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections';
|
|
6
|
-
import GlDuoUserFeedback from '../../../user_feedback/user_feedback';
|
|
7
|
-
import GlFormGroup from '../../../../../base/form/form_group/form_group';
|
|
8
|
-
import GlFormTextarea from '../../../../../base/form/form_textarea/form_textarea';
|
|
9
|
-
import { SafeHtmlDirective } from '../../../../../../directives/safe_html/safe_html';
|
|
10
|
-
import { SELECTED_CONTEXT_ITEMS_DEFAULT_COLLAPSED, MESSAGE_MODEL_ROLES } from '../../constants';
|
|
11
|
-
import { translate, translatePlural, sprintf } from '../../../../../../utils/i18n';
|
|
12
|
-
import DocumentationSources from '../duo_chat_message_sources/duo_chat_message_sources';
|
|
13
|
-
import { renderDuoChatMarkdownPreview } from '../../markdown_renderer';
|
|
14
|
-
import { CopyCodeElement } from './copy_code_element';
|
|
15
|
-
import { InsertCodeSnippetElement } from './insert_code_snippet_element';
|
|
16
|
-
import { concatUntilEmpty } from './utils';
|
|
17
|
-
import { DUO_CODE_SCRIM_BOTTOM_CLASS, DUO_CODE_SCRIM_OFFSET, DUO_CODE_SCRIM_TOP_CLASS } from './constants';
|
|
18
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
22
|
-
*
|
|
23
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
24
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
25
|
-
*
|
|
26
|
-
* For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
|
|
27
|
-
*/
|
|
28
|
-
const i18n = {
|
|
29
|
-
MODAL: {
|
|
30
|
-
TITLE: translate('GlDuoChatMessage.modalTitle', 'Give feedback on GitLab Duo Chat'),
|
|
31
|
-
ALERT_TEXT: translate('GlDuoChatMessage.modalAlertText', 'GitLab team members cannot view your conversation. Please be as descriptive as possible.'),
|
|
32
|
-
DID_WHAT: translate('GlDuoChatMessage.modalDidWhat', 'What were you doing?'),
|
|
33
|
-
INTERACTION: translate('GlDuoChatMessage.modalInteraction', 'The situation in which you interacted with GitLab Duo Chat.'),
|
|
34
|
-
IMPROVE_WHAT: translate('GlDuoChatMessage.modalImproveWhat', 'How could the response be improved?'),
|
|
35
|
-
BETTER_RESPONSE: translate('GlDuoChatMessage.modalBetterResponse', 'How the response might better meet your needs.'),
|
|
36
|
-
MESSAGE_ERROR: translate('GlDuoChatMessage.modalMessageError', 'Error sending the message')
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
var script = {
|
|
40
|
-
name: 'GlDuoChatMessage',
|
|
41
|
-
i18n,
|
|
42
|
-
safeHtmlConfigExtension: {
|
|
43
|
-
ADD_TAGS: ['copy-code', 'insert-code-snippet']
|
|
44
|
-
},
|
|
45
|
-
components: {
|
|
46
|
-
DocumentationSources,
|
|
47
|
-
GlDuoChatContextItemSelections,
|
|
48
|
-
GlDuoUserFeedback,
|
|
49
|
-
GlFormGroup,
|
|
50
|
-
GlFormTextarea,
|
|
51
|
-
GlIcon,
|
|
52
|
-
GlAnimatedLoaderIcon
|
|
53
|
-
},
|
|
54
|
-
directives: {
|
|
55
|
-
SafeHtml: SafeHtmlDirective,
|
|
56
|
-
GlTooltip: GlTooltipDirective
|
|
57
|
-
},
|
|
58
|
-
provide() {
|
|
59
|
-
return {
|
|
60
|
-
modalTitle: i18n.MODAL.TITLE,
|
|
61
|
-
modalAlertText: i18n.MODAL.ALERT_TEXT
|
|
62
|
-
};
|
|
63
|
-
},
|
|
64
|
-
inject: {
|
|
65
|
-
// Note, we likely might move away from Provide/Inject for this
|
|
66
|
-
// and only ship the versions that are currently in the default
|
|
67
|
-
// See https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/3953#note_1762834219
|
|
68
|
-
// for more context.
|
|
69
|
-
renderGFM: {
|
|
70
|
-
from: 'renderGFM',
|
|
71
|
-
default: () => element => {
|
|
72
|
-
element.classList.add('duo-chat-markdown', 'duo-chat-compact-markdown');
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
renderMarkdown: {
|
|
76
|
-
from: 'renderMarkdown',
|
|
77
|
-
default: () => renderDuoChatMarkdownPreview
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
props: {
|
|
81
|
-
/**
|
|
82
|
-
* A message object
|
|
83
|
-
*/
|
|
84
|
-
message: {
|
|
85
|
-
type: Object,
|
|
86
|
-
required: true
|
|
87
|
-
},
|
|
88
|
-
isCancelled: {
|
|
89
|
-
type: Boolean,
|
|
90
|
-
required: true
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
data() {
|
|
94
|
-
return {
|
|
95
|
-
didWhat: '',
|
|
96
|
-
improveWhat: '',
|
|
97
|
-
messageWatcher: null,
|
|
98
|
-
// imperatively set up watcher on message
|
|
99
|
-
messageChunks: [],
|
|
100
|
-
selectedContextItemsDefaultCollapsed: SELECTED_CONTEXT_ITEMS_DEFAULT_COLLAPSED
|
|
101
|
-
};
|
|
102
|
-
},
|
|
103
|
-
computed: {
|
|
104
|
-
isChunk() {
|
|
105
|
-
return typeof this.message.chunkId === 'number';
|
|
106
|
-
},
|
|
107
|
-
isNotChunkOrCancelled() {
|
|
108
|
-
return !this.isChunk || this.isCancelled;
|
|
109
|
-
},
|
|
110
|
-
isChunkAndNotCancelled() {
|
|
111
|
-
return this.isChunk && !this.isCancelled;
|
|
112
|
-
},
|
|
113
|
-
isAssistantMessage() {
|
|
114
|
-
return this.message.role.toLowerCase() === MESSAGE_MODEL_ROLES.assistant;
|
|
115
|
-
},
|
|
116
|
-
isUserMessage() {
|
|
117
|
-
return this.message.role.toLowerCase() === MESSAGE_MODEL_ROLES.user;
|
|
118
|
-
},
|
|
119
|
-
sources() {
|
|
120
|
-
var _this$message$extras;
|
|
121
|
-
return (_this$message$extras = this.message.extras) === null || _this$message$extras === void 0 ? void 0 : _this$message$extras.sources;
|
|
122
|
-
},
|
|
123
|
-
hasFeedback() {
|
|
124
|
-
var _this$message$extras2;
|
|
125
|
-
return (_this$message$extras2 = this.message.extras) === null || _this$message$extras2 === void 0 ? void 0 : _this$message$extras2.hasFeedback;
|
|
126
|
-
},
|
|
127
|
-
defaultContent() {
|
|
128
|
-
if (this.message.contentHtml) {
|
|
129
|
-
return this.message.contentHtml;
|
|
130
|
-
}
|
|
131
|
-
return this.renderMarkdown(this.message.content);
|
|
132
|
-
},
|
|
133
|
-
messageContent() {
|
|
134
|
-
if (this.isAssistantMessage && this.isChunk) {
|
|
135
|
-
return this.renderMarkdown(concatUntilEmpty(this.messageChunks));
|
|
136
|
-
}
|
|
137
|
-
return this.defaultContent || this.renderMarkdown(concatUntilEmpty(this.message.chunks));
|
|
138
|
-
},
|
|
139
|
-
renderedError() {
|
|
140
|
-
var _this$message$errors;
|
|
141
|
-
return this.renderMarkdown(((_this$message$errors = this.message.errors) === null || _this$message$errors === void 0 ? void 0 : _this$message$errors.join('; ')) || '');
|
|
142
|
-
},
|
|
143
|
-
error() {
|
|
144
|
-
var _this$message, _this$message$errors2;
|
|
145
|
-
return Boolean((_this$message = this.message) === null || _this$message === void 0 ? void 0 : (_this$message$errors2 = _this$message.errors) === null || _this$message$errors2 === void 0 ? void 0 : _this$message$errors2.length) && this.message.errors.join('; ');
|
|
146
|
-
},
|
|
147
|
-
selectedContextItems() {
|
|
148
|
-
var _this$message$extras3;
|
|
149
|
-
return ((_this$message$extras3 = this.message.extras) === null || _this$message$extras3 === void 0 ? void 0 : _this$message$extras3.contextItems) || [];
|
|
150
|
-
},
|
|
151
|
-
displaySelectedContextItems() {
|
|
152
|
-
return Boolean(this.selectedContextItems.length);
|
|
153
|
-
},
|
|
154
|
-
selectedContextItemsTitle() {
|
|
155
|
-
if (!this.displaySelectedContextItems) return '';
|
|
156
|
-
const count = this.selectedContextItems.length;
|
|
157
|
-
if (this.isUserMessage) {
|
|
158
|
-
return translatePlural('GlDuoChatMessage.SelectedContextItemsTitleUserMessage', 'Included reference', 'Included references')(count);
|
|
159
|
-
}
|
|
160
|
-
return sprintf(translatePlural('GlDuoChatMessage.SelectedContextItemsTitleAssistantMessage', 'Used %{count} included reference', 'Used %{count} included references')(count), {
|
|
161
|
-
count
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
beforeCreate() {
|
|
166
|
-
if (!customElements.get('copy-code')) {
|
|
167
|
-
customElements.define('copy-code', CopyCodeElement);
|
|
168
|
-
}
|
|
169
|
-
if (!customElements.get('insert-code-snippet')) {
|
|
170
|
-
customElements.define('insert-code-snippet', InsertCodeSnippetElement);
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
mounted() {
|
|
174
|
-
if (this.isAssistantMessage) {
|
|
175
|
-
// The watcher has to be created imperatively here
|
|
176
|
-
// to give an opportunity to remove it after
|
|
177
|
-
// the complete message has arrived
|
|
178
|
-
this.messageWatcher = this.$watch('message', this.manageMessageUpdate);
|
|
179
|
-
}
|
|
180
|
-
this.setChunks();
|
|
181
|
-
this.hydrateContentWithGFM();
|
|
182
|
-
},
|
|
183
|
-
updated() {
|
|
184
|
-
this.hydrateContentWithGFM();
|
|
185
|
-
},
|
|
186
|
-
methods: {
|
|
187
|
-
setChunks() {
|
|
188
|
-
if (this.isChunk) {
|
|
189
|
-
const {
|
|
190
|
-
chunkId,
|
|
191
|
-
content
|
|
192
|
-
} = this.message;
|
|
193
|
-
this.$set(this.messageChunks, chunkId - 1, content);
|
|
194
|
-
} else {
|
|
195
|
-
this.messageChunks = [];
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
stopWatchingMessage() {
|
|
199
|
-
if (this.messageWatcher) {
|
|
200
|
-
this.messageWatcher(); // Stop watching the message prop
|
|
201
|
-
this.messageWatcher = null; // Ensure the watcher can't be stopped multiple times
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
hydrateContentWithGFM() {
|
|
205
|
-
if (!this.isChunk && this.$refs.content) {
|
|
206
|
-
this.$nextTick(this.renderGFM(this.$refs.content));
|
|
207
|
-
}
|
|
208
|
-
this.detectScrollableCodeBlocks();
|
|
209
|
-
},
|
|
210
|
-
logEvent(e) {
|
|
211
|
-
this.$emit('track-feedback', {
|
|
212
|
-
...e,
|
|
213
|
-
didWhat: this.didWhat,
|
|
214
|
-
improveWhat: this.improveWhat,
|
|
215
|
-
message: this.message
|
|
216
|
-
});
|
|
217
|
-
},
|
|
218
|
-
manageMessageUpdate() {
|
|
219
|
-
this.setChunks();
|
|
220
|
-
if (!this.isChunk) {
|
|
221
|
-
this.stopWatchingMessage();
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
onInsertCodeSnippet(e) {
|
|
225
|
-
this.$emit('insert-code-snippet', e);
|
|
226
|
-
},
|
|
227
|
-
onGetContextItemContent(contextItem) {
|
|
228
|
-
this.$emit('get-context-item-content', {
|
|
229
|
-
messageId: this.message.id,
|
|
230
|
-
contextItem
|
|
231
|
-
});
|
|
232
|
-
},
|
|
233
|
-
detectScrollableCodeBlocks() {
|
|
234
|
-
const codeBlocks = document.querySelectorAll('.duo-chat-message pre');
|
|
235
|
-
codeBlocks.forEach(e => {
|
|
236
|
-
if (e.scrollHeight > e.offsetHeight) {
|
|
237
|
-
e.classList.add(DUO_CODE_SCRIM_BOTTOM_CLASS);
|
|
238
|
-
e.addEventListener('scroll', throttle(() => this.toggleScrolling(e), 200));
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
},
|
|
242
|
-
toggleScrolling(e) {
|
|
243
|
-
if (e.scrollHeight - e.scrollTop <= e.offsetHeight + DUO_CODE_SCRIM_OFFSET) {
|
|
244
|
-
e.classList.remove(DUO_CODE_SCRIM_BOTTOM_CLASS);
|
|
245
|
-
} else {
|
|
246
|
-
e.classList.add(DUO_CODE_SCRIM_BOTTOM_CLASS);
|
|
247
|
-
}
|
|
248
|
-
if (e.scrollTop > DUO_CODE_SCRIM_OFFSET) {
|
|
249
|
-
e.classList.add(DUO_CODE_SCRIM_TOP_CLASS);
|
|
250
|
-
} else {
|
|
251
|
-
e.classList.remove(DUO_CODE_SCRIM_TOP_CLASS);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
/* script */
|
|
258
|
-
const __vue_script__ = script;
|
|
259
|
-
|
|
260
|
-
/* template */
|
|
261
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"duo-chat-message gl-border gl-border-transparent gl-p-4 gl-leading-20 gl-break-anywhere",class:{
|
|
262
|
-
'gl-ml-auto gl-rounded-br-none gl-bg-blue-100 gl-text-blue-900': _vm.isUserMessage,
|
|
263
|
-
'gl-rounded-bl-none gl-border-1 gl-border-solid gl-border-gray-50 gl-text-default':
|
|
264
|
-
_vm.isAssistantMessage,
|
|
265
|
-
'gl-bg-subtle': _vm.isAssistantMessage && !_vm.error,
|
|
266
|
-
'duo-chat-message-with-error gl-bg-red-50': _vm.error,
|
|
267
|
-
},on:{"insert-code-snippet":_vm.onInsertCodeSnippet}},[(_vm.error)?_c('gl-icon',{staticClass:"error-icon gl-border gl-mr-3 gl-shrink-0 gl-rounded-full gl-border-red-500 gl-text-red-600",attrs:{"aria-label":_vm.$options.i18n.MESSAGE_ERROR,"name":"status_warning_borderless","size":16,"data-testid":"error"}}):_vm._e(),_vm._v(" "),_c('div',{ref:"content-wrapper",class:{ 'has-error': _vm.error }},[(_vm.displaySelectedContextItems && _vm.isAssistantMessage)?_c('gl-duo-chat-context-item-selections',{attrs:{"selections":_vm.selectedContextItems,"title":_vm.selectedContextItemsTitle,"default-collapsed":_vm.selectedContextItemsDefaultCollapsed,"variant":"assistant"},on:{"get-content":_vm.onGetContextItemContent}}):_vm._e(),_vm._v(" "),(_vm.error)?_c('div',{directives:[{name:"safe-html",rawName:"v-safe-html:[$options.safeHtmlConfigExtension]",value:(_vm.renderedError),expression:"renderedError",arg:_vm.$options.safeHtmlConfigExtension}],ref:"error-message"}):_c('div',[_c('div',{directives:[{name:"safe-html",rawName:"v-safe-html:[$options.safeHtmlConfigExtension]",value:(_vm.messageContent),expression:"messageContent",arg:_vm.$options.safeHtmlConfigExtension}],ref:"content"}),_vm._v(" "),(_vm.isAssistantMessage)?[(_vm.sources)?_c('documentation-sources',{attrs:{"sources":_vm.sources}}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"duo-chat-message-feedback gl-mt-4 gl-flex gl-items-end"},[(_vm.isChunkAndNotCancelled)?_c('gl-animated-loader-icon',{attrs:{"is-on":true}}):_vm._e(),_vm._v(" "),(_vm.isNotChunkOrCancelled)?_c('gl-duo-user-feedback',{attrs:{"feedback-received":_vm.hasFeedback,"modal-title":_vm.$options.i18n.MODAL.TITLE,"modal-alert":_vm.$options.i18n.MODAL.ALERT_TEXT},on:{"feedback":_vm.logEvent},scopedSlots:_vm._u([{key:"feedback-extra-fields",fn:function(){return [_c('gl-form-group',{attrs:{"label":_vm.$options.i18n.MODAL.DID_WHAT,"optional":""}},[_c('gl-form-textarea',{attrs:{"placeholder":_vm.$options.i18n.MODAL.INTERACTION},model:{value:(_vm.didWhat),callback:function ($$v) {_vm.didWhat=$$v;},expression:"didWhat"}})],1),_vm._v(" "),_c('gl-form-group',{attrs:{"label":_vm.$options.i18n.MODAL.IMPROVE_WHAT,"optional":""}},[_c('gl-form-textarea',{attrs:{"placeholder":_vm.$options.i18n.MODAL.BETTER_RESPONSE},model:{value:(_vm.improveWhat),callback:function ($$v) {_vm.improveWhat=$$v;},expression:"improveWhat"}})],1)]},proxy:true}],null,false,419229417)}):_vm._e()],1)]:_vm._e()],2),_vm._v(" "),(_vm.displaySelectedContextItems && _vm.isUserMessage)?_c('gl-duo-chat-context-item-selections',{attrs:{"selections":_vm.selectedContextItems,"title":_vm.selectedContextItemsTitle,"default-collapsed":_vm.selectedContextItemsDefaultCollapsed,"variant":"user"},on:{"get-content":_vm.onGetContextItemContent}}):_vm._e()],1)],1)};
|
|
268
|
-
var __vue_staticRenderFns__ = [];
|
|
269
|
-
|
|
270
|
-
/* style */
|
|
271
|
-
const __vue_inject_styles__ = undefined;
|
|
272
|
-
/* scoped */
|
|
273
|
-
const __vue_scope_id__ = undefined;
|
|
274
|
-
/* module identifier */
|
|
275
|
-
const __vue_module_identifier__ = undefined;
|
|
276
|
-
/* functional template */
|
|
277
|
-
const __vue_is_functional_template__ = false;
|
|
278
|
-
/* style inject */
|
|
279
|
-
|
|
280
|
-
/* style inject SSR */
|
|
281
|
-
|
|
282
|
-
/* style inject shadow dom */
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
const __vue_component__ = __vue_normalize__(
|
|
287
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
288
|
-
__vue_inject_styles__,
|
|
289
|
-
__vue_script__,
|
|
290
|
-
__vue_scope_id__,
|
|
291
|
-
__vue_is_functional_template__,
|
|
292
|
-
__vue_module_identifier__,
|
|
293
|
-
false,
|
|
294
|
-
undefined,
|
|
295
|
-
undefined,
|
|
296
|
-
undefined
|
|
297
|
-
);
|
|
298
|
-
|
|
299
|
-
export default __vue_component__;
|
|
300
|
-
export { i18n };
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { createButton } from './buttons_utils';
|
|
2
|
-
|
|
3
|
-
function _assertClassBrand(e, t, n) {
|
|
4
|
-
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
5
|
-
throw new TypeError("Private element is not present on this object");
|
|
6
|
-
}
|
|
7
|
-
function _checkPrivateRedeclaration(e, t) {
|
|
8
|
-
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
9
|
-
}
|
|
10
|
-
function _classPrivateFieldGet2(s, a) {
|
|
11
|
-
return s.get(_assertClassBrand(s, a));
|
|
12
|
-
}
|
|
13
|
-
function _classPrivateFieldInitSpec(e, t, a) {
|
|
14
|
-
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
15
|
-
}
|
|
16
|
-
function _classPrivateFieldSet2(s, a, r) {
|
|
17
|
-
return s.set(_assertClassBrand(s, a), r), r;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const CODE_MARKDOWN_CLASS = 'js-markdown-code';
|
|
21
|
-
var _actionButton = /*#__PURE__*/new WeakMap();
|
|
22
|
-
var _codeBlock = /*#__PURE__*/new WeakMap();
|
|
23
|
-
var _handleClick = /*#__PURE__*/new WeakMap();
|
|
24
|
-
class InsertCodeSnippetElement extends HTMLElement {
|
|
25
|
-
constructor(codeBlock) {
|
|
26
|
-
super();
|
|
27
|
-
_classPrivateFieldInitSpec(this, _actionButton, void 0);
|
|
28
|
-
_classPrivateFieldInitSpec(this, _codeBlock, void 0);
|
|
29
|
-
_classPrivateFieldInitSpec(this, _handleClick, () => {
|
|
30
|
-
if (_classPrivateFieldGet2(_codeBlock, this)) {
|
|
31
|
-
_classPrivateFieldGet2(_codeBlock, this).dispatchEvent(new CustomEvent('insert-code-snippet', {
|
|
32
|
-
bubbles: true,
|
|
33
|
-
cancelable: true,
|
|
34
|
-
detail: {
|
|
35
|
-
code: _classPrivateFieldGet2(_codeBlock, this).textContent.trim()
|
|
36
|
-
}
|
|
37
|
-
}));
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
_classPrivateFieldSet2(_actionButton, this, createButton());
|
|
41
|
-
|
|
42
|
-
// we handle two possible cases here:
|
|
43
|
-
// 1. we use constructor parameter if the element is created in Javscript and inserted in the document
|
|
44
|
-
// 2. we find the wrapping element containing code if the element is received from the server
|
|
45
|
-
_classPrivateFieldSet2(_codeBlock, this, codeBlock !== null && codeBlock !== void 0 ? codeBlock : this.closest(`.${CODE_MARKDOWN_CLASS}`));
|
|
46
|
-
}
|
|
47
|
-
connectedCallback() {
|
|
48
|
-
this.appendChild(_classPrivateFieldGet2(_actionButton, this));
|
|
49
|
-
_classPrivateFieldGet2(_actionButton, this).addEventListener('click', _classPrivateFieldGet2(_handleClick, this));
|
|
50
|
-
}
|
|
51
|
-
disconnectedCallback() {
|
|
52
|
-
_classPrivateFieldGet2(_actionButton, this).removeEventListener('click', _classPrivateFieldGet2(_handleClick, this));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export { InsertCodeSnippetElement };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
3
|
-
*
|
|
4
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
5
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
6
|
-
*
|
|
7
|
-
* For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const concatUntilEmpty = arr => {
|
|
11
|
-
if (!arr) return '';
|
|
12
|
-
let end = arr.findIndex(el => !el);
|
|
13
|
-
if (end < 0) end = arr.length;
|
|
14
|
-
return arr.slice(0, end).join('');
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export { concatUntilEmpty };
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { translatePlural } from '../../../../../../utils/i18n';
|
|
2
|
-
import GlIcon from '../../../../../base/icon/icon';
|
|
3
|
-
import GlLink from '../../../../../base/link/link';
|
|
4
|
-
import { DOCUMENTATION_SOURCE_TYPES } from '../../constants';
|
|
5
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
9
|
-
*
|
|
10
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
11
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
12
|
-
*
|
|
13
|
-
* For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
|
|
14
|
-
*/
|
|
15
|
-
const i18n = {
|
|
16
|
-
MESSAGE_SOURCE: function () {
|
|
17
|
-
let count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
18
|
-
return translatePlural('GlDuoChatMessageSources.messageSources', 'Source', 'Sources')(count);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
var script = {
|
|
22
|
-
name: 'GlDuoChatMessageSources',
|
|
23
|
-
components: {
|
|
24
|
-
GlIcon,
|
|
25
|
-
GlLink
|
|
26
|
-
},
|
|
27
|
-
props: {
|
|
28
|
-
/**
|
|
29
|
-
* The Array of the message sources.
|
|
30
|
-
*/
|
|
31
|
-
sources: {
|
|
32
|
-
type: Array,
|
|
33
|
-
required: true
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
computed: {
|
|
37
|
-
sourceLabel() {
|
|
38
|
-
return i18n.MESSAGE_SOURCE(this.sources.length);
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
methods: {
|
|
42
|
-
getSourceIcon(sourceType) {
|
|
43
|
-
const currentSourceType = Object.values(DOCUMENTATION_SOURCE_TYPES).find(_ref => {
|
|
44
|
-
let {
|
|
45
|
-
value
|
|
46
|
-
} = _ref;
|
|
47
|
-
return value === sourceType;
|
|
48
|
-
});
|
|
49
|
-
return (currentSourceType === null || currentSourceType === void 0 ? void 0 : currentSourceType.icon) || 'document';
|
|
50
|
-
},
|
|
51
|
-
getSourceTitle(_ref2) {
|
|
52
|
-
let {
|
|
53
|
-
title,
|
|
54
|
-
source_type: sourceType,
|
|
55
|
-
stage,
|
|
56
|
-
group,
|
|
57
|
-
date,
|
|
58
|
-
author
|
|
59
|
-
} = _ref2;
|
|
60
|
-
if (title) {
|
|
61
|
-
return title;
|
|
62
|
-
}
|
|
63
|
-
if (sourceType === DOCUMENTATION_SOURCE_TYPES.DOC.value) {
|
|
64
|
-
if (stage && group) {
|
|
65
|
-
return `${stage} / ${group}`;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
if (sourceType === DOCUMENTATION_SOURCE_TYPES.BLOG.value) {
|
|
69
|
-
if (date && author) {
|
|
70
|
-
return `${date} / ${author}`;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return this.sourceLabel;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/* script */
|
|
79
|
-
const __vue_script__ = script;
|
|
80
|
-
|
|
81
|
-
/* template */
|
|
82
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-mr-3 gl-mt-4 gl-text-gray-600",attrs:{"data-testid":"duo-chat-message-sources"}},[(_vm.sources.length)?_c('span',[_vm._v(_vm._s(_vm.sourceLabel)+":")]):_vm._e(),_vm._v(" "),_c('ul',{staticClass:"gl-m-0 gl-list-none gl-p-0"},_vm._l((_vm.sources),function(source,index){return _c('li',{key:index,staticClass:"gl-flex gl-items-center gl-pt-3",attrs:{"data-testid":"source-list-item"}},[(source.source_type)?_c('gl-icon',{staticClass:"gl-mr-2 gl-shrink-0",attrs:{"name":_vm.getSourceIcon(source.source_type)}}):_vm._e(),_vm._v(" "),_c('gl-link',{attrs:{"href":source.source_url}},[_vm._v(_vm._s(_vm.getSourceTitle(source)))])],1)}),0)])};
|
|
83
|
-
var __vue_staticRenderFns__ = [];
|
|
84
|
-
|
|
85
|
-
/* style */
|
|
86
|
-
const __vue_inject_styles__ = undefined;
|
|
87
|
-
/* scoped */
|
|
88
|
-
const __vue_scope_id__ = undefined;
|
|
89
|
-
/* module identifier */
|
|
90
|
-
const __vue_module_identifier__ = undefined;
|
|
91
|
-
/* functional template */
|
|
92
|
-
const __vue_is_functional_template__ = false;
|
|
93
|
-
/* style inject */
|
|
94
|
-
|
|
95
|
-
/* style inject SSR */
|
|
96
|
-
|
|
97
|
-
/* style inject shadow dom */
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const __vue_component__ = __vue_normalize__(
|
|
102
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
103
|
-
__vue_inject_styles__,
|
|
104
|
-
__vue_script__,
|
|
105
|
-
__vue_scope_id__,
|
|
106
|
-
__vue_is_functional_template__,
|
|
107
|
-
__vue_module_identifier__,
|
|
108
|
-
false,
|
|
109
|
-
undefined,
|
|
110
|
-
undefined,
|
|
111
|
-
undefined
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
export default __vue_component__;
|
|
115
|
-
export { i18n };
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import GlButton from '../../../../../base/button/button';
|
|
2
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
6
|
-
*
|
|
7
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
8
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
9
|
-
*
|
|
10
|
-
* For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
|
|
11
|
-
*/
|
|
12
|
-
var script = {
|
|
13
|
-
name: 'GlDuoChatPredefinedPrompts',
|
|
14
|
-
components: {
|
|
15
|
-
GlButton
|
|
16
|
-
},
|
|
17
|
-
props: {
|
|
18
|
-
/**
|
|
19
|
-
* Array of predefined prompts to display. Every prompt should be a string which will be converted into a prompt when clicked.
|
|
20
|
-
*/
|
|
21
|
-
prompts: {
|
|
22
|
-
type: Array,
|
|
23
|
-
required: true
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
methods: {
|
|
27
|
-
handleClick(prompt) {
|
|
28
|
-
/**
|
|
29
|
-
* Emits the prompt string that was clicked.
|
|
30
|
-
*/
|
|
31
|
-
this.$emit('click', prompt);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/* script */
|
|
37
|
-
const __vue_script__ = script;
|
|
38
|
-
|
|
39
|
-
/* template */
|
|
40
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-text-right"},_vm._l((_vm.prompts),function(prompt,index){return _c('div',{key:("question-" + index),staticClass:"gl-mt-3"},[_c('gl-button',{attrs:{"category":"secondary","variant":"confirm"},on:{"click":function($event){return _vm.handleClick(prompt)}}},[_c('span',{staticClass:"gl-whitespace-normal"},[_vm._v(_vm._s(prompt))])])],1)}),0)};
|
|
41
|
-
var __vue_staticRenderFns__ = [];
|
|
42
|
-
|
|
43
|
-
/* style */
|
|
44
|
-
const __vue_inject_styles__ = undefined;
|
|
45
|
-
/* scoped */
|
|
46
|
-
const __vue_scope_id__ = undefined;
|
|
47
|
-
/* module identifier */
|
|
48
|
-
const __vue_module_identifier__ = undefined;
|
|
49
|
-
/* functional template */
|
|
50
|
-
const __vue_is_functional_template__ = false;
|
|
51
|
-
/* style inject */
|
|
52
|
-
|
|
53
|
-
/* style inject SSR */
|
|
54
|
-
|
|
55
|
-
/* style inject shadow dom */
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const __vue_component__ = __vue_normalize__(
|
|
60
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
61
|
-
__vue_inject_styles__,
|
|
62
|
-
__vue_script__,
|
|
63
|
-
__vue_scope_id__,
|
|
64
|
-
__vue_is_functional_template__,
|
|
65
|
-
__vue_module_identifier__,
|
|
66
|
-
false,
|
|
67
|
-
undefined,
|
|
68
|
-
undefined,
|
|
69
|
-
undefined
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
export default __vue_component__;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
3
|
-
*
|
|
4
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
5
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
6
|
-
*
|
|
7
|
-
* For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const CHAT_RESET_MESSAGE = '/reset';
|
|
11
|
-
const CHAT_CLEAR_MESSAGE = '/clear';
|
|
12
|
-
const CHAT_INCLUDE_MESSAGE = '/include';
|
|
13
|
-
const LOADING_TRANSITION_DURATION = 7500;
|
|
14
|
-
const DOCUMENTATION_SOURCE_TYPES = {
|
|
15
|
-
HANDBOOK: {
|
|
16
|
-
value: 'handbook',
|
|
17
|
-
icon: 'book'
|
|
18
|
-
},
|
|
19
|
-
DOC: {
|
|
20
|
-
value: 'doc',
|
|
21
|
-
icon: 'documents'
|
|
22
|
-
},
|
|
23
|
-
BLOG: {
|
|
24
|
-
value: 'blog',
|
|
25
|
-
icon: 'list-bulleted'
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const MESSAGE_MODEL_ROLES = {
|
|
29
|
-
user: 'user',
|
|
30
|
-
system: 'system',
|
|
31
|
-
assistant: 'assistant'
|
|
32
|
-
};
|
|
33
|
-
const SELECTED_CONTEXT_ITEMS_DEFAULT_COLLAPSED = true;
|
|
34
|
-
|
|
35
|
-
export { CHAT_CLEAR_MESSAGE, CHAT_INCLUDE_MESSAGE, CHAT_RESET_MESSAGE, DOCUMENTATION_SOURCE_TYPES, LOADING_TRANSITION_DURATION, MESSAGE_MODEL_ROLES, SELECTED_CONTEXT_ITEMS_DEFAULT_COLLAPSED };
|