@gitlab/duo-ui 8.13.2 → 8.14.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 (26) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/chat/components/duo_chat_conversation/duo_chat_conversation.js +4 -1
  3. package/dist/components/chat/components/duo_chat_message/duo_chat_message.js +30 -10
  4. package/dist/components/chat/components/duo_chat_message/message_types/index.js +13 -0
  5. package/dist/components/chat/components/duo_chat_message/message_types/message_agent.js +61 -0
  6. package/dist/components/chat/components/duo_chat_message/message_types/message_base.js +103 -0
  7. package/dist/components/chat/components/duo_chat_message/message_types/message_input_requested.js +53 -0
  8. package/dist/components/chat/components/duo_chat_message/message_types/message_tool.js +77 -0
  9. package/dist/components/chat/components/duo_chat_message/message_types/message_workflow_end.js +59 -0
  10. package/dist/components/chat/constants.js +4 -1
  11. package/dist/components/chat/duo_chat.js +8 -1
  12. package/dist/components/chat/mock_data.js +26 -1
  13. package/dist/tailwind.css +1 -1
  14. package/dist/tailwind.css.map +1 -1
  15. package/package.json +1 -1
  16. package/src/components/chat/components/duo_chat_conversation/duo_chat_conversation.vue +4 -0
  17. package/src/components/chat/components/duo_chat_message/duo_chat_message.vue +129 -93
  18. package/src/components/chat/components/duo_chat_message/message_types/index.js +11 -0
  19. package/src/components/chat/components/duo_chat_message/message_types/message_agent.vue +34 -0
  20. package/src/components/chat/components/duo_chat_message/message_types/message_base.vue +84 -0
  21. package/src/components/chat/components/duo_chat_message/message_types/message_input_requested.vue +19 -0
  22. package/src/components/chat/components/duo_chat_message/message_types/message_tool.vue +52 -0
  23. package/src/components/chat/components/duo_chat_message/message_types/message_workflow_end.vue +32 -0
  24. package/src/components/chat/constants.js +3 -0
  25. package/src/components/chat/duo_chat.vue +8 -0
  26. package/src/components/chat/mock_data.js +30 -0
@@ -0,0 +1,32 @@
1
+ <script>
2
+ import { GlButton } from '@gitlab/ui';
3
+ import AgentMessage from './message_agent.vue';
4
+
5
+ export const WORKFLOW_NEW_APP = 'workflow-new';
6
+
7
+ export default {
8
+ name: 'DuoChatWorkflowEndMessage',
9
+ components: {
10
+ AgentMessage,
11
+ GlButton,
12
+ },
13
+ workflowEndMessage: {
14
+ content:
15
+ "Review the changes. To improve the implementation, create another workflow and describe the specific changes you'd like to see.",
16
+ },
17
+ newRoute: {
18
+ name: WORKFLOW_NEW_APP,
19
+ },
20
+ };
21
+ </script>
22
+ <template>
23
+ <agent-message :message="$options.workflowEndMessage">
24
+ <template #message="{ content }">
25
+ <p>
26
+ {{ content }}
27
+ </p>
28
+
29
+ <gl-button :to="$options.newRoute" class="gl-mt-4">New workflow</gl-button>
30
+ </template>
31
+ </agent-message>
32
+ </template>
@@ -24,6 +24,9 @@ export const MESSAGE_MODEL_ROLES = {
24
24
  user: 'user',
25
25
  system: 'system',
26
26
  assistant: 'assistant',
27
+ tool: 'tool',
28
+ request: 'request',
29
+ workflow_end: 'workflow_end',
27
30
  };
28
31
 
29
32
  export const SELECTED_CONTEXT_ITEMS_DEFAULT_COLLAPSED = true;
@@ -678,6 +678,13 @@ export default {
678
678
  */
679
679
  this.$emit('delete-thread', threadId);
680
680
  },
681
+ onOpenFilePath(filePath) {
682
+ /**
683
+ * Emitted when a file path link is clicked in a chat message.
684
+ * @param {String} filePath The file path to open
685
+ */
686
+ this.$emit('open-file-path', filePath);
687
+ },
681
688
  },
682
689
  i18n,
683
690
  };
@@ -767,6 +774,7 @@ export default {
767
774
  @copy-code-snippet="onCopyCodeSnippet"
768
775
  @copy-message="onCopyMessage"
769
776
  @get-context-item-content="onGetContextItemContent"
777
+ @open-file-path="onOpenFilePath"
770
778
  />
771
779
  <template v-if="!hasMessages && !isLoading">
772
780
  <div
@@ -44,6 +44,36 @@ export const MOCK_RESPONSE_MESSAGE = {
44
44
  timestamp: '2021-04-21T12:00:00.000Z',
45
45
  };
46
46
 
47
+ export const MOCK_TOOL_MESSAGE = {
48
+ id: '123',
49
+ content: "Search for 'duo.*chat.*message' in directory",
50
+ message_type: MESSAGE_MODEL_ROLES.tool,
51
+ };
52
+
53
+ export const MOCK_TOOL_MESSAGE_WITH_LINK = {
54
+ id: '123',
55
+ content: "Search for 'duo.*chat.*message' in directory",
56
+ message_type: MESSAGE_MODEL_ROLES.tool,
57
+ tool_info: {
58
+ args: {
59
+ file_path: '/path/to/file.js',
60
+ },
61
+ },
62
+ };
63
+
64
+ export const MOCK_REQUEST_MESSAGE = {
65
+ id: '123',
66
+ content:
67
+ 'On the left, review the proposed plan. Then ask questions or request changes. To execute the plan, select Approve plan.',
68
+ message_type: MESSAGE_MODEL_ROLES.request,
69
+ };
70
+
71
+ export const MOCK_WORKFLOW_END_MESSAGE = {
72
+ id: '123',
73
+ content: "Search for 'duo.*chat.*message' in directory",
74
+ message_type: MESSAGE_MODEL_ROLES.workflow_end,
75
+ };
76
+
47
77
  export const generateSeparateChunks = (n) => {
48
78
  const res = [];
49
79
  for (let i = 1; i <= n; i += 1) {