@gitlab/duo-ui 15.10.0 → 15.11.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 (36) hide show
  1. package/dist/components/agentic_chat/agentic_duo_chat.js +1 -1
  2. package/dist/components/agentic_chat/components/agentic_binary_feedback/agentic_binary_feedback.js +24 -147
  3. package/dist/components/agentic_chat/components/agentic_feedback_panel/agentic_feedback_panel.js +185 -0
  4. package/dist/components/agentic_chat/web_agentic_duo_chat.js +1 -1
  5. package/dist/components/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.js +1 -1
  6. package/dist/components/chat/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.js +1 -1
  7. package/dist/components/chat/components/duo_chat_message/duo_chat_message.js +22 -3
  8. package/dist/components/chat/components/duo_chat_message/message_types/message_tool_kv_section.js +1 -1
  9. package/dist/components/chat/components/duo_chat_message_tool_approval/message_tool_approval.js +1 -2
  10. package/dist/components/chat/components/duo_chat_threads/duo_chat_threads.js +1 -1
  11. package/dist/components/chat/components/message_action_bar/message_action_bar.js +43 -0
  12. package/dist/components/chat/duo_chat.js +1 -1
  13. package/dist/components/chat/web_duo_chat.js +1 -1
  14. package/dist/components.css +1 -1
  15. package/dist/components.css.map +1 -1
  16. package/dist/tailwind.css +1 -1
  17. package/dist/tailwind.css.map +1 -1
  18. package/dist/utils/i18n.js +1 -1
  19. package/dist/utils/object.js +1 -2
  20. package/package.json +5 -5
  21. package/src/components/agentic_chat/agentic_duo_chat.vue +1 -1
  22. package/src/components/agentic_chat/components/agentic_binary_feedback/agentic_binary_feedback.scss +2 -2
  23. package/src/components/agentic_chat/components/agentic_binary_feedback/agentic_binary_feedback.vue +35 -233
  24. package/src/components/agentic_chat/components/agentic_feedback_panel/agentic_feedback_panel.vue +228 -0
  25. package/src/components/agentic_chat/web_agentic_duo_chat.vue +1 -1
  26. package/src/components/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.vue +1 -1
  27. package/src/components/chat/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.vue +1 -1
  28. package/src/components/chat/components/duo_chat_message/duo_chat_message.vue +65 -34
  29. package/src/components/chat/components/duo_chat_message/message_types/message_tool_kv_section.vue +1 -1
  30. package/src/components/chat/components/duo_chat_message_tool_approval/message_tool_approval.vue +1 -2
  31. package/src/components/chat/components/duo_chat_threads/duo_chat_threads.vue +1 -1
  32. package/src/components/chat/components/message_action_bar/message_action_bar.vue +11 -0
  33. package/src/components/chat/duo_chat.vue +1 -1
  34. package/src/components/chat/web_duo_chat.vue +1 -1
  35. package/src/utils/i18n.js +1 -1
  36. package/src/utils/object.js +1 -2
@@ -8,7 +8,7 @@ import {
8
8
  } from '@gitlab/ui';
9
9
 
10
10
  import { sprintf, translate, translatePlural } from '@gitlab/ui/dist/utils/i18n';
11
- import throttle from 'lodash/throttle';
11
+ import { throttle } from 'lodash-es';
12
12
  import DuoChatContextItemSelections from '../duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.vue';
13
13
  import { MESSAGE_MODEL_ROLES, SELECTED_CONTEXT_ITEMS_DEFAULT_COLLAPSED } from '../../constants';
14
14
 
@@ -16,6 +16,8 @@ import DocumentationSources from '../duo_chat_message_sources/duo_chat_message_s
16
16
  // eslint-disable-next-line no-restricted-imports
17
17
  import { copyToClipboard, concatUntilEmpty } from '../utils';
18
18
  import AgenticBinaryFeedback from '../../../agentic_chat/components/agentic_binary_feedback/agentic_binary_feedback.vue';
19
+ import AgenticFeedbackPanel from '../../../agentic_chat/components/agentic_feedback_panel/agentic_feedback_panel.vue';
20
+ import MessageActionBar from '../message_action_bar/message_action_bar.vue';
19
21
  import MessageFeedback from './message_feedback.vue';
20
22
  import MarkdownRenderer from './markdown_renderer.vue';
21
23
  import { CopyCodeElement } from './copy_code_element';
@@ -43,8 +45,10 @@ export default {
43
45
  },
44
46
  components: {
45
47
  AgenticBinaryFeedback,
48
+ AgenticFeedbackPanel,
46
49
  DocumentationSources,
47
50
  DuoChatContextItemSelections,
51
+ MessageActionBar,
48
52
  MessageFeedback,
49
53
  MessageMap,
50
54
  GlIcon,
@@ -130,6 +134,8 @@ export default {
130
134
  messageChunks: [],
131
135
  selectedContextItemsDefaultCollapsed: SELECTED_CONTEXT_ITEMS_DEFAULT_COLLAPSED,
132
136
  copied: false,
137
+ feedbackChoice: null,
138
+ feedbackSubmitted: false,
133
139
  };
134
140
  },
135
141
  computed: {
@@ -322,6 +328,16 @@ export default {
322
328
  e.classList.remove(DUO_CODE_SCRIM_TOP_CLASS);
323
329
  }
324
330
  },
331
+ onFeedbackTypeSelected(type) {
332
+ this.feedbackChoice = type;
333
+ },
334
+ onFeedbackPanelSubmit(payload) {
335
+ this.feedbackSubmitted = true;
336
+ this.logEvent(payload);
337
+ },
338
+ onFeedbackPanelClose() {
339
+ this.feedbackChoice = null;
340
+ },
325
341
  async copyMessage() {
326
342
  try {
327
343
  await copyToClipboard(this.message.content, this.$el);
@@ -403,42 +419,57 @@ export default {
403
419
 
404
420
  <documentation-sources v-if="sources" :sources="sources" />
405
421
 
406
- <div
407
- v-if="isAssistantMessage"
408
- class="duo-chat-message-actions -gl-ml-2 gl-flex gl-items-start gl-gap-3"
409
- >
410
- <gl-animated-loader-icon v-if="isChunkAndNotCancelled" :is-on="true" />
411
- <template v-if="shouldShowFeedbackLink && isBinaryFeedbackEnabled">
412
- <agentic-binary-feedback
413
- v-if="showBinaryFeedback"
414
- data-testid="agentic-feedback-latest"
422
+ <template v-if="isAssistantMessage">
423
+ <message-action-bar>
424
+ <gl-animated-loader-icon v-if="isChunkAndNotCancelled" :is-on="true" />
425
+ <template v-if="shouldShowFeedbackLink && isBinaryFeedbackEnabled">
426
+ <agentic-binary-feedback
427
+ v-if="showBinaryFeedback"
428
+ :feedback-choice="feedbackChoice"
429
+ :submitted="feedbackSubmitted"
430
+ data-testid="agentic-feedback-latest"
431
+ @select-type="onFeedbackTypeSelected"
432
+ />
433
+ <div
434
+ v-else
435
+ class="agentic-feedback-hover-wrapper"
436
+ :class="{
437
+ '-gl-mr-3 gl-w-0 gl-overflow-hidden gl-opacity-0':
438
+ !feedbackChoice && !feedbackSubmitted,
439
+ }"
440
+ data-testid="agentic-feedback-hover-container"
441
+ >
442
+ <agentic-binary-feedback
443
+ :feedback-choice="feedbackChoice"
444
+ :submitted="feedbackSubmitted"
445
+ @select-type="onFeedbackTypeSelected"
446
+ />
447
+ </div>
448
+ </template>
449
+ <message-feedback
450
+ v-else-if="shouldShowFeedbackLink"
451
+ :has-feedback="hasFeedback"
415
452
  @feedback="logEvent"
416
453
  />
417
- <div
418
- v-else
419
- class="agentic-feedback-hover-wrapper -gl-mr-3 gl-w-0 gl-overflow-hidden gl-opacity-0"
420
- data-testid="agentic-feedback-hover-container"
421
- >
422
- <agentic-binary-feedback @feedback="logEvent" />
423
- </div>
424
- </template>
425
- <message-feedback
426
- v-else-if="shouldShowFeedbackLink"
427
- :has-feedback="hasFeedback"
428
- @feedback="logEvent"
429
- />
430
- <gl-button
431
- v-if="shouldShowCopyAction"
432
- v-gl-tooltip
433
- :title="copied ? $options.i18n.CHAT_MESSAGE_COPIED : $options.i18n.CHAT_MESSAGE_COPY"
434
- :icon="copied ? 'check-circle-filled' : 'copy-to-clipboard'"
435
- :class="{ '!gl-text-success': copied, '!gl-text-subtle': !copied }"
436
- category="tertiary"
437
- size="small"
438
- @click="copyMessage"
439
- @focusout="copied = false"
454
+ <gl-button
455
+ v-if="shouldShowCopyAction"
456
+ v-gl-tooltip
457
+ :title="copied ? $options.i18n.CHAT_MESSAGE_COPIED : $options.i18n.CHAT_MESSAGE_COPY"
458
+ :icon="copied ? 'check-circle-filled' : 'copy-to-clipboard'"
459
+ :class="{ '!gl-text-success': copied, '!gl-text-subtle': !copied }"
460
+ category="tertiary"
461
+ size="small"
462
+ @click="copyMessage"
463
+ @focusout="copied = false"
464
+ />
465
+ </message-action-bar>
466
+ <agentic-feedback-panel
467
+ v-if="feedbackChoice && !feedbackSubmitted"
468
+ :feedback-type="feedbackChoice"
469
+ @submit="onFeedbackPanelSubmit"
470
+ @close="onFeedbackPanelClose"
440
471
  />
441
- </div>
472
+ </template>
442
473
 
443
474
  <duo-chat-context-item-selections
444
475
  v-if="displaySelectedContextItems && isUserMessage"
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import isEmpty from 'lodash/isEmpty';
2
+ import { isEmpty } from 'lodash-es';
3
3
  import PreBlock from '../../duo_chat_message_tool_approval/components/pre_block.vue';
4
4
 
5
5
  function makePretty(value, visited = new WeakSet()) {
@@ -8,8 +8,7 @@ import {
8
8
  GlDropdown,
9
9
  GlDropdownItem,
10
10
  } from '@gitlab/ui';
11
- import startCase from 'lodash/startCase';
12
- import capitalize from 'lodash/capitalize';
11
+ import { startCase, capitalize } from 'lodash-es';
13
12
  import { translate } from '../../../../utils/i18n';
14
13
  import { convertKeysToCamelCase } from '../../../../utils/object';
15
14
  import { acceptedApproveToolPayloads, APPROVAL_TOOL_NAMES } from '../../constants';
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import { GlButton, GlAvatar, GlSearchBoxByType } from '@gitlab/ui';
3
- import debounce from 'lodash/debounce';
3
+ import { debounce } from 'lodash-es';
4
4
  import { sprintf, translate } from '../../../../utils/i18n';
5
5
  import { formatLocalizedDate } from '../../../../utils/date';
6
6
  import { DEFAULT_DEBOUNCE_AND_THROTTLE_MS } from '../../constants';
@@ -0,0 +1,11 @@
1
+ <script>
2
+ export default {
3
+ name: 'MessageActionBar',
4
+ };
5
+ </script>
6
+
7
+ <template>
8
+ <div class="message-action-bar -gl-ml-2 gl-flex gl-items-start gl-gap-3">
9
+ <slot></slot>
10
+ </div>
11
+ </template>
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import throttle from 'lodash/throttle';
2
+ import { throttle } from 'lodash-es';
3
3
  import VueResizable from 'vue-resizable';
4
4
 
5
5
  import {
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import throttle from 'lodash/throttle';
2
+ import { throttle } from 'lodash-es';
3
3
 
4
4
  import {
5
5
  GlButton,
package/src/utils/i18n.js CHANGED
@@ -1,4 +1,4 @@
1
- import escape from 'lodash/escape';
1
+ import { escape } from 'lodash-es';
2
2
  import { i18n } from '../config';
3
3
 
4
4
  const defaultPluralHandler = (n, singleValue, pluralValue) => {
@@ -1,4 +1,3 @@
1
- import mapKeys from 'lodash/mapKeys';
2
- import camelCase from 'lodash/camelCase';
1
+ import { mapKeys, camelCase } from 'lodash-es';
3
2
 
4
3
  export const convertKeysToCamelCase = (obj = {}) => mapKeys(obj, (value, key) => camelCase(key));