@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
|
@@ -1,29 +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
|
-
// eslint-disable-next-line no-restricted-imports
|
|
11
|
-
import { Marked } from 'marked';
|
|
12
|
-
import markedBidi from 'marked-bidi';
|
|
13
|
-
|
|
14
|
-
const duoMarked = new Marked([
|
|
15
|
-
{
|
|
16
|
-
async: false,
|
|
17
|
-
breaks: false,
|
|
18
|
-
gfm: false,
|
|
19
|
-
},
|
|
20
|
-
markedBidi(),
|
|
21
|
-
]);
|
|
22
|
-
|
|
23
|
-
export function renderDuoChatMarkdownPreview(md) {
|
|
24
|
-
try {
|
|
25
|
-
return md ? duoMarked.parse(md.toString()) : '';
|
|
26
|
-
} catch {
|
|
27
|
-
return md;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,187 +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
|
-
import { setStoryTimeout } from '../../../../utils/test_utils';
|
|
11
|
-
import {
|
|
12
|
-
DOCUMENTATION_SOURCE_TYPES,
|
|
13
|
-
MESSAGE_MODEL_ROLES,
|
|
14
|
-
CHAT_CLEAR_MESSAGE,
|
|
15
|
-
CHAT_RESET_MESSAGE,
|
|
16
|
-
CHAT_INCLUDE_MESSAGE,
|
|
17
|
-
} from './constants';
|
|
18
|
-
import { getMockContextItems } from './components/duo_chat_context/mock_context_data';
|
|
19
|
-
|
|
20
|
-
const MOCK_SOURCES = [
|
|
21
|
-
{
|
|
22
|
-
title: 'GitLab Handbook',
|
|
23
|
-
source_type: DOCUMENTATION_SOURCE_TYPES.HANDBOOK.value,
|
|
24
|
-
source_url: '/handbook/',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
stage: 'Mock Stage',
|
|
28
|
-
group: 'Mock Group',
|
|
29
|
-
source_type: DOCUMENTATION_SOURCE_TYPES.DOC.value,
|
|
30
|
-
source_url: '/company/team/',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
date: '2023-04-21',
|
|
34
|
-
author: 'Test User',
|
|
35
|
-
source_type: DOCUMENTATION_SOURCE_TYPES.BLOG.value,
|
|
36
|
-
source_url: '/blog/',
|
|
37
|
-
},
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
export const MOCK_RESPONSE_MESSAGE = {
|
|
41
|
-
id: '123',
|
|
42
|
-
content:
|
|
43
|
-
'Here is a simple JavaScript function to sum two numbers:\n\n ```js\n function sum(a, b) {\n return a + b;\n }\n ```\n \n To use it:\n \n ```js\n const result = sum(5, 3); // result = 8\n ```\n \n This function takes two number parameters, a and b. It returns the sum of adding them together.\n',
|
|
44
|
-
contentHtml:
|
|
45
|
-
'<p data-sourcepos="1:1-1:56" dir="auto">Here is a simple JavaScript function to sum two numbers:</p>\n<div class="gl-relative markdown-code-block js-markdown-code">\n<pre data-sourcepos="3:1-7:3" data-canonical-lang="js" class="code highlight js-syntax-highlight language-javascript" lang="javascript" v-pre="true"><code><span id="LC1" class="line" lang="javascript"><span class="kd">function</span> <span class="nf">sum</span><span class="p">(</span><span class="nx">a</span><span class="p">,</span> <span class="nx">b</span><span class="p">)</span> <span class="p">{</span></span>\n<span id="LC2" class="line" lang="javascript"> <span class="k">return</span> <span class="nx">a</span> <span class="o">+</span> <span class="nx">b</span><span class="p">;</span></span>\n<span id="LC3" class="line" lang="javascript"><span class="p">}</span></span></code></pre>\n<copy-code></copy-code>\n<insert-code-snippet></insert-code-snippet>\n</div>\n<p data-sourcepos="9:1-9:10" dir="auto">To use it:</p>\n<div class="gl-relative markdown-code-block js-markdown-code">\n<pre data-sourcepos="11:1-13:3" data-canonical-lang="js" class="code highlight js-syntax-highlight language-javascript" lang="javascript" v-pre="true"><code><span id="LC1" class="line" lang="javascript"><span class="kd">const</span> <span class="nx">result</span> <span class="o">=</span> <span class="nf">sum</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">3</span><span class="p">);</span> <span class="c1">// result = 8</span></span></code></pre>\n<copy-code></copy-code>\n</div>\n<p data-sourcepos="15:1-15:95" dir="auto">This function takes two number parameters, a and b. It returns the sum of adding them together.</p>',
|
|
46
|
-
role: MESSAGE_MODEL_ROLES.assistant,
|
|
47
|
-
extras: {
|
|
48
|
-
sources: MOCK_SOURCES,
|
|
49
|
-
contextItems: getMockContextItems().slice(0, 2),
|
|
50
|
-
},
|
|
51
|
-
requestId: '987',
|
|
52
|
-
errors: [],
|
|
53
|
-
timestamp: '2021-04-21T12:00:00.000Z',
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const generateSeparateChunks = (n) => {
|
|
57
|
-
const res = [];
|
|
58
|
-
for (let i = 1; i <= n; i += 1) {
|
|
59
|
-
res.push({
|
|
60
|
-
chunkId: i,
|
|
61
|
-
content: `chunk #${i}`,
|
|
62
|
-
role: MESSAGE_MODEL_ROLES.assistant,
|
|
63
|
-
requestId: '987',
|
|
64
|
-
errors: [],
|
|
65
|
-
timestamp: '2021-04-21T12:00:00.000Z',
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
return res;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const MOCK_RESPONSE_MESSAGE_FOR_STREAMING = {
|
|
72
|
-
id: '123',
|
|
73
|
-
content: `To change your password in GitLab:
|
|
74
|
-
|
|
75
|
-
1. Log in to your GitLab account.
|
|
76
|
-
2. Select your avatar in the top right corner and choose Edit profile.
|
|
77
|
-
3. On the left sidebar, select Password.
|
|
78
|
-
4. Enter your current password in the Current password field.
|
|
79
|
-
5. Enter your new password in the New password and Password confirmation fields.
|
|
80
|
-
6. Select Save password.
|
|
81
|
-
7. If you don't know your current password, select the I forgot my password link to reset it.
|
|
82
|
-
|
|
83
|
-
GitLab enforces password requirements when you choose a new password.
|
|
84
|
-
|
|
85
|
-
~~~yaml
|
|
86
|
-
# And here is a
|
|
87
|
-
# code block
|
|
88
|
-
everyone:
|
|
89
|
-
likes:
|
|
90
|
-
yaml: true
|
|
91
|
-
~~~
|
|
92
|
-
which is rendered while streaming.
|
|
93
|
-
`,
|
|
94
|
-
role: 'assistant',
|
|
95
|
-
extras: {
|
|
96
|
-
contextItems: getMockContextItems().slice(0, 2),
|
|
97
|
-
},
|
|
98
|
-
requestId: '987',
|
|
99
|
-
errors: [],
|
|
100
|
-
timestamp: '2021-04-21T12:00:00.000Z',
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
// Utility function for delay
|
|
104
|
-
async function delayRandom(min = 16, max = 267) {
|
|
105
|
-
const delay = Math.floor(Math.random() * (max - min + 1)) + min;
|
|
106
|
-
// eslint-disable-next-line no-promise-executor-return
|
|
107
|
-
return new Promise((resolve) => setStoryTimeout(resolve, delay));
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export async function* generateMockResponseChunks(requestId = 1) {
|
|
111
|
-
const chunkSize = 5;
|
|
112
|
-
const contentLength = MOCK_RESPONSE_MESSAGE_FOR_STREAMING.content.length;
|
|
113
|
-
const chunkCount = Math.ceil(contentLength / chunkSize);
|
|
114
|
-
|
|
115
|
-
for (let chunkId = 0; chunkId < chunkCount; chunkId += 1) {
|
|
116
|
-
const start = chunkId * chunkSize;
|
|
117
|
-
const end = Math.min((chunkId + 1) * chunkSize, contentLength);
|
|
118
|
-
const chunk = {
|
|
119
|
-
...MOCK_RESPONSE_MESSAGE_FOR_STREAMING,
|
|
120
|
-
requestId,
|
|
121
|
-
content: MOCK_RESPONSE_MESSAGE_FOR_STREAMING.content.substring(start, end),
|
|
122
|
-
chunkId: chunkId + 1,
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
// eslint-disable-next-line no-await-in-loop
|
|
126
|
-
await delayRandom();
|
|
127
|
-
yield chunk;
|
|
128
|
-
}
|
|
129
|
-
yield {
|
|
130
|
-
...MOCK_RESPONSE_MESSAGE_FOR_STREAMING,
|
|
131
|
-
requestId,
|
|
132
|
-
content: MOCK_RESPONSE_MESSAGE_FOR_STREAMING.content,
|
|
133
|
-
chunkId: null,
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export const MOCK_USER_PROMPT_MESSAGE = {
|
|
138
|
-
id: '456',
|
|
139
|
-
chunkId: null,
|
|
140
|
-
content: 'How to create a new template?',
|
|
141
|
-
contentHtml: '<p>How to create a new template?</p>',
|
|
142
|
-
role: MESSAGE_MODEL_ROLES.user,
|
|
143
|
-
requestId: '987',
|
|
144
|
-
errors: [],
|
|
145
|
-
timestamp: '2021-04-21T12:00:00.000Z',
|
|
146
|
-
extras: {
|
|
147
|
-
contextItems: getMockContextItems().slice(0, 2),
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
export const renderMarkdown = (content) => content;
|
|
152
|
-
export const renderGFM = (el) => {
|
|
153
|
-
const codeBlock = el.querySelectorAll('.markdown-code-block');
|
|
154
|
-
codeBlock.forEach((block) => {
|
|
155
|
-
block?.classList.add('duo-chat-markdown', 'duo-chat-compact-markdown');
|
|
156
|
-
});
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export const SLASH_COMMANDS = [
|
|
160
|
-
{
|
|
161
|
-
name: CHAT_RESET_MESSAGE,
|
|
162
|
-
shouldSubmit: true,
|
|
163
|
-
description: 'Reset conversation, ignore the previous messages.',
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
name: CHAT_CLEAR_MESSAGE,
|
|
167
|
-
shouldSubmit: true,
|
|
168
|
-
description: 'Delete all messages in this conversation.',
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
name: '/tests',
|
|
172
|
-
description: 'Write tests for the selected snippet.',
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
name: '/refactor',
|
|
176
|
-
description: 'Refactor the selected snippet.',
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
name: '/explain',
|
|
180
|
-
description: 'Explain the selected snippet.',
|
|
181
|
-
},
|
|
182
|
-
];
|
|
183
|
-
|
|
184
|
-
export const INCLUDE_SLASH_COMMAND = {
|
|
185
|
-
name: CHAT_INCLUDE_MESSAGE,
|
|
186
|
-
description: 'Include additional context in the conversation.',
|
|
187
|
-
};
|
|
@@ -1,9 +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
|
-
$duo-chat-scrim-gradient: linear-gradient(to bottom, var(--gl-color-alpha-0), var(--gl-background-color-default));
|
|
@@ -1,90 +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
|
-
The main entry point component for gathering the user feedback for AI features.
|
|
11
|
-
|
|
12
|
-
The component consists of a textual button and a connected modal with the actual form, emitting
|
|
13
|
-
the form data on submission.
|
|
14
|
-
|
|
15
|
-
## Custom button text
|
|
16
|
-
|
|
17
|
-
The component allows to customize the button text presented to the user.
|
|
18
|
-
|
|
19
|
-
```html
|
|
20
|
-
<gl-duo-user-feedback feedback-link-text="Leave your custom feedback" />
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Linking to a separate feedback form
|
|
24
|
-
|
|
25
|
-
The main goal of this component is to provide an advanced feedback form. However, it might only
|
|
26
|
-
be necessary for some consumers. In such a case, the component bypasses the default
|
|
27
|
-
form and links to an external feedback page/form.
|
|
28
|
-
|
|
29
|
-
```html
|
|
30
|
-
<gl-duo-user-feedback feedback-link-url="https://gitlab.com" />
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Listening to the feedback form submission
|
|
34
|
-
|
|
35
|
-
This component emits the `feedback` event with all the options selected in the feedback form.
|
|
36
|
-
|
|
37
|
-
```html
|
|
38
|
-
<gl-duo-user-feedback @feedback="myEventTracker" />
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
The returned event contains two props (`feedbackChoices` and `extendedTextFeedback`) from
|
|
42
|
-
the underlying `FeedbackModal` component. Here's an example of a possible event:
|
|
43
|
-
|
|
44
|
-
```json
|
|
45
|
-
{
|
|
46
|
-
"feedbackChoices": ["unhelpful", "long"],
|
|
47
|
-
"extendedTextFeedback": "The answer was too long to understand"
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Using the `feedback-extra-fields` slot
|
|
52
|
-
|
|
53
|
-
By default, the component renders one extra textarea field to gather additional feedback
|
|
54
|
-
information from users. However, it may not be enough sometimes, and different use cases of
|
|
55
|
-
this component might need to fine-tune the form to gather information most suitable for that
|
|
56
|
-
or another use case. For this purpose, the component provides the `feedback-extra-fields`
|
|
57
|
-
slot, which can override the default textarea with different fields/information.
|
|
58
|
-
|
|
59
|
-
Note, however, that the content put into this slot will override the default textarea. So,
|
|
60
|
-
if you want to append additional fields, instead of completely overriding the default textarea,
|
|
61
|
-
you must copy the textarea field from the `DuoChatFeedbackModal` component into the slot.
|
|
62
|
-
|
|
63
|
-
```html
|
|
64
|
-
<gl-duo-user-feedback
|
|
65
|
-
:feedback-link-text="feedbackLinkText"
|
|
66
|
-
:feedback-link-url="feedbackLinkUrl"
|
|
67
|
-
@feedback="logEvent"
|
|
68
|
-
>
|
|
69
|
-
<template #feedback-extra-fields>
|
|
70
|
-
<gl-form-group label="What were you doing?" optional>
|
|
71
|
-
<gl-form-textarea
|
|
72
|
-
placeholder="The situation in which you interacted with GitLab Duo Chat."
|
|
73
|
-
v-model="didWhat"
|
|
74
|
-
/>
|
|
75
|
-
</gl-form-group>
|
|
76
|
-
<gl-form-group label="What were you expecting from the response?" optional>
|
|
77
|
-
<gl-form-textarea
|
|
78
|
-
placeholder="What kind of information or assistance were you hoping to receive?"
|
|
79
|
-
v-model="expectedWhat"
|
|
80
|
-
/>
|
|
81
|
-
</gl-form-group>
|
|
82
|
-
<gl-form-group label="How could the response be improved?" optional>
|
|
83
|
-
<gl-form-textarea
|
|
84
|
-
placeholder="How the response might better meet your needs."
|
|
85
|
-
v-model="improveWhat"
|
|
86
|
-
/>
|
|
87
|
-
</gl-form-group>
|
|
88
|
-
</template>
|
|
89
|
-
</gl-duo-user-feedback>
|
|
90
|
-
```
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
/**
|
|
3
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
4
|
-
*
|
|
5
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
6
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
7
|
-
*
|
|
8
|
-
* 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.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import GlAlert from '../../../base/alert/alert.vue';
|
|
12
|
-
import GlButton from '../../../base/button/button.vue';
|
|
13
|
-
import FeedbackModal from './user_feedback_modal.vue';
|
|
14
|
-
|
|
15
|
-
export const i18n = {
|
|
16
|
-
FEEDBACK_LINK_TEXT: 'Give feedback to improve this answer.',
|
|
17
|
-
FEEDBACK_THANKS: 'Thank you for your feedback.',
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default {
|
|
21
|
-
name: 'GlDuoUserFeedback',
|
|
22
|
-
components: {
|
|
23
|
-
GlAlert,
|
|
24
|
-
GlButton,
|
|
25
|
-
FeedbackModal,
|
|
26
|
-
},
|
|
27
|
-
props: {
|
|
28
|
-
/**
|
|
29
|
-
* Whether the message already has gotten feedback
|
|
30
|
-
*/
|
|
31
|
-
feedbackReceived: {
|
|
32
|
-
type: Boolean,
|
|
33
|
-
required: false,
|
|
34
|
-
default: false,
|
|
35
|
-
},
|
|
36
|
-
/**
|
|
37
|
-
* The text to be displayed as the feedback link/button.
|
|
38
|
-
*/
|
|
39
|
-
feedbackLinkText: {
|
|
40
|
-
type: String,
|
|
41
|
-
required: false,
|
|
42
|
-
default: i18n.FEEDBACK_LINK_TEXT,
|
|
43
|
-
},
|
|
44
|
-
/**
|
|
45
|
-
* The URL of a page to provide more explanations on the experiment. If provided, clicking
|
|
46
|
-
* the feedback link will open a new tab with the URL instead of showing the feedback modal.
|
|
47
|
-
*/
|
|
48
|
-
feedbackLinkUrl: {
|
|
49
|
-
type: String,
|
|
50
|
-
required: false,
|
|
51
|
-
default: '',
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
computed: {
|
|
55
|
-
shouldRenderModal() {
|
|
56
|
-
return !this.feedbackReceived && !this.feedbackLinkUrl;
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
methods: {
|
|
60
|
-
notify(event) {
|
|
61
|
-
/**
|
|
62
|
-
* Notify listeners about the feedback form submission.
|
|
63
|
-
* @param {*} event An event, containing the feedback choices and the extended feedback text.
|
|
64
|
-
*/
|
|
65
|
-
this.$emit('feedback', event);
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
i18n,
|
|
69
|
-
};
|
|
70
|
-
</script>
|
|
71
|
-
|
|
72
|
-
<template>
|
|
73
|
-
<div class="gl-w-full gl-pt-4">
|
|
74
|
-
<div>
|
|
75
|
-
<gl-button
|
|
76
|
-
v-if="!feedbackReceived"
|
|
77
|
-
variant="link"
|
|
78
|
-
target="_blank"
|
|
79
|
-
:href="feedbackLinkUrl"
|
|
80
|
-
button-text-classes="!gl-whitespace-normal gl-text-left"
|
|
81
|
-
@click="shouldRenderModal && $refs.feedbackModal.show()"
|
|
82
|
-
>{{ feedbackLinkText }}</gl-button
|
|
83
|
-
>
|
|
84
|
-
<gl-alert v-else variant="success" :dismissible="false">
|
|
85
|
-
{{ $options.i18n.FEEDBACK_THANKS }}
|
|
86
|
-
</gl-alert>
|
|
87
|
-
</div>
|
|
88
|
-
<feedback-modal v-if="shouldRenderModal" ref="feedbackModal" @feedback-submitted="notify">
|
|
89
|
-
<template #feedback-extra-fields>
|
|
90
|
-
<!-- @slot The addition Feedback form fields. -->
|
|
91
|
-
<slot name="feedback-extra-fields"></slot>
|
|
92
|
-
</template>
|
|
93
|
-
</feedback-modal>
|
|
94
|
-
</div>
|
|
95
|
-
</template>
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
/** * This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
2
|
-
* * Please use the corresponding component in Duo-UI going forward. * All future development and
|
|
3
|
-
maintenance for Duo components should take place in Duo-UI. * * For more details, see the migration
|
|
4
|
-
epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in
|
|
5
|
-
#g_duo_chat. */
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
import GlModal from '../../../base/modal/modal.vue';
|
|
9
|
-
import GlAlert from '../../../base/alert/alert.vue';
|
|
10
|
-
import GlFormGroup from '../../../base/form/form_group/form_group.vue';
|
|
11
|
-
import GlFormTextarea from '../../../base/form/form_textarea/form_textarea.vue';
|
|
12
|
-
import GlFormCheckboxGroup from '../../../base/form/form_checkbox/form_checkbox_group.vue';
|
|
13
|
-
|
|
14
|
-
export const i18n = {
|
|
15
|
-
MODAL: {
|
|
16
|
-
TITLE: 'Give feedback on GitLab Duo',
|
|
17
|
-
DESCRIPTION: 'To help improve GitLab Duo, send your feeback to GitLab team members.',
|
|
18
|
-
ALERT: 'GitLab team members cannot see the AI content. Please be as descriptive as possible.',
|
|
19
|
-
OPTIONS_LABEL: 'How could the AI content be improved?',
|
|
20
|
-
SITUATION_DESCRIPTION_LABEL: 'What were you doing?',
|
|
21
|
-
SITUATION_DESCRIPTION_PLACEHOLDER:
|
|
22
|
-
'The situation in which you interacted with GitLab Duo Chat.',
|
|
23
|
-
IMPROVEMENT_SUGGESTION_LABEL: 'How could the response be improved?',
|
|
24
|
-
IMPROVEMENT_SUGGESTION_PLACEHOLDER: 'How the response might better meet your needs.',
|
|
25
|
-
MORE_LABEL: 'More information',
|
|
26
|
-
MORE_PLACEHOLDER: 'How could the content be improved?',
|
|
27
|
-
REQUIRED_VALIDATION_ERROR: 'Select at least one option.',
|
|
28
|
-
FEEDBACK_OPTIONS: {
|
|
29
|
-
helpful: 'Helpful',
|
|
30
|
-
unhelpful: 'Unhelpful or irrelevant',
|
|
31
|
-
incorrect: 'Factually incorrect',
|
|
32
|
-
long: 'Too long',
|
|
33
|
-
abuse: 'Abusive or offensive',
|
|
34
|
-
other: 'Something else',
|
|
35
|
-
},
|
|
36
|
-
ACTIONS: {
|
|
37
|
-
submit: 'Submit',
|
|
38
|
-
cancel: 'Cancel',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const feedbackOptions = [
|
|
44
|
-
{
|
|
45
|
-
text: i18n.MODAL.FEEDBACK_OPTIONS.helpful,
|
|
46
|
-
value: 'helpful',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
text: i18n.MODAL.FEEDBACK_OPTIONS.unhelpful,
|
|
50
|
-
value: 'unhelpful',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
text: i18n.MODAL.FEEDBACK_OPTIONS.incorrect,
|
|
54
|
-
value: 'incorrect',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
text: i18n.MODAL.FEEDBACK_OPTIONS.long,
|
|
58
|
-
value: 'long',
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
text: i18n.MODAL.FEEDBACK_OPTIONS.abuse,
|
|
62
|
-
value: 'abuse',
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
text: i18n.MODAL.FEEDBACK_OPTIONS.other,
|
|
66
|
-
value: 'other',
|
|
67
|
-
},
|
|
68
|
-
];
|
|
69
|
-
|
|
70
|
-
export default {
|
|
71
|
-
name: 'DuoChatFeedbackModal',
|
|
72
|
-
components: {
|
|
73
|
-
GlModal,
|
|
74
|
-
GlAlert,
|
|
75
|
-
GlFormCheckboxGroup,
|
|
76
|
-
GlFormGroup,
|
|
77
|
-
GlFormTextarea,
|
|
78
|
-
},
|
|
79
|
-
inject: {
|
|
80
|
-
modalTitle: {
|
|
81
|
-
default: i18n.MODAL.TITLE,
|
|
82
|
-
},
|
|
83
|
-
modalAlert: {
|
|
84
|
-
default: i18n.MODAL.ALERT,
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
data() {
|
|
88
|
-
return {
|
|
89
|
-
selectedFeedbackOptions: [],
|
|
90
|
-
extendedFeedback: '',
|
|
91
|
-
isValid: null,
|
|
92
|
-
};
|
|
93
|
-
},
|
|
94
|
-
watch: {
|
|
95
|
-
selectedFeedbackOptions(options) {
|
|
96
|
-
this.isValid = options.length > 0;
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
methods: {
|
|
100
|
-
close() {
|
|
101
|
-
this.$refs.feedbackModal.hide();
|
|
102
|
-
},
|
|
103
|
-
show() {
|
|
104
|
-
this.$refs.feedbackModal.show();
|
|
105
|
-
},
|
|
106
|
-
onFeedbackSubmit(e) {
|
|
107
|
-
if (this.selectedFeedbackOptions.length) {
|
|
108
|
-
this.$emit('feedback-submitted', {
|
|
109
|
-
feedbackChoices: this.selectedFeedbackOptions,
|
|
110
|
-
extendedTextFeedback: this.extendedFeedback,
|
|
111
|
-
});
|
|
112
|
-
this.close();
|
|
113
|
-
this.isValid = null;
|
|
114
|
-
} else {
|
|
115
|
-
e?.preventDefault();
|
|
116
|
-
this.isValid = false;
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
actions: {
|
|
121
|
-
primary: {
|
|
122
|
-
text: i18n.MODAL.ACTIONS.submit,
|
|
123
|
-
},
|
|
124
|
-
cancel: {
|
|
125
|
-
text: i18n.MODAL.ACTIONS.cancel,
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
feedbackOptions,
|
|
129
|
-
i18n,
|
|
130
|
-
};
|
|
131
|
-
</script>
|
|
132
|
-
<template>
|
|
133
|
-
<gl-modal
|
|
134
|
-
ref="feedbackModal"
|
|
135
|
-
modal-id="feedbackModal"
|
|
136
|
-
:title="modalTitle"
|
|
137
|
-
:action-primary="$options.actions.primary"
|
|
138
|
-
:action-cancel="$options.actions.cancel"
|
|
139
|
-
:visible="false"
|
|
140
|
-
size="sm"
|
|
141
|
-
@primary="onFeedbackSubmit"
|
|
142
|
-
@canceled="close"
|
|
143
|
-
>
|
|
144
|
-
<p>{{ $options.i18n.MODAL.DESCRIPTION }}</p>
|
|
145
|
-
<gl-form-group
|
|
146
|
-
:invalid-feedback="$options.i18n.MODAL.REQUIRED_VALIDATION_ERROR"
|
|
147
|
-
:state="isValid"
|
|
148
|
-
:label="$options.i18n.MODAL.OPTIONS_LABEL"
|
|
149
|
-
data-testid="feedback-options"
|
|
150
|
-
>
|
|
151
|
-
<gl-form-checkbox-group
|
|
152
|
-
v-model="selectedFeedbackOptions"
|
|
153
|
-
:options="$options.feedbackOptions"
|
|
154
|
-
/>
|
|
155
|
-
</gl-form-group>
|
|
156
|
-
<gl-alert class="gl-mb-5" :dismissible="false">{{ modalAlert }}</gl-alert>
|
|
157
|
-
<!-- @slot The addition Feedback form fields. -->
|
|
158
|
-
<slot name="feedback-extra-fields">
|
|
159
|
-
<gl-form-group :label="$options.i18n.MODAL.MORE_LABEL" optional>
|
|
160
|
-
<gl-form-textarea
|
|
161
|
-
v-model="extendedFeedback"
|
|
162
|
-
:placeholder="$options.i18n.MODAL.MORE_PLACEHOLDER"
|
|
163
|
-
/>
|
|
164
|
-
</gl-form-group>
|
|
165
|
-
</slot>
|
|
166
|
-
</gl-modal>
|
|
167
|
-
</template>
|
package/src/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.md
DELETED
|
@@ -1,42 +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
|
-
This is the main UI panel used in the larger Duo Workflow Plan UI for the IDE
|
|
11
|
-
and WebUI.
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
To use this component, import it and fill out the available slots:
|
|
16
|
-
|
|
17
|
-
- `title`: the main title for the panel
|
|
18
|
-
- `subtitle`: the small text adjacent to the title
|
|
19
|
-
- `content`: the content of the panel, hidden away when the collapse is toggled
|
|
20
|
-
|
|
21
|
-
Also provide an icon via the `headerIcon` prop. This icon is displayed adjacent
|
|
22
|
-
to the title.
|
|
23
|
-
|
|
24
|
-
You can pass `expanded` prop set to `false` if you need a section to be
|
|
25
|
-
collapsed by default. You can also listen to `toggle-panel` event to know
|
|
26
|
-
when the expanded state changed.
|
|
27
|
-
|
|
28
|
-
Translations for the title of the single button can be provided either via the
|
|
29
|
-
props `expandButtonTitle` and `collapseTitleButton` or via the translation
|
|
30
|
-
configuration:
|
|
31
|
-
|
|
32
|
-
```js
|
|
33
|
-
setConfigs({
|
|
34
|
-
translations: {
|
|
35
|
-
'GlDuoWorkflowPanel.expandButtonTitle': __('Expand Panel'),
|
|
36
|
-
'GlDuoWorkflowPanel.collapseButtonTitle': __('Collapse Panel'),
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
These translations are tied to the action of the button, not its state, so
|
|
42
|
-
ensure they are set properly!
|