@gitlab/duo-ui 8.13.2 → 8.14.1

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 (30) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/agentic_chat/agentic_duo_chat.js +11 -12
  3. package/dist/components/chat/components/duo_chat_conversation/duo_chat_conversation.js +4 -1
  4. package/dist/components/chat/components/duo_chat_loader/duo_chat_loader.js +8 -6
  5. package/dist/components/chat/components/duo_chat_message/duo_chat_message.js +30 -10
  6. package/dist/components/chat/components/duo_chat_message/message_types/index.js +13 -0
  7. package/dist/components/chat/components/duo_chat_message/message_types/message_agent.js +61 -0
  8. package/dist/components/chat/components/duo_chat_message/message_types/message_base.js +103 -0
  9. package/dist/components/chat/components/duo_chat_message/message_types/message_input_requested.js +53 -0
  10. package/dist/components/chat/components/duo_chat_message/message_types/message_tool.js +77 -0
  11. package/dist/components/chat/components/duo_chat_message/message_types/message_workflow_end.js +59 -0
  12. package/dist/components/chat/constants.js +4 -1
  13. package/dist/components/chat/duo_chat.js +8 -1
  14. package/dist/components/chat/mock_data.js +26 -1
  15. package/dist/tailwind.css +1 -1
  16. package/dist/tailwind.css.map +1 -1
  17. package/package.json +2 -2
  18. package/src/components/agentic_chat/agentic_duo_chat.vue +12 -12
  19. package/src/components/chat/components/duo_chat_conversation/duo_chat_conversation.vue +4 -0
  20. package/src/components/chat/components/duo_chat_loader/duo_chat_loader.vue +5 -3
  21. package/src/components/chat/components/duo_chat_message/duo_chat_message.vue +129 -93
  22. package/src/components/chat/components/duo_chat_message/message_types/index.js +11 -0
  23. package/src/components/chat/components/duo_chat_message/message_types/message_agent.vue +34 -0
  24. package/src/components/chat/components/duo_chat_message/message_types/message_base.vue +84 -0
  25. package/src/components/chat/components/duo_chat_message/message_types/message_input_requested.vue +19 -0
  26. package/src/components/chat/components/duo_chat_message/message_types/message_tool.vue +52 -0
  27. package/src/components/chat/components/duo_chat_message/message_types/message_workflow_end.vue +32 -0
  28. package/src/components/chat/constants.js +3 -0
  29. package/src/components/chat/duo_chat.vue +8 -0
  30. package/src/components/chat/mock_data.js +30 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [8.14.1](https://gitlab.com/gitlab-org/duo-ui/compare/v8.14.0...v8.14.1) (2025-05-01)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **chat:** Fix runtime error related to undefined element ([775fef2](https://gitlab.com/gitlab-org/duo-ui/commit/775fef27a59cd1d5891bb5c99d8aca430dbe0d51))
7
+
8
+ # [8.14.0](https://gitlab.com/gitlab-org/duo-ui/compare/v8.13.2...v8.14.0) (2025-04-25)
9
+
10
+
11
+ ### Features
12
+
13
+ * **chat:** introduce new message types ([eb2908a](https://gitlab.com/gitlab-org/duo-ui/commit/eb2908ae1bfa6ac4f495692a852a684173c131f1))
14
+
1
15
  ## [8.13.2](https://gitlab.com/gitlab-org/duo-ui/compare/v8.13.1...v8.13.2) (2025-04-24)
2
16
 
3
17
 
@@ -266,7 +266,7 @@ var script = {
266
266
  prompt: '',
267
267
  scrolledToBottom: true,
268
268
  activeCommandIndex: 0,
269
- displaySubmitButton: true,
269
+ canSubmit: true,
270
270
  compositionJustEnded: false,
271
271
  contextItemsMenuIsOpen: false,
272
272
  contextItemMenuRef: null,
@@ -358,15 +358,15 @@ var script = {
358
358
  multiThreadedView(newView) {
359
359
  this.currentView = newView;
360
360
  },
361
- isLoading(newVal) {
362
- if (!newVal && !this.isStreaming) {
363
- this.displaySubmitButton = true; // Re-enable submit button when loading stops
361
+ isLoading(loading) {
362
+ if (!loading && !this.isStreaming) {
363
+ this.canSubmit = true; // Re-enable submit button when loading stops
364
364
  }
365
365
  this.isHidden = false;
366
366
  },
367
- isStreaming(newVal) {
368
- if (!newVal && !this.isLoading) {
369
- this.displaySubmitButton = true; // Re-enable submit button when streaming stops
367
+ isStreaming(streaming) {
368
+ if (!streaming && !this.isLoading) {
369
+ this.canSubmit = true; // Re-enable submit button when streaming stops
370
370
  }
371
371
  },
372
372
  lastMessage(newMessage) {
@@ -415,13 +415,12 @@ var script = {
415
415
  /**
416
416
  * Emitted when user clicks the stop button in the textarea
417
417
  */
418
-
419
- this.displaySubmitButton = true;
418
+ this.canSubmit = true;
420
419
  this.$emit('chat-cancel');
421
420
  this.setPromptAndFocus();
422
421
  },
423
422
  sendChatPrompt() {
424
- if (!this.displaySubmitButton || this.contextItemsMenuIsOpen) {
423
+ if (!this.canSubmit || this.contextItemsMenuIsOpen) {
425
424
  return;
426
425
  }
427
426
  if (this.prompt) {
@@ -430,7 +429,7 @@ var script = {
430
429
  return;
431
430
  }
432
431
  if (![CHAT_RESET_MESSAGE, CHAT_CLEAR_MESSAGE, CHAT_NEW_MESSAGE].includes(this.caseInsensitivePrompt)) {
433
- this.displaySubmitButton = false;
432
+ this.canSubmit = false;
434
433
  }
435
434
 
436
435
  /**
@@ -620,7 +619,7 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
620
619
  },attrs:{"width":_vm.shouldRenderResizable ? _vm.dimensions.width : null,"height":_vm.shouldRenderResizable ? _vm.dimensions.height : null,"max-width":_vm.shouldRenderResizable ? _vm.dimensions.maxWidth : null,"max-height":_vm.shouldRenderResizable ? _vm.dimensions.maxHeight : null,"min-width":_vm.shouldRenderResizable ? _vm.dimensions.minWidth : null,"left":_vm.shouldRenderResizable ? _vm.dimensions.left : null,"top":_vm.shouldRenderResizable ? _vm.dimensions.top : null,"fit-parent":true,"min-height":_vm.shouldRenderResizable ? _vm.dimensions.minHeight : null,"active":_vm.shouldRenderResizable ? ['l', 't', 'lt'] : null},on:{"resize:end":_vm.updateSize}},[(!_vm.isHidden)?_c('aside',{staticClass:"markdown-code-block duo-chat gl-bottom-0 gl-max-h-full gl-flex gl-flex-col",class:{
621
620
  'resizable-content': _vm.shouldRenderResizable,
622
621
  'duo-chat-drawer': !_vm.shouldRenderResizable,
623
- },attrs:{"id":"chat-component","role":"complementary","data-testid":"chat-component"}},[(_vm.showHeader)?_c('duo-chat-header',{ref:"header",attrs:{"active-thread-id":_vm.activeThreadId,"title":_vm.isMultithreaded && _vm.currentView === 'list' ? _vm.$options.i18n.CHAT_HISTORY_TITLE : _vm.title,"subtitle":_vm.activeThreadTitleForView,"error":_vm.error,"is-multithreaded":_vm.isMultithreaded,"current-view":_vm.currentView,"should-render-resizable":_vm.shouldRenderResizable,"badge-type":_vm.isMultithreaded ? null : _vm.badgeType},on:{"go-back":_vm.onGoBack,"new-chat":_vm.onNewChat,"close":_vm.hideChat},scopedSlots:_vm._u([{key:"subheader",fn:function(){return [_vm._t("subheader")]},proxy:true}],null,true)}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-overflow-y-auto gl-flex gl-flex-col gl-flex-1 gl-flex-grow gl-bg-inherit gl-overscroll-contain",attrs:{"data-testid":"chat-history"},on:{"scroll":_vm.handleScrollingThrottled}},[(_vm.shouldShowThreadList)?_c('duo-chat-threads',{attrs:{"threads":_vm.threadList,"preferred-locale":_vm.preferredLocale},on:{"new-chat":_vm.onNewChat,"select-thread":_vm.onSelectThread,"delete-thread":_vm.onDeleteThread,"close":_vm.hideChat}}):_c('transition-group',{staticClass:"duo-chat-history gl-p-5 gl-mt-auto",attrs:{"mode":"out-in","tag":"section","name":"message"}},[_vm._l((_vm.conversations),function(conversation,index){return _c('duo-chat-conversation',{key:("conversation-" + index),attrs:{"enable-code-insertion":_vm.enableCodeInsertion,"messages":conversation,"canceled-request-ids":_vm.canceledRequestIds,"show-delimiter":index > 0,"with-feedback":_vm.withFeedback},on:{"track-feedback":_vm.onTrackFeedback,"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet,"copy-message":_vm.onCopyMessage,"get-context-item-content":_vm.onGetContextItemContent}})}),_vm._v(" "),(!_vm.hasMessages && !_vm.isLoading)?[_c('div',{key:"empty-state-message",staticClass:"duo-chat-message gl-rounded-bl-none gl-border-1 gl-border-solid gl-border-gray-50 gl-bg-gray-10 gl-p-4 gl-leading-20 gl-text-gray-900 gl-break-anywhere",attrs:{"data-testid":"gl-duo-chat-empty-state"}},[(_vm.emptyStateTitle)?_c('p',{staticClass:"gl-m-0",attrs:{"data-testid":"gl-duo-chat-empty-state-title"}},[_vm._v("\n "+_vm._s(_vm.emptyStateTitle)+"\n ")]):_vm._e(),_vm._v(" "),_c('duo-chat-predefined-prompts',{key:"predefined-prompts",attrs:{"prompts":_vm.predefinedPrompts},on:{"click":_vm.sendPredefinedPrompt}})],1)]:_vm._e(),_vm._v(" "),(_vm.isLoading)?_c('duo-chat-loader',{key:"loader",attrs:{"tool-name":_vm.toolName}}):_vm._e(),_vm._v(" "),_c('div',{key:"anchor",ref:"anchor",staticClass:"scroll-anchor"})],2)],1),_vm._v(" "),(_vm.isChatAvailable && !_vm.shouldShowThreadList)?_c('footer',{staticClass:"duo-chat-drawer-footer gl-border-0 gl-bg-default gl-pb-3 gl-shrink-0 gl-relative gl-z-2",class:{ 'duo-chat-drawer-body-scrim-on-footer': !_vm.scrolledToBottom },attrs:{"data-testid":"chat-footer"}},[_c('gl-form',{attrs:{"data-testid":"chat-prompt-form"},on:{"submit":function($event){$event.stopPropagation();$event.preventDefault();return _vm.sendChatPrompt.apply(null, arguments)}}},[_c('div',{staticClass:"gl-relative gl-max-w-full"},[_vm._t("context-items-menu",null,{"isOpen":_vm.contextItemsMenuIsOpen,"onClose":_vm.closeContextItemsMenuOpen,"setRef":_vm.setContextItemsMenuRef,"focusPrompt":_vm.focusChatInput})],2),_vm._v(" "),_c('gl-form-input-group',{scopedSlots:_vm._u([{key:"append",fn:function(){return [(_vm.displaySubmitButton)?_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 !gl-rounded-full",attrs:{"icon":"paper-airplane","category":"primary","variant":"confirm","type":"submit","data-testid":"chat-prompt-submit-button","aria-label":_vm.$options.i18n.CHAT_SUBMIT_LABEL}}):_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 !gl-rounded-full",attrs:{"icon":"stop","category":"primary","variant":"default","data-testid":"chat-prompt-cancel-button","aria-label":_vm.$options.i18n.CHAT_CANCEL_LABEL},on:{"click":_vm.cancelPrompt}})]},proxy:true}],null,false,608602988)},[_c('div',{staticClass:"duo-chat-input gl-min-h-8 gl-max-w-full gl-grow gl-align-top",attrs:{"data-value":_vm.prompt}},[(_vm.shouldShowSlashCommands)?_c('gl-card',{ref:"commands",staticClass:"slash-commands !gl-absolute gl-w-full -gl-translate-y-full gl-list-none gl-pl-0 gl-shadow-md",attrs:{"body-class":"!gl-p-2"}},_vm._l((_vm.filteredSlashCommands),function(command,index){return _c('gl-dropdown-item',{key:command.name,class:{ 'active-command': index === _vm.activeCommandIndex },on:{"click":function($event){return _vm.selectSlashCommand(index)}},nativeOn:{"mouseenter":function($event){_vm.activeCommandIndex = index;}}},[_c('span',{staticClass:"gl-flex gl-justify-between"},[_c('span',{staticClass:"gl-block"},[_vm._v(_vm._s(command.name))]),_vm._v(" "),_c('small',{staticClass:"gl-pl-3 gl-text-right gl-italic gl-text-subtle"},[_vm._v(_vm._s(command.description))])])])}),1):_vm._e(),_vm._v(" "),_c('gl-form-textarea',{ref:"prompt",staticClass:"gl-absolute !gl-h-full gl-rounded-br-none gl-rounded-tr-none !gl-bg-transparent !gl-py-4 !gl-shadow-none",class:{ 'gl-truncate': !_vm.prompt },attrs:{"data-testid":"chat-prompt-input","placeholder":_vm.inputPlaceholder,"autofocus":""},on:{"compositionend":_vm.compositionEnd},nativeOn:{"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }if($event.ctrlKey||$event.shiftKey||$event.altKey||$event.metaKey){ return null; }$event.preventDefault();},"keyup":function($event){return _vm.onInputKeyup.apply(null, arguments)}},model:{value:(_vm.prompt),callback:function ($$v) {_vm.prompt=$$v;},expression:"prompt"}})],1)])],1),_vm._v(" "),_c('p',{staticClass:"gl-mb-0 gl-mt-3 gl-px-4 gl-text-sm gl-text-secondary"},[_vm._v("\n "+_vm._s(_vm.$options.i18n.CHAT_DISCLAMER)+"\n ")])],1):_vm._e()],1):_vm._e()])};
622
+ },attrs:{"id":"chat-component","role":"complementary","data-testid":"chat-component"}},[(_vm.showHeader)?_c('duo-chat-header',{ref:"header",attrs:{"active-thread-id":_vm.activeThreadId,"title":_vm.isMultithreaded && _vm.currentView === 'list' ? _vm.$options.i18n.CHAT_HISTORY_TITLE : _vm.title,"subtitle":_vm.activeThreadTitleForView,"error":_vm.error,"is-multithreaded":_vm.isMultithreaded,"current-view":_vm.currentView,"should-render-resizable":_vm.shouldRenderResizable,"badge-type":_vm.isMultithreaded ? null : _vm.badgeType},on:{"go-back":_vm.onGoBack,"new-chat":_vm.onNewChat,"close":_vm.hideChat},scopedSlots:_vm._u([{key:"subheader",fn:function(){return [_vm._t("subheader")]},proxy:true}],null,true)}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-overflow-y-auto gl-flex gl-flex-col gl-flex-1 gl-flex-grow gl-bg-inherit gl-overscroll-contain",attrs:{"data-testid":"chat-history"},on:{"scroll":_vm.handleScrollingThrottled}},[(_vm.shouldShowThreadList)?_c('duo-chat-threads',{attrs:{"threads":_vm.threadList,"preferred-locale":_vm.preferredLocale},on:{"new-chat":_vm.onNewChat,"select-thread":_vm.onSelectThread,"delete-thread":_vm.onDeleteThread,"close":_vm.hideChat}}):_c('transition-group',{staticClass:"duo-chat-history gl-p-5 gl-mt-auto",attrs:{"mode":"out-in","tag":"section","name":"message"}},[_vm._l((_vm.conversations),function(conversation,index){return _c('duo-chat-conversation',{key:("conversation-" + index),attrs:{"enable-code-insertion":_vm.enableCodeInsertion,"messages":conversation,"canceled-request-ids":_vm.canceledRequestIds,"show-delimiter":index > 0,"with-feedback":_vm.withFeedback},on:{"track-feedback":_vm.onTrackFeedback,"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet,"copy-message":_vm.onCopyMessage,"get-context-item-content":_vm.onGetContextItemContent}})}),_vm._v(" "),(!_vm.hasMessages && !_vm.isLoading)?[_c('div',{key:"empty-state-message",staticClass:"duo-chat-message gl-rounded-bl-none gl-border-1 gl-border-solid gl-border-gray-50 gl-bg-gray-10 gl-p-4 gl-leading-20 gl-text-gray-900 gl-break-anywhere",attrs:{"data-testid":"gl-duo-chat-empty-state"}},[(_vm.emptyStateTitle)?_c('p',{staticClass:"gl-m-0",attrs:{"data-testid":"gl-duo-chat-empty-state-title"}},[_vm._v("\n "+_vm._s(_vm.emptyStateTitle)+"\n ")]):_vm._e(),_vm._v(" "),_c('duo-chat-predefined-prompts',{key:"predefined-prompts",attrs:{"prompts":_vm.predefinedPrompts},on:{"click":_vm.sendPredefinedPrompt}})],1)]:_vm._e(),_vm._v(" "),(_vm.isLoading)?_c('duo-chat-loader',{key:"loader",attrs:{"tool-name":_vm.toolName}}):_vm._e(),_vm._v(" "),_c('div',{key:"anchor",ref:"anchor",staticClass:"scroll-anchor"})],2)],1),_vm._v(" "),(_vm.isChatAvailable && !_vm.shouldShowThreadList)?_c('footer',{staticClass:"duo-chat-drawer-footer gl-border-0 gl-bg-default gl-pb-3 gl-shrink-0 gl-relative gl-z-2",class:{ 'duo-chat-drawer-body-scrim-on-footer': !_vm.scrolledToBottom },attrs:{"data-testid":"chat-footer"}},[_c('gl-form',{attrs:{"data-testid":"chat-prompt-form"},on:{"submit":function($event){$event.stopPropagation();$event.preventDefault();return _vm.sendChatPrompt.apply(null, arguments)}}},[_c('div',{staticClass:"gl-relative gl-max-w-full"},[_vm._t("context-items-menu",null,{"isOpen":_vm.contextItemsMenuIsOpen,"onClose":_vm.closeContextItemsMenuOpen,"setRef":_vm.setContextItemsMenuRef,"focusPrompt":_vm.focusChatInput})],2),_vm._v(" "),_c('gl-form-input-group',{scopedSlots:_vm._u([{key:"append",fn:function(){return [(_vm.canSubmit)?_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 !gl-rounded-full",attrs:{"icon":"paper-airplane","category":"primary","variant":"confirm","type":"submit","data-testid":"chat-prompt-submit-button","aria-label":_vm.$options.i18n.CHAT_SUBMIT_LABEL}}):_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 !gl-rounded-full",attrs:{"icon":"stop","category":"primary","variant":"default","data-testid":"chat-prompt-cancel-button","aria-label":_vm.$options.i18n.CHAT_CANCEL_LABEL},on:{"click":_vm.cancelPrompt}})]},proxy:true}],null,false,3738248012)},[_c('div',{staticClass:"duo-chat-input gl-min-h-8 gl-max-w-full gl-grow gl-align-top",attrs:{"data-value":_vm.prompt}},[(_vm.shouldShowSlashCommands)?_c('gl-card',{ref:"commands",staticClass:"slash-commands !gl-absolute gl-w-full -gl-translate-y-full gl-list-none gl-pl-0 gl-shadow-md",attrs:{"body-class":"!gl-p-2"}},_vm._l((_vm.filteredSlashCommands),function(command,index){return _c('gl-dropdown-item',{key:command.name,class:{ 'active-command': index === _vm.activeCommandIndex },on:{"click":function($event){return _vm.selectSlashCommand(index)}},nativeOn:{"mouseenter":function($event){_vm.activeCommandIndex = index;}}},[_c('span',{staticClass:"gl-flex gl-justify-between"},[_c('span',{staticClass:"gl-block"},[_vm._v(_vm._s(command.name))]),_vm._v(" "),_c('small',{staticClass:"gl-pl-3 gl-text-right gl-italic gl-text-subtle"},[_vm._v(_vm._s(command.description))])])])}),1):_vm._e(),_vm._v(" "),_c('gl-form-textarea',{ref:"prompt",staticClass:"gl-absolute !gl-h-full gl-rounded-br-none gl-rounded-tr-none !gl-bg-transparent !gl-py-4 !gl-shadow-none",class:{ 'gl-truncate': !_vm.prompt },attrs:{"disabled":!_vm.canSubmit,"data-testid":"chat-prompt-input","placeholder":_vm.inputPlaceholder,"autofocus":""},on:{"compositionend":_vm.compositionEnd},nativeOn:{"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }if($event.ctrlKey||$event.shiftKey||$event.altKey||$event.metaKey){ return null; }$event.preventDefault();},"keyup":function($event){return _vm.onInputKeyup.apply(null, arguments)}},model:{value:(_vm.prompt),callback:function ($$v) {_vm.prompt=$$v;},expression:"prompt"}})],1)])],1),_vm._v(" "),_c('p',{staticClass:"gl-mb-0 gl-mt-3 gl-px-4 gl-text-sm gl-text-secondary"},[_vm._v("\n "+_vm._s(_vm.$options.i18n.CHAT_DISCLAMER)+"\n ")])],1):_vm._e()],1):_vm._e()])};
624
623
  var __vue_staticRenderFns__ = [];
625
624
 
626
625
  /* style */
@@ -79,6 +79,9 @@ var script = {
79
79
  },
80
80
  onGetContextItemContent(e) {
81
81
  this.$emit('get-context-item-content', e);
82
+ },
83
+ onOpenFilePath(e) {
84
+ this.$emit('open-file-path', e);
82
85
  }
83
86
  },
84
87
  i18n
@@ -88,7 +91,7 @@ var script = {
88
91
  const __vue_script__ = script;
89
92
 
90
93
  /* template */
91
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:['gl-flex gl-flex-col gl-justify-end', { 'insert-code-hidden': !_vm.enableCodeInsertion }]},[(_vm.showDelimiter)?_c('div',{staticClass:"gl-my-5 gl-flex gl-items-center gl-gap-4 gl-text-gray-500",attrs:{"data-testid":"conversation-delimiter"}},[_c('hr',{staticClass:"gl-grow"}),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.$options.i18n.CONVERSATION_NEW_CHAT))]),_vm._v(" "),_c('hr',{staticClass:"gl-grow"})]):_vm._e(),_vm._v(" "),_vm._l((_vm.messages),function(msg,index){return _c('duo-chat-message',{key:((msg.role) + "-" + index),attrs:{"message":msg,"trusted-urls":_vm.trustedUrls,"is-cancelled":_vm.canceledRequestIds.includes(msg.requestId),"with-feedback":_vm.withFeedback},on:{"track-feedback":_vm.onTrackFeedback,"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet,"copy-message":_vm.onCopyMessage,"get-context-item-content":_vm.onGetContextItemContent}})})],2)};
94
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:['gl-flex gl-flex-col gl-justify-end', { 'insert-code-hidden': !_vm.enableCodeInsertion }]},[(_vm.showDelimiter)?_c('div',{staticClass:"gl-my-5 gl-flex gl-items-center gl-gap-4 gl-text-gray-500",attrs:{"data-testid":"conversation-delimiter"}},[_c('hr',{staticClass:"gl-grow"}),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.$options.i18n.CONVERSATION_NEW_CHAT))]),_vm._v(" "),_c('hr',{staticClass:"gl-grow"})]):_vm._e(),_vm._v(" "),_vm._l((_vm.messages),function(msg,index){return _c('duo-chat-message',{key:((msg.role) + "-" + index),attrs:{"message":msg,"trusted-urls":_vm.trustedUrls,"is-cancelled":_vm.canceledRequestIds.includes(msg.requestId),"with-feedback":_vm.withFeedback},on:{"track-feedback":_vm.onTrackFeedback,"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet,"copy-message":_vm.onCopyMessage,"get-context-item-content":_vm.onGetContextItemContent,"open-file-path":_vm.onOpenFilePath}})})],2)};
92
95
  var __vue_staticRenderFns__ = [];
93
96
 
94
97
  /* style */
@@ -42,12 +42,14 @@ var script = {
42
42
  computeTransitionWidth() {
43
43
  const container = this.$refs.transition;
44
44
  const active = this.$refs.currentTransition[0]; // There's only one `currentTransition` ref at a time, but refs in v-for loops are always Arrays
45
- const {
46
- width,
47
- height
48
- } = active.getBoundingClientRect();
49
- container.$el.style.width = `${width}px`;
50
- container.$el.style.height = `${height}px`;
45
+ if (active) {
46
+ const {
47
+ width,
48
+ height
49
+ } = active.getBoundingClientRect();
50
+ container.$el.style.width = `${width}px`;
51
+ container.$el.style.height = `${height}px`;
52
+ }
51
53
  },
52
54
  enter() {
53
55
  clearTimeout(this.timeout);
@@ -10,8 +10,17 @@ import { CopyCodeElement } from './copy_code_element';
10
10
  import { InsertCodeSnippetElement } from './insert_code_snippet_element';
11
11
  import { concatUntilEmpty, checkClipboardPermissions } from './utils';
12
12
  import { DUO_CODE_SCRIM_BOTTOM_CLASS, DUO_CODE_SCRIM_OFFSET, DUO_CODE_SCRIM_TOP_CLASS } from './constants';
13
+ import AgentMessage from './message_types/message_agent';
14
+ import InputRequestedMessage from './message_types/message_input_requested';
15
+ import ToolMessage from './message_types/message_tool';
16
+ import WorkflowEndMessage from './message_types/message_workflow_end';
13
17
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
14
18
 
19
+ const COMPONENT_FOR_MESSAGE_TYPE = {
20
+ tool: () => ToolMessage,
21
+ request: () => InputRequestedMessage,
22
+ workflow_end: () => WorkflowEndMessage
23
+ };
15
24
  const i18n = {
16
25
  MODAL: {
17
26
  TITLE: translate('DuoChatMessage.modalTitle', 'Give feedback on GitLab Duo Chat'),
@@ -121,10 +130,10 @@ var script = {
121
130
  return this.isChunk && !this.isCancelled;
122
131
  },
123
132
  isAssistantMessage() {
124
- return this.message.role.toLowerCase() === MESSAGE_MODEL_ROLES.assistant;
133
+ return this.isMessageOfType(MESSAGE_MODEL_ROLES.assistant);
125
134
  },
126
135
  isUserMessage() {
127
- return this.message.role.toLowerCase() === MESSAGE_MODEL_ROLES.user;
136
+ return this.isMessageOfType(MESSAGE_MODEL_ROLES.user);
128
137
  },
129
138
  sources() {
130
139
  var _this$message$extras;
@@ -203,6 +212,14 @@ var script = {
203
212
  this.hydrateContentWithGFM();
204
213
  },
205
214
  methods: {
215
+ isMessageOfType(type) {
216
+ var _this$message2, _this$message2$role, _this$message3, _this$message3$messag;
217
+ return ((_this$message2 = this.message) === null || _this$message2 === void 0 ? void 0 : (_this$message2$role = _this$message2.role) === null || _this$message2$role === void 0 ? void 0 : _this$message2$role.toLowerCase()) === type || ((_this$message3 = this.message) === null || _this$message3 === void 0 ? void 0 : (_this$message3$messag = _this$message3.message_type) === null || _this$message3$messag === void 0 ? void 0 : _this$message3$messag.toLowerCase()) === type;
218
+ },
219
+ componentForMessageType(message) {
220
+ var _COMPONENT_FOR_MESSAG, _COMPONENT_FOR_MESSAG2;
221
+ return (_COMPONENT_FOR_MESSAG = (_COMPONENT_FOR_MESSAG2 = COMPONENT_FOR_MESSAGE_TYPE[message.message_type]) === null || _COMPONENT_FOR_MESSAG2 === void 0 ? void 0 : _COMPONENT_FOR_MESSAG2.call(COMPONENT_FOR_MESSAGE_TYPE, message, this.messages)) !== null && _COMPONENT_FOR_MESSAG !== void 0 ? _COMPONENT_FOR_MESSAG : AgentMessage;
222
+ },
206
223
  setChunks() {
207
224
  if (this.isChunk) {
208
225
  const {
@@ -287,6 +304,9 @@ var script = {
287
304
  }
288
305
  this.copied = true;
289
306
  }
307
+ },
308
+ onOpenFilePath(e) {
309
+ this.$emit('open-file-path', e);
290
310
  }
291
311
  }
292
312
  };
@@ -296,14 +316,14 @@ const __vue_script__ = script;
296
316
 
297
317
  /* template */
298
318
  var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-flex gl-flex-row gl-items-end duo-chat-message-container",on:{"mouseenter":function($event){_vm.hovered = true;},"mouseleave":function($event){_vm.hovered = false;
299
- _vm.copied = false;}}},[_c('div',{staticClass:"duo-chat-message gl-border gl-border-transparent gl-p-4 gl-leading-20 gl-break-anywhere md",class:{
300
- 'gl-ml-auto gl-rounded-br-none gl-bg-feedback-info gl-text-feedback-info': _vm.isUserMessage,
301
- 'gl-rounded-bl-none gl-border-1 gl-border-solid gl-border-gray-50 gl-text-default':
302
- _vm.isAssistantMessage,
303
- 'gl-bg-subtle': _vm.isAssistantMessage && !_vm.error,
304
- 'duo-chat-message-with-error gl-bg-feedback-danger': _vm.error,
305
- '!gl-rounded-br-none': _vm.shouldShowCopyAction,
306
- },on:{"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet}},[(_vm.showA11yFromText)?_c('div',{staticClass:"gl-sr-only"},[_vm._v("\n "+_vm._s(_vm.isUserMessage ? _vm.$options.i18n.FROM_ME : _vm.$options.i18n.FROM_DUO)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.error)?_c('gl-icon',{staticClass:"error-icon gl-mr-3 gl-shrink-0 gl-text-danger",attrs:{"aria-label":_vm.$options.i18n.MESSAGE_ERROR,"name":"error","size":16,"data-testid":"error"}}):_vm._e(),_vm._v(" "),_c('div',{ref:"content-wrapper",class:{ 'has-error': _vm.error }},[(_vm.displaySelectedContextItems && _vm.isAssistantMessage)?_c('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.shouldShowFeedbackLink)?_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('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),_vm._v(" "),_c('transition',{attrs:{"name":"duo-chat-message-actions"}},[(_vm.shouldShowCopyAction)?_c('div',{staticClass:"gl-bg-subtle duo-chat-message-actions gl-rounded-tr-lg gl-rounded-br-lg"},[_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip.hover",modifiers:{"hover":true}}],class:{ '!gl-text-success': _vm.copied },attrs:{"title":_vm.copied ? _vm.$options.i18n.CHAT_MESSAGE_COPIED : _vm.$options.i18n.CHAT_MESSAGE_COPY,"icon":_vm.copied ? 'check-circle-filled' : 'copy-to-clipboard',"category":"tertiary"},on:{"click":_vm.copyMessage}})],1):_vm._e()])],1)};
319
+ _vm.copied = false;}}},[(_vm.isAssistantMessage || _vm.isUserMessage)?[_c('div',{staticClass:"duo-chat-message gl-border gl-border-transparent gl-p-4 gl-leading-20 gl-break-anywhere md",class:{
320
+ 'gl-ml-auto gl-rounded-br-none gl-bg-feedback-info gl-text-feedback-info': _vm.isUserMessage,
321
+ 'gl-rounded-bl-none gl-border-1 gl-border-solid gl-border-gray-50 gl-text-default':
322
+ _vm.isAssistantMessage,
323
+ 'gl-bg-subtle': _vm.isAssistantMessage && !_vm.error,
324
+ 'duo-chat-message-with-error gl-bg-feedback-danger': _vm.error,
325
+ '!gl-rounded-br-none': _vm.shouldShowCopyAction,
326
+ },on:{"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet}},[(_vm.showA11yFromText)?_c('div',{staticClass:"gl-sr-only"},[_vm._v("\n "+_vm._s(_vm.isUserMessage ? _vm.$options.i18n.FROM_ME : _vm.$options.i18n.FROM_DUO)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.error)?_c('gl-icon',{staticClass:"error-icon gl-mr-3 gl-shrink-0 gl-text-danger",attrs:{"aria-label":_vm.$options.i18n.MESSAGE_ERROR,"name":"error","size":16,"data-testid":"error"}}):_vm._e(),_vm._v(" "),_c('div',{ref:"content-wrapper",class:{ 'has-error': _vm.error }},[(_vm.displaySelectedContextItems && _vm.isAssistantMessage)?_c('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.shouldShowFeedbackLink)?_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('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),_vm._v(" "),_c('transition',{attrs:{"name":"duo-chat-message-actions"}},[(_vm.shouldShowCopyAction)?_c('div',{staticClass:"gl-bg-subtle duo-chat-message-actions gl-rounded-tr-lg gl-rounded-br-lg"},[_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip.hover",modifiers:{"hover":true}}],class:{ '!gl-text-success': _vm.copied },attrs:{"title":_vm.copied ? _vm.$options.i18n.CHAT_MESSAGE_COPIED : _vm.$options.i18n.CHAT_MESSAGE_COPY,"icon":_vm.copied ? 'check-circle-filled' : 'copy-to-clipboard',"category":"tertiary"},on:{"click":_vm.copyMessage}})],1):_vm._e()])]:_c(_vm.componentForMessageType(_vm.message),{tag:"component",attrs:{"message":_vm.message,"data-testid":"workflow-message"},on:{"open-file-path":_vm.onOpenFilePath}})],2)};
307
327
  var __vue_staticRenderFns__ = [];
308
328
 
309
329
  /* style */
@@ -0,0 +1,13 @@
1
+ import AgentMessage from './message_agent';
2
+ import InputRequestedMessage from './message_input_requested';
3
+ import SystemMessage from './message_tool';
4
+ import WorkflowEndMessage from './message_workflow_end';
5
+
6
+ var index = {
7
+ AgentMessage,
8
+ InputRequestedMessage,
9
+ SystemMessage,
10
+ WorkflowEndMessage
11
+ };
12
+
13
+ export default index;
@@ -0,0 +1,61 @@
1
+ import BaseMessage from './message_base';
2
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
3
+
4
+ var script = {
5
+ name: 'DuoChatAgentMessage',
6
+ components: {
7
+ BaseMessage
8
+ },
9
+ props: {
10
+ message: {
11
+ required: true,
12
+ type: Object
13
+ }
14
+ },
15
+ computed: {
16
+ hasError() {
17
+ var _this$message, _this$message$errors;
18
+ return Boolean((_this$message = this.message) === null || _this$message === void 0 ? void 0 : (_this$message$errors = _this$message.errors) === null || _this$message$errors === void 0 ? void 0 : _this$message$errors.length);
19
+ }
20
+ }
21
+ };
22
+
23
+ /* script */
24
+ const __vue_script__ = script;
25
+
26
+ /* template */
27
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('base-message',{staticClass:"gl-rounded-bl-none gl-border-1 gl-border-solid gl-text-gray-900 gl-p-4 gl-border-gray-50",class:{
28
+ 'gl-border-red-100': _vm.hasError,
29
+ },attrs:{"message":_vm.message},scopedSlots:_vm._u([{key:"message",fn:function(slotProps){return [_vm._t("message",null,null,slotProps)]}}],null,true)})};
30
+ var __vue_staticRenderFns__ = [];
31
+
32
+ /* style */
33
+ const __vue_inject_styles__ = undefined;
34
+ /* scoped */
35
+ const __vue_scope_id__ = undefined;
36
+ /* module identifier */
37
+ const __vue_module_identifier__ = undefined;
38
+ /* functional template */
39
+ const __vue_is_functional_template__ = false;
40
+ /* style inject */
41
+
42
+ /* style inject SSR */
43
+
44
+ /* style inject shadow dom */
45
+
46
+
47
+
48
+ const __vue_component__ = __vue_normalize__(
49
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
50
+ __vue_inject_styles__,
51
+ __vue_script__,
52
+ __vue_scope_id__,
53
+ __vue_is_functional_template__,
54
+ __vue_module_identifier__,
55
+ false,
56
+ undefined,
57
+ undefined,
58
+ undefined
59
+ );
60
+
61
+ export default __vue_component__;
@@ -0,0 +1,103 @@
1
+ import { GlIcon, GlSafeHtmlDirective, GlTooltipDirective } from '@gitlab/ui';
2
+ import { renderDuoChatMarkdownPreview } from '../../../markdown_renderer';
3
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
4
+
5
+ var script = {
6
+ name: 'DuoChatBaseMessage',
7
+ components: {
8
+ GlIcon
9
+ },
10
+ directives: {
11
+ SafeHtml: GlSafeHtmlDirective,
12
+ GlTooltip: GlTooltipDirective
13
+ },
14
+ inject: {
15
+ // Note, we likely might move away from Provide/Inject for this
16
+ // and only ship the versions that are currently in the default
17
+ // See https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/3953#note_1762834219
18
+ // for more context.
19
+ renderGFM: {
20
+ from: 'renderGFM',
21
+ default: () => element => {
22
+ element.classList.add('gl-markdown', 'gl-compact-markdown', 'gl-text-sm');
23
+ }
24
+ },
25
+ renderMarkdown: {
26
+ from: 'renderMarkdown',
27
+ default: () => renderDuoChatMarkdownPreview
28
+ }
29
+ },
30
+ props: {
31
+ /**
32
+ * A message object
33
+ */
34
+ message: {
35
+ type: Object,
36
+ required: true
37
+ }
38
+ },
39
+ computed: {
40
+ messageContent() {
41
+ return this.renderMarkdown(this.message.content);
42
+ },
43
+ renderedError() {
44
+ var _this$message$errors;
45
+ return this.renderMarkdown(((_this$message$errors = this.message.errors) === null || _this$message$errors === void 0 ? void 0 : _this$message$errors.join('; ')) || '');
46
+ },
47
+ hasError() {
48
+ var _this$message, _this$message$errors2;
49
+ 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);
50
+ }
51
+ },
52
+ mounted() {
53
+ this.hydrateContentWithGFM();
54
+ },
55
+ updated() {
56
+ this.hydrateContentWithGFM();
57
+ },
58
+ methods: {
59
+ hydrateContentWithGFM() {
60
+ if (this.$refs.content) {
61
+ this.$nextTick(this.renderGFM(this.$refs.content, this.message.role));
62
+ }
63
+ }
64
+ }
65
+ };
66
+
67
+ /* script */
68
+ const __vue_script__ = script;
69
+
70
+ /* template */
71
+ 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-mb-4 gl-rounded-lg gl-leading-20 gl-break-anywhere"},[(_vm.hasError)?_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:{"name":"status_warning_borderless","size":16,"data-testid":"error"}}):_vm._e(),_vm._v(" "),_c('div',{ref:"content-wrapper",class:{ 'has-error': _vm.hasError }},[(_vm.hasError)?_c('div',{directives:[{name:"safe-html",rawName:"v-safe-html",value:(_vm.renderedError),expression:"renderedError"}],ref:"error-message"}):_c('div',[_vm._t("message",function(){return [_c('div',{directives:[{name:"safe-html",rawName:"v-safe-html",value:(_vm.messageContent),expression:"messageContent"}],ref:"content"})]},null,{ content: _vm.message.content, htmlContent: _vm.messageContent })],2)])],1)};
72
+ var __vue_staticRenderFns__ = [];
73
+
74
+ /* style */
75
+ const __vue_inject_styles__ = undefined;
76
+ /* scoped */
77
+ const __vue_scope_id__ = undefined;
78
+ /* module identifier */
79
+ const __vue_module_identifier__ = undefined;
80
+ /* functional template */
81
+ const __vue_is_functional_template__ = false;
82
+ /* style inject */
83
+
84
+ /* style inject SSR */
85
+
86
+ /* style inject shadow dom */
87
+
88
+
89
+
90
+ const __vue_component__ = __vue_normalize__(
91
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
92
+ __vue_inject_styles__,
93
+ __vue_script__,
94
+ __vue_scope_id__,
95
+ __vue_is_functional_template__,
96
+ __vue_module_identifier__,
97
+ false,
98
+ undefined,
99
+ undefined,
100
+ undefined
101
+ );
102
+
103
+ export default __vue_component__;
@@ -0,0 +1,53 @@
1
+ import AgentMessage from './message_agent';
2
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
3
+
4
+ var script = {
5
+ name: 'DuoChatInputRequestedMessage',
6
+ components: {
7
+ AgentMessage
8
+ },
9
+ props: {
10
+ message: {
11
+ required: true,
12
+ type: Object
13
+ }
14
+ }
15
+ };
16
+
17
+ /* script */
18
+ const __vue_script__ = script;
19
+
20
+ /* template */
21
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('agent-message',{staticClass:"duo-highlight-message input-requested",attrs:{"message":_vm.message}})};
22
+ var __vue_staticRenderFns__ = [];
23
+
24
+ /* style */
25
+ const __vue_inject_styles__ = undefined;
26
+ /* scoped */
27
+ const __vue_scope_id__ = undefined;
28
+ /* module identifier */
29
+ const __vue_module_identifier__ = undefined;
30
+ /* functional template */
31
+ const __vue_is_functional_template__ = false;
32
+ /* style inject */
33
+
34
+ /* style inject SSR */
35
+
36
+ /* style inject shadow dom */
37
+
38
+
39
+
40
+ const __vue_component__ = __vue_normalize__(
41
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
42
+ __vue_inject_styles__,
43
+ __vue_script__,
44
+ __vue_scope_id__,
45
+ __vue_is_functional_template__,
46
+ __vue_module_identifier__,
47
+ false,
48
+ undefined,
49
+ undefined,
50
+ undefined
51
+ );
52
+
53
+ export default __vue_component__;
@@ -0,0 +1,77 @@
1
+ import { GlLink } from '@gitlab/ui';
2
+ import BaseMessage from './message_base';
3
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
4
+
5
+ var script = {
6
+ name: 'DuoChatToolMessage',
7
+ components: {
8
+ BaseMessage,
9
+ GlLink
10
+ },
11
+ provide: {
12
+ renderGFM: {
13
+ from: 'renderGFM',
14
+ default: () => element => {
15
+ element.classList.add('gl-markdown', 'gl-compact-markdown');
16
+ element.classList.add('duo-system-message', 'gl-text-sm');
17
+ }
18
+ }
19
+ },
20
+ props: {
21
+ message: {
22
+ required: true,
23
+ type: Object
24
+ }
25
+ },
26
+ computed: {
27
+ messageFilePath() {
28
+ var _this$message$tool_in, _this$message$tool_in2;
29
+ return (_this$message$tool_in = this.message.tool_info) === null || _this$message$tool_in === void 0 ? void 0 : (_this$message$tool_in2 = _this$message$tool_in.args) === null || _this$message$tool_in2 === void 0 ? void 0 : _this$message$tool_in2.file_path;
30
+ }
31
+ },
32
+ methods: {
33
+ onOpenFilePath() {
34
+ this.$emit('open-file-path', this.messageFilePath);
35
+ }
36
+ }
37
+ };
38
+
39
+ /* script */
40
+ const __vue_script__ = script;
41
+
42
+ /* template */
43
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('base-message',{attrs:{"message":_vm.message},scopedSlots:_vm._u([{key:"message",fn:function(ref){
44
+ var content = ref.content;
45
+ return [_c('span',{staticClass:"gl-text-sm"},[_vm._v(_vm._s(content))]),_vm._v(" "),(_vm.messageFilePath)?_c('gl-link',{staticClass:"gl-markdown file-path-link gl-text-sm",attrs:{"data-testid":"file-path-link"},on:{"click":function($event){$event.preventDefault();return _vm.onOpenFilePath.apply(null, arguments)}}},[_c('code',[_vm._v(_vm._s(_vm.messageFilePath))])]):_vm._e()]}}])})};
46
+ var __vue_staticRenderFns__ = [];
47
+
48
+ /* style */
49
+ const __vue_inject_styles__ = undefined;
50
+ /* scoped */
51
+ const __vue_scope_id__ = undefined;
52
+ /* module identifier */
53
+ const __vue_module_identifier__ = undefined;
54
+ /* functional template */
55
+ const __vue_is_functional_template__ = false;
56
+ /* style inject */
57
+
58
+ /* style inject SSR */
59
+
60
+ /* style inject shadow dom */
61
+
62
+
63
+
64
+ const __vue_component__ = __vue_normalize__(
65
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
66
+ __vue_inject_styles__,
67
+ __vue_script__,
68
+ __vue_scope_id__,
69
+ __vue_is_functional_template__,
70
+ __vue_module_identifier__,
71
+ false,
72
+ undefined,
73
+ undefined,
74
+ undefined
75
+ );
76
+
77
+ export default __vue_component__;
@@ -0,0 +1,59 @@
1
+ import { GlButton } from '@gitlab/ui';
2
+ import AgentMessage from './message_agent';
3
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
4
+
5
+ const WORKFLOW_NEW_APP = 'workflow-new';
6
+ var script = {
7
+ name: 'DuoChatWorkflowEndMessage',
8
+ components: {
9
+ AgentMessage,
10
+ GlButton
11
+ },
12
+ workflowEndMessage: {
13
+ content: "Review the changes. To improve the implementation, create another workflow and describe the specific changes you'd like to see."
14
+ },
15
+ newRoute: {
16
+ name: WORKFLOW_NEW_APP
17
+ }
18
+ };
19
+
20
+ /* script */
21
+ const __vue_script__ = script;
22
+
23
+ /* template */
24
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('agent-message',{attrs:{"message":_vm.$options.workflowEndMessage},scopedSlots:_vm._u([{key:"message",fn:function(ref){
25
+ var content = ref.content;
26
+ return [_c('p',[_vm._v("\n "+_vm._s(content)+"\n ")]),_vm._v(" "),_c('gl-button',{staticClass:"gl-mt-4",attrs:{"to":_vm.$options.newRoute}},[_vm._v("New workflow")])]}}])})};
27
+ var __vue_staticRenderFns__ = [];
28
+
29
+ /* style */
30
+ const __vue_inject_styles__ = undefined;
31
+ /* scoped */
32
+ const __vue_scope_id__ = undefined;
33
+ /* module identifier */
34
+ const __vue_module_identifier__ = undefined;
35
+ /* functional template */
36
+ const __vue_is_functional_template__ = false;
37
+ /* style inject */
38
+
39
+ /* style inject SSR */
40
+
41
+ /* style inject shadow dom */
42
+
43
+
44
+
45
+ const __vue_component__ = __vue_normalize__(
46
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
47
+ __vue_inject_styles__,
48
+ __vue_script__,
49
+ __vue_scope_id__,
50
+ __vue_is_functional_template__,
51
+ __vue_module_identifier__,
52
+ false,
53
+ undefined,
54
+ undefined,
55
+ undefined
56
+ );
57
+
58
+ export default __vue_component__;
59
+ export { WORKFLOW_NEW_APP };
@@ -20,7 +20,10 @@ const DOCUMENTATION_SOURCE_TYPES = {
20
20
  const MESSAGE_MODEL_ROLES = {
21
21
  user: 'user',
22
22
  system: 'system',
23
- assistant: 'assistant'
23
+ assistant: 'assistant',
24
+ tool: 'tool',
25
+ request: 'request',
26
+ workflow_end: 'workflow_end'
24
27
  };
25
28
  const SELECTED_CONTEXT_ITEMS_DEFAULT_COLLAPSED = true;
26
29