@gitlab/duo-ui 14.0.0 → 14.1.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.
- package/CHANGELOG.md +20 -0
- package/dist/components/agentic_chat/web_agentic_duo_chat.js +1 -1
- package/dist/components/chat/components/duo_chat_header/web_duo_chat_header.js +1 -1
- package/dist/components/chat/components/duo_chat_message_tool_approval/components/base_tool_params.js +167 -5
- package/dist/components/chat/components/duo_chat_message_tool_approval/components/create_commit_tool_params.js +12 -18
- package/dist/components/chat/components/duo_chat_message_tool_approval/components/default_tool_params.js +89 -0
- package/dist/components/chat/components/duo_chat_message_tool_approval/components/tool_params_json_view.js +63 -0
- package/dist/components/chat/components/duo_chat_message_tool_approval/message_tool_approval.js +8 -40
- package/dist/components/chat/mock_data.js +18 -2
- package/dist/components/chat/web_duo_chat.js +1 -1
- package/package.json +1 -1
- package/src/components/agentic_chat/web_agentic_duo_chat.vue +1 -0
- package/src/components/chat/components/duo_chat_header/web_duo_chat_header.vue +3 -2
- package/src/components/chat/components/duo_chat_message_tool_approval/components/base_tool_params.vue +138 -10
- package/src/components/chat/components/duo_chat_message_tool_approval/components/create_commit_tool_params.vue +14 -16
- package/src/components/chat/components/duo_chat_message_tool_approval/components/default_tool_params.vue +72 -0
- package/src/components/chat/components/duo_chat_message_tool_approval/components/tool_params_json_view.vue +42 -0
- package/src/components/chat/components/duo_chat_message_tool_approval/message_tool_approval.vue +7 -99
- package/src/components/chat/mock_data.js +18 -0
- package/src/components/chat/web_duo_chat.vue +1 -0
- package/translations.js +23 -40
- package/dist/components/chat/components/duo_chat_message_tool_approval/components/issuable_tool_params.js +0 -174
- package/src/components/chat/components/duo_chat_message_tool_approval/components/issuable_tool_params.vue +0 -193
|
@@ -179,6 +179,21 @@ const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_MERGE_REQUEST = {
|
|
|
179
179
|
status: 'success',
|
|
180
180
|
role: 'request'
|
|
181
181
|
};
|
|
182
|
+
const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_UPDATE_MERGE_REQUEST = {
|
|
183
|
+
id: '125',
|
|
184
|
+
content: 'Tool update_merge_request requires approval. Please confirm if you want to proceed.',
|
|
185
|
+
message_type: MESSAGE_MODEL_ROLES.request,
|
|
186
|
+
tool_info: {
|
|
187
|
+
name: 'update_merge_request',
|
|
188
|
+
args: {
|
|
189
|
+
url: 'https://gitlab.com/gitlab-org/editor-extensions/gitlab-language-server/-/merge_requests/123',
|
|
190
|
+
description: '## What does this MR do?\n\nThis MR updates the `group` field in the `web_ide_language_server` beta feature flag configuration from `group::remote development` to `group:: editor extensions`.\n\n## Related issues\n\nThis change aligns the feature flag with the correct group ownership.\n\n## Changes made\n\n- Updated `config/feature_flags/beta/web_ide_language_server.yml`\n- Changed group field from `group::remote development` to `group:: editor extensions`\n\n## Checklist\n\n- [x] Feature flag configuration updated\n- [x] Group field correctly set to `group:: editor extensions`'
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
timestamp: '2025-06-25T19:22:21.290791+00:00',
|
|
194
|
+
status: 'success',
|
|
195
|
+
role: 'request'
|
|
196
|
+
};
|
|
182
197
|
const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_COMMAND = {
|
|
183
198
|
id: '125',
|
|
184
199
|
content: 'Tool run_command requires approval. Please confirm if you want to proceed.',
|
|
@@ -386,7 +401,8 @@ const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_WORK_ITEM = {
|
|
|
386
401
|
type_name: 'Issue',
|
|
387
402
|
description: '## Overview\n\nUsers have requested the ability to toggle between light and dark modes in the chat interface to improve usability in different lighting conditions.\n\n## Requirements\n\n- [ ] Add a toggle button in the chat header\n- [ ] Implement theme switching logic\n- [ ] Persist user preference in localStorage\n- [ ] Ensure all chat components support both themes\n- [ ] Update existing CSS variables for dark mode\n\n## Acceptance Criteria\n\n- Toggle button is visible and accessible\n- Theme changes are applied immediately\n- User preference is remembered across sessions\n- All text remains readable in both modes\n- Icons and UI elements adapt to the selected theme',
|
|
388
403
|
labels: ['enhancement', 'ui', 'accessibility'],
|
|
389
|
-
assignee_ids: [123]
|
|
404
|
+
assignee_ids: [123],
|
|
405
|
+
confidential: true
|
|
390
406
|
}
|
|
391
407
|
},
|
|
392
408
|
timestamp: '2025-06-25T19:22:21.290791+00:00',
|
|
@@ -771,4 +787,4 @@ const AGENTIC_THREADLIST = [{
|
|
|
771
787
|
}
|
|
772
788
|
}];
|
|
773
789
|
|
|
774
|
-
export { AGENTIC_THREADLIST, INCLUDE_SLASH_COMMAND, MOCK_AGENT_MESSAGE, MOCK_REQUEST_MESSAGE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_COMMIT, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_COMMIT_AUTO_BRANCH, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_COMMIT_MESSAGE_ONLY, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_COMMIT_OLD_NEW_CONTENT, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_EPIC, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_ISSUE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_ISSUE_NOTE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_MERGE_REQUEST, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_MERGE_REQUEST_NOTE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_WORK_ITEM, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_WORK_ITEM_NOTE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_PARAMS, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_COMMAND, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_COMMAND_WITH_RESPONSE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_GIT_COMMAND, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_UPDATE_ISSUE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_UPDATE_WORK_ITEM, MOCK_RESPONSE_MESSAGE, MOCK_RESPONSE_MESSAGE_FOR_STREAMING, MOCK_TOOL_MESSAGE, MOCK_TOOL_MESSAGE_WITH_LINK, MOCK_TOOL_MESSAGE_WITH_REQUEST_AND_RESPONSE_DETAILS, MOCK_USER_PROMPT_MESSAGE, MOCK_WORKFLOW_END_MESSAGE, SLASH_COMMANDS, THREADLIST, generateMockResponseChunks, generateSeparateChunks, renderGFM, renderMarkdown };
|
|
790
|
+
export { AGENTIC_THREADLIST, INCLUDE_SLASH_COMMAND, MOCK_AGENT_MESSAGE, MOCK_REQUEST_MESSAGE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_COMMIT, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_COMMIT_AUTO_BRANCH, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_COMMIT_MESSAGE_ONLY, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_COMMIT_OLD_NEW_CONTENT, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_EPIC, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_ISSUE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_ISSUE_NOTE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_MERGE_REQUEST, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_MERGE_REQUEST_NOTE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_WORK_ITEM, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_WORK_ITEM_NOTE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_PARAMS, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_COMMAND, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_COMMAND_WITH_RESPONSE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_GIT_COMMAND, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_UPDATE_ISSUE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_UPDATE_MERGE_REQUEST, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_UPDATE_WORK_ITEM, MOCK_RESPONSE_MESSAGE, MOCK_RESPONSE_MESSAGE_FOR_STREAMING, MOCK_TOOL_MESSAGE, MOCK_TOOL_MESSAGE_WITH_LINK, MOCK_TOOL_MESSAGE_WITH_REQUEST_AND_RESPONSE_DETAILS, MOCK_USER_PROMPT_MESSAGE, MOCK_WORKFLOW_END_MESSAGE, SLASH_COMMANDS, THREADLIST, generateMockResponseChunks, generateSeparateChunks, renderGFM, renderMarkdown };
|
|
@@ -631,7 +631,7 @@ var script = {
|
|
|
631
631
|
const __vue_script__ = script;
|
|
632
632
|
|
|
633
633
|
/* template */
|
|
634
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"markdown-code-block duo-chat web-only gl-bottom-0 gl-flex gl-max-h-full gl-flex-col",attrs:{"id":"chat-component","role":"complementary","data-testid":"chat-component"}},[(_vm.showHeader)?_c('web-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,"is-multithreaded":_vm.isMultithreaded,"current-view":_vm.currentView,"should-render-resizable":_vm.shouldRenderResizable,"badge-type":_vm.isMultithreaded ? null : _vm.badgeType,"show-studio-header":_vm.showStudioHeader},on:{"go-back":_vm.onGoBack,"go-back-to-chat":_vm.onGoBackToChat,"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-flex gl-flex-1 gl-flex-grow gl-flex-col gl-overflow-y-auto gl-overscroll-contain gl-bg-inherit",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-mt-auto gl-px-4 gl-pb-4 gl-pt-6",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,"trusted-urls":_vm.trustedUrls},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}})}),_vm._v(" "),(!_vm.hasMessages && !_vm.isLoading)?[_c('div',{key:"empty-state-message",staticClass:"duo-chat-message gl-rounded-bl-none gl-leading-20 gl-text-gray-900 gl-break-anywhere",attrs:{"data-testid":"gl-duo-chat-empty-state"}},[(_vm.emptyStateTitle)?[_c('div',{staticClass:"gl-heading-display"},[_vm._v("👋")]),_vm._v(" "),_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}})],2)]:_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-relative gl-z-2 gl-shrink-0",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('div',{staticClass:"duo-chat-input gl-relative gl-min-h-8 gl-max-w-full gl-grow gl-flex-col gl-rounded-bl-[12px] gl-rounded-br-[18px] gl-rounded-tl-[12px] gl-rounded-tr-[12px] gl-align-top forced-colors:gl-border"},[_c('div',{staticClass:"gl-flex gl-justify-between gl-border-0 gl-border-b-1 gl-border-solid gl-border-strong gl-px-4 gl-py-4 forced-colors:gl-border-none"},[_c('div',[_vm._v(_vm._s(_vm.$options.i18n.CHAT_MODEL_PLACEHOLDER))]),_vm._v(" "),_c('div',[_vm._t("agentic-switch")],2)]),_vm._v(" "),_c('div',{staticClass:"gl-h-[80px] gl-grow",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",attrs:{"data-testid":"chat-prompt-input","textarea-classes":[
|
|
634
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"markdown-code-block duo-chat web-only gl-bottom-0 gl-flex gl-max-h-full gl-flex-col",attrs:{"id":"chat-component","role":"complementary","data-testid":"chat-component"}},[(_vm.showHeader)?_c('web-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,"is-multithreaded":_vm.isMultithreaded,"current-view":_vm.currentView,"should-render-resizable":_vm.shouldRenderResizable,"badge-type":_vm.isMultithreaded ? null : _vm.badgeType,"show-studio-header":_vm.showStudioHeader},on:{"go-back":_vm.onGoBack,"go-back-to-chat":_vm.onGoBackToChat,"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-flex gl-flex-1 gl-flex-grow gl-flex-col gl-overflow-y-auto gl-overscroll-contain gl-bg-inherit",class:{ 'gl-border-t': !_vm.showStudioHeader },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-mt-auto gl-px-4 gl-pb-4 gl-pt-6",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,"trusted-urls":_vm.trustedUrls},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}})}),_vm._v(" "),(!_vm.hasMessages && !_vm.isLoading)?[_c('div',{key:"empty-state-message",staticClass:"duo-chat-message gl-rounded-bl-none gl-leading-20 gl-text-gray-900 gl-break-anywhere",attrs:{"data-testid":"gl-duo-chat-empty-state"}},[(_vm.emptyStateTitle)?[_c('div',{staticClass:"gl-heading-display"},[_vm._v("👋")]),_vm._v(" "),_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}})],2)]:_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-relative gl-z-2 gl-shrink-0",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('div',{staticClass:"duo-chat-input gl-relative gl-min-h-8 gl-max-w-full gl-grow gl-flex-col gl-rounded-bl-[12px] gl-rounded-br-[18px] gl-rounded-tl-[12px] gl-rounded-tr-[12px] gl-align-top forced-colors:gl-border"},[_c('div',{staticClass:"gl-flex gl-justify-between gl-border-0 gl-border-b-1 gl-border-solid gl-border-strong gl-px-4 gl-py-4 forced-colors:gl-border-none"},[_c('div',[_vm._v(_vm._s(_vm.$options.i18n.CHAT_MODEL_PLACEHOLDER))]),_vm._v(" "),_c('div',[_vm._t("agentic-switch")],2)]),_vm._v(" "),_c('div',{staticClass:"gl-h-[80px] gl-grow",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",attrs:{"data-testid":"chat-prompt-input","textarea-classes":[
|
|
635
635
|
'!gl-h-full',
|
|
636
636
|
'!gl-bg-transparent',
|
|
637
637
|
'!gl-py-4',
|
package/package.json
CHANGED
|
@@ -840,6 +840,7 @@ export default {
|
|
|
840
840
|
</web-duo-chat-header>
|
|
841
841
|
|
|
842
842
|
<div
|
|
843
|
+
:class="{ 'gl-border-t': !showStudioHeader }"
|
|
843
844
|
class="gl-flex gl-flex-1 gl-flex-grow gl-flex-col gl-overflow-y-auto gl-overscroll-contain gl-bg-inherit"
|
|
844
845
|
data-testid="chat-history"
|
|
845
846
|
@scroll="handleScrollingThrottled"
|
|
@@ -173,7 +173,7 @@ export default {
|
|
|
173
173
|
</script>
|
|
174
174
|
|
|
175
175
|
<template>
|
|
176
|
-
<header data-testid="chat-header" class="gl-
|
|
176
|
+
<header data-testid="chat-header" class="gl-shrink-0 gl-p-0">
|
|
177
177
|
<div
|
|
178
178
|
v-if="!showStudioHeader"
|
|
179
179
|
class="gl-flex gl-w-full gl-items-center gl-px-4 gl-py-3"
|
|
@@ -213,7 +213,8 @@ export default {
|
|
|
213
213
|
</div>
|
|
214
214
|
<div
|
|
215
215
|
v-if="showSubheader"
|
|
216
|
-
class="drawer-title gl-
|
|
216
|
+
class="drawer-title gl-flex gl-items-center gl-justify-start gl-gap-4 gl-px-4 gl-py-3"
|
|
217
|
+
:class="{ 'gl-border-t': !showStudioHeader, 'gl-border-b': showStudioHeader }"
|
|
217
218
|
data-testid="chat-subheader"
|
|
218
219
|
>
|
|
219
220
|
<div class="gl-flex gl-grow gl-gap-3">
|
|
@@ -1,14 +1,68 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { GlAccordion, GlAccordionItem, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
|
|
2
|
+
import { GlAccordion, GlAccordionItem, GlBadge, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
|
|
3
3
|
import { translate } from '../../../../../utils/i18n';
|
|
4
4
|
import PreBlock from './pre_block.vue';
|
|
5
|
+
import ToolParamsJsonView from './tool_params_json_view.vue';
|
|
6
|
+
|
|
7
|
+
const projectLabel = translate('BaseToolParams.projectLabel', 'Project');
|
|
8
|
+
const groupLabel = translate('BaseToolParams.groupLabel', 'Group');
|
|
9
|
+
const issueLabel = translate('BaseToolParams.issueLabel', 'Issue');
|
|
10
|
+
const mergeRequestLabel = translate('BaseToolParams.mergeRequestLabel', 'Merge request');
|
|
11
|
+
const workItemLabel = translate('BaseToolParams.workItemLabel', 'Work item');
|
|
12
|
+
const epicLabel = translate('BaseToolParams.epicLabel', 'Epic');
|
|
13
|
+
const sourceBranchLabel = translate('BaseToolParams.sourceBranchLabel', 'Source branch');
|
|
14
|
+
const targetBranchLabel = translate('BaseToolParams.targetBranchLabel', 'Target branch');
|
|
15
|
+
const startDateLabel = translate('BaseToolParams.startDateLabel', 'Start date');
|
|
16
|
+
const dueDateLabel = translate('BaseToolParams.dueDateLabel', 'Due date');
|
|
17
|
+
const healthStatusLabel = translate('BaseToolParams.healthStatusLabel', 'Health status');
|
|
18
|
+
const labelsLabel = translate('BaseToolParams.labelsLabel', 'Labels');
|
|
19
|
+
const vulnerabilityLabel = translate('BaseToolParams.vulnerabilityLabel', 'Vulnerability');
|
|
20
|
+
const dismissalReasonLabel = translate('BaseToolParams.dismissalReasonLabel', 'Dismissal reason');
|
|
21
|
+
const stateLabel = translate('BaseToolParams.stateLabel', 'State');
|
|
22
|
+
const confidentialLabel = translate('BaseToolParams.confidentialLabel', 'Confidential');
|
|
23
|
+
const typeLabel = translate('BaseToolParams.typeLabel', 'Type');
|
|
24
|
+
|
|
25
|
+
const metadataProperties = {
|
|
26
|
+
projectId: {
|
|
27
|
+
icon: 'project',
|
|
28
|
+
label: projectLabel,
|
|
29
|
+
},
|
|
30
|
+
projectPath: { icon: 'project', label: projectLabel },
|
|
31
|
+
projectFullPath: { icon: 'project', label: projectLabel },
|
|
32
|
+
groupId: { icon: 'group', label: groupLabel },
|
|
33
|
+
groupPath: { icon: 'group', label: groupLabel },
|
|
34
|
+
issueId: { icon: 'issues', label: issueLabel },
|
|
35
|
+
issueIid: { icon: 'issues', label: issueLabel },
|
|
36
|
+
mergeRequestId: { icon: 'merge-request', label: mergeRequestLabel },
|
|
37
|
+
mergeRequestIid: { icon: 'merge-request', label: mergeRequestLabel },
|
|
38
|
+
workItemIid: { icon: 'work-items', label: workItemLabel },
|
|
39
|
+
epicIid: { icon: 'epics', label: epicLabel },
|
|
40
|
+
sourceBranch: { icon: 'branch', label: sourceBranchLabel },
|
|
41
|
+
targetBranch: { icon: 'branch', label: targetBranchLabel },
|
|
42
|
+
url: { icon: 'external-link', type: 'url' },
|
|
43
|
+
startDate: { icon: 'calendar', label: startDateLabel },
|
|
44
|
+
dueDate: { icon: 'calendar', label: dueDateLabel },
|
|
45
|
+
healthStatus: { icon: 'status-health', label: healthStatusLabel },
|
|
46
|
+
state: {
|
|
47
|
+
label: stateLabel,
|
|
48
|
+
icon: (value) => (value === 'opened' ? 'status_open' : 'status_closed'),
|
|
49
|
+
},
|
|
50
|
+
labels: { icon: 'labels', label: labelsLabel },
|
|
51
|
+
addLabelIds: { icon: 'labels', label: labelsLabel },
|
|
52
|
+
confidential: { icon: (value) => (value ? 'eye-slash' : 'eye'), label: confidentialLabel },
|
|
53
|
+
typeName: { icon: (value) => `work-item-${value.toLowerCase()}`, label: typeLabel },
|
|
54
|
+
vulnerabilityId: { label: vulnerabilityLabel },
|
|
55
|
+
dismissalReason: { icon: 'information', label: dismissalReasonLabel },
|
|
56
|
+
};
|
|
5
57
|
|
|
6
58
|
export default {
|
|
7
59
|
name: 'BaseToolParams',
|
|
8
60
|
components: {
|
|
9
61
|
GlAccordion,
|
|
10
62
|
GlAccordionItem,
|
|
63
|
+
GlBadge,
|
|
11
64
|
PreBlock,
|
|
65
|
+
ToolParamsJsonView,
|
|
12
66
|
},
|
|
13
67
|
directives: {
|
|
14
68
|
SafeHtml,
|
|
@@ -24,32 +78,106 @@ export default {
|
|
|
24
78
|
required: false,
|
|
25
79
|
default: '',
|
|
26
80
|
},
|
|
81
|
+
toolParams: {
|
|
82
|
+
type: Object,
|
|
83
|
+
required: false,
|
|
84
|
+
default: () => {},
|
|
85
|
+
},
|
|
27
86
|
customAccordionTitle: {
|
|
28
87
|
type: String,
|
|
29
88
|
required: false,
|
|
30
89
|
default: '',
|
|
31
90
|
},
|
|
91
|
+
withJsonView: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
required: false,
|
|
94
|
+
default: false,
|
|
95
|
+
},
|
|
32
96
|
},
|
|
33
97
|
computed: {
|
|
34
98
|
accordionTitle() {
|
|
35
|
-
return this.customAccordionTitle || this.$options.i18n.
|
|
99
|
+
return this.customAccordionTitle || this.$options.i18n.DESCRIPTION_ACCORDION_TITLE;
|
|
100
|
+
},
|
|
101
|
+
metadataProperties() {
|
|
102
|
+
const toolParams = this.toolParams || {};
|
|
103
|
+
|
|
104
|
+
return Object.entries(metadataProperties)
|
|
105
|
+
.filter(([property]) => toolParams[property])
|
|
106
|
+
.map(([property, styles]) => ({
|
|
107
|
+
key: property,
|
|
108
|
+
value: toolParams[property],
|
|
109
|
+
...styles,
|
|
110
|
+
}));
|
|
111
|
+
},
|
|
112
|
+
hasMetadataProperties() {
|
|
113
|
+
return this.metadataProperties.length > 0;
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
methods: {
|
|
117
|
+
formatPropertyValue(value) {
|
|
118
|
+
if (Array.isArray(value)) {
|
|
119
|
+
return value.join(', ');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (typeof value === 'boolean') {
|
|
123
|
+
return value ? translate('Yes', 'Yes') : translate('No', 'No');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return value;
|
|
127
|
+
},
|
|
128
|
+
processPropertyIcon(icon, propertyValue) {
|
|
129
|
+
if (typeof icon === 'function') {
|
|
130
|
+
return icon(propertyValue);
|
|
131
|
+
}
|
|
132
|
+
return icon;
|
|
36
133
|
},
|
|
37
134
|
},
|
|
38
135
|
i18n: {
|
|
39
|
-
|
|
136
|
+
DESCRIPTION_ACCORDION_TITLE: translate(
|
|
137
|
+
'BaseToolParams.ExpandDescriptionTitle',
|
|
138
|
+
'Read description'
|
|
139
|
+
),
|
|
140
|
+
EXPAND_JSON_VIEW_TITLE: translate(
|
|
141
|
+
'BaseToolParams.ExpandJsonViewTitle',
|
|
142
|
+
'See request parameters as JSON'
|
|
143
|
+
),
|
|
40
144
|
},
|
|
41
145
|
};
|
|
42
146
|
</script>
|
|
43
147
|
<template>
|
|
44
|
-
<div class="gl-flex gl-flex-col">
|
|
148
|
+
<div class="gl-flex gl-flex-col gl-gap-3">
|
|
149
|
+
<div v-if="hasMetadataProperties" class="gl-flex gl-flex-wrap gl-gap-2">
|
|
150
|
+
<span v-for="property in metadataProperties" :key="property.key" class="gl-overflow-hidden">
|
|
151
|
+
<gl-badge
|
|
152
|
+
v-if="property.type == 'url'"
|
|
153
|
+
:icon="property.icon"
|
|
154
|
+
:href="property.value"
|
|
155
|
+
:title="property.value"
|
|
156
|
+
>
|
|
157
|
+
<span class="gl-truncate">
|
|
158
|
+
{{ property.value }}
|
|
159
|
+
</span>
|
|
160
|
+
</gl-badge>
|
|
161
|
+
<gl-badge v-else :icon="processPropertyIcon(property.icon, property.value)">
|
|
162
|
+
{{ property.label }}: {{ formatPropertyValue(property.value) }}
|
|
163
|
+
</gl-badge>
|
|
164
|
+
</span>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
45
167
|
<div v-if="message" v-safe-html="message"></div>
|
|
46
168
|
<slot v-else></slot>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
169
|
+
|
|
170
|
+
<gl-accordion v-if="message || description" class="-gl-ml-2" :header-level="3">
|
|
171
|
+
<gl-accordion-item v-if="description" class="gl-mb-3" :title="accordionTitle">
|
|
172
|
+
<pre-block>{{ description }}</pre-block>
|
|
173
|
+
</gl-accordion-item>
|
|
174
|
+
<gl-accordion-item v-if="withJsonView" :title="$options.i18n.EXPAND_JSON_VIEW_TITLE">
|
|
175
|
+
<tool-params-json-view :tool-params="toolParams" />
|
|
176
|
+
</gl-accordion-item>
|
|
53
177
|
</gl-accordion>
|
|
178
|
+
<tool-params-json-view
|
|
179
|
+
v-else-if="!message && !description && withJsonView"
|
|
180
|
+
:tool-params="toolParams"
|
|
181
|
+
/>
|
|
54
182
|
</div>
|
|
55
183
|
</template>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { GlSprintf, GlAccordion, GlAccordionItem } from '@gitlab/ui';
|
|
3
3
|
import { createPatch } from 'diff';
|
|
4
4
|
import { translate, translatePlural, sprintf } from '../../../../../utils/i18n';
|
|
5
|
+
import BaseToolParams from './base_tool_params.vue';
|
|
5
6
|
import PreBlock from './pre_block.vue';
|
|
6
7
|
|
|
7
8
|
const NO_NEW_LINE_SIGNAL = '\';
|
|
@@ -12,6 +13,7 @@ export default {
|
|
|
12
13
|
GlSprintf,
|
|
13
14
|
GlAccordion,
|
|
14
15
|
GlAccordionItem,
|
|
16
|
+
BaseToolParams,
|
|
15
17
|
PreBlock,
|
|
16
18
|
},
|
|
17
19
|
props: {
|
|
@@ -21,15 +23,9 @@ export default {
|
|
|
21
23
|
},
|
|
22
24
|
},
|
|
23
25
|
computed: {
|
|
24
|
-
project() {
|
|
25
|
-
return this.toolParams?.projectPath || this.toolParams?.projectId || '';
|
|
26
|
-
},
|
|
27
26
|
branch() {
|
|
28
27
|
return this.toolParams?.branch;
|
|
29
28
|
},
|
|
30
|
-
startBranch() {
|
|
31
|
-
return this.toolParams?.startBranch || '';
|
|
32
|
-
},
|
|
33
29
|
commitMessage() {
|
|
34
30
|
return this.toolParams?.commitMessage;
|
|
35
31
|
},
|
|
@@ -108,11 +104,11 @@ export default {
|
|
|
108
104
|
i18n: {
|
|
109
105
|
COMMIT_SUMMARY_MESSAGE: translate(
|
|
110
106
|
'CreateCommitToolParams.commitSummaryMessage',
|
|
111
|
-
'Create a commit in the branch %{branch}
|
|
107
|
+
'Create a commit in the branch %{branch}.'
|
|
112
108
|
),
|
|
113
109
|
COMMIT_SUMMARY_AUTO_BRANCH_MESSAGE: translate(
|
|
114
110
|
'CreateCommitToolParams.commitSummaryAutoBranchMessage',
|
|
115
|
-
'Create a commit in a new auto-created branch
|
|
111
|
+
'Create a commit in a new auto-created branch.'
|
|
116
112
|
),
|
|
117
113
|
READ_COMMIT_MESSAGE: translate(
|
|
118
114
|
'CreateCommitToolParams.readCommitMessage',
|
|
@@ -151,7 +147,7 @@ export default {
|
|
|
151
147
|
};
|
|
152
148
|
</script>
|
|
153
149
|
<template>
|
|
154
|
-
<
|
|
150
|
+
<base-tool-params :tool-params="toolParams">
|
|
155
151
|
<div>
|
|
156
152
|
<gl-sprintf
|
|
157
153
|
:message="
|
|
@@ -160,17 +156,18 @@ export default {
|
|
|
160
156
|
: $options.i18n.COMMIT_SUMMARY_AUTO_BRANCH_MESSAGE
|
|
161
157
|
"
|
|
162
158
|
>
|
|
163
|
-
<template #project>
|
|
164
|
-
<code>{{ project }}</code>
|
|
165
|
-
</template>
|
|
166
159
|
<template v-if="branch" #branch>
|
|
167
160
|
<code>{{ branch }}</code>
|
|
168
161
|
</template>
|
|
169
162
|
</gl-sprintf>
|
|
170
163
|
{{ actionsCountMessage }}
|
|
171
164
|
</div>
|
|
172
|
-
<gl-accordion class="-gl-ml-2
|
|
173
|
-
<gl-accordion-item
|
|
165
|
+
<gl-accordion class="-gl-ml-2" :header-level="3">
|
|
166
|
+
<gl-accordion-item
|
|
167
|
+
v-if="commitMessage"
|
|
168
|
+
class="gl-mb-3"
|
|
169
|
+
:title="$options.i18n.READ_COMMIT_MESSAGE"
|
|
170
|
+
>
|
|
174
171
|
<pre-block>{{ commitMessage }}</pre-block>
|
|
175
172
|
</gl-accordion-item>
|
|
176
173
|
<gl-accordion-item v-if="actionsCount" :title="$options.i18n.EXPAND_CHANGES">
|
|
@@ -178,12 +175,13 @@ export default {
|
|
|
178
175
|
<gl-accordion-item
|
|
179
176
|
v-for="(action, index) in actions"
|
|
180
177
|
:key="index"
|
|
178
|
+
class="gl-mb-3"
|
|
181
179
|
:title="getActionTitle(action)"
|
|
182
180
|
>
|
|
183
|
-
<pre-block>{{ getActionContent(action) }}</pre-block>
|
|
181
|
+
<pre-block class="language-diff">{{ getActionContent(action) }}</pre-block>
|
|
184
182
|
</gl-accordion-item>
|
|
185
183
|
</gl-accordion>
|
|
186
184
|
</gl-accordion-item>
|
|
187
185
|
</gl-accordion>
|
|
188
|
-
</
|
|
186
|
+
</base-tool-params>
|
|
189
187
|
</template>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { sprintf, translate } from '../../../../../utils/i18n';
|
|
3
|
+
import { APPROVAL_TOOL_NAMES } from '../../../constants';
|
|
4
|
+
import BaseToolParams from './base_tool_params.vue';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
name: 'DefaultToolParams',
|
|
8
|
+
components: {
|
|
9
|
+
BaseToolParams,
|
|
10
|
+
},
|
|
11
|
+
props: {
|
|
12
|
+
toolName: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: false,
|
|
15
|
+
default: '',
|
|
16
|
+
},
|
|
17
|
+
toolParams: {
|
|
18
|
+
type: Object,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
computed: {
|
|
23
|
+
title() {
|
|
24
|
+
return this.toolParams?.title;
|
|
25
|
+
},
|
|
26
|
+
description() {
|
|
27
|
+
return this.toolParams?.description || this.toolParams?.body || this.toolParams?.comment;
|
|
28
|
+
},
|
|
29
|
+
isNote() {
|
|
30
|
+
return [
|
|
31
|
+
APPROVAL_TOOL_NAMES.createMergeRequestNote,
|
|
32
|
+
APPROVAL_TOOL_NAMES.createWorkItemNote,
|
|
33
|
+
APPROVAL_TOOL_NAMES.createIssueNote,
|
|
34
|
+
].includes(this.toolName);
|
|
35
|
+
},
|
|
36
|
+
message() {
|
|
37
|
+
const message = this.title ? this.$options.i18n.TITLE_MESSAGE : '';
|
|
38
|
+
|
|
39
|
+
return sprintf(message, {
|
|
40
|
+
...this.toolParams,
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
accordionTitle() {
|
|
44
|
+
return this.isNote ? this.$options.i18n.NOTE_ACCORDION_TITLE : '';
|
|
45
|
+
},
|
|
46
|
+
displayRawOutput() {
|
|
47
|
+
return !this.message;
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
i18n: {
|
|
51
|
+
TITLE_MESSAGE: translate(
|
|
52
|
+
'IssuableToolParams.TITLE_MESSAGE',
|
|
53
|
+
'Set the title "<em>%{title}</em>".'
|
|
54
|
+
),
|
|
55
|
+
NOTE_ACCORDION_TITLE: translate(
|
|
56
|
+
'IssuableToolParams.NOTE_ACCORDION_TITLE',
|
|
57
|
+
"Read note's content"
|
|
58
|
+
),
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
</script>
|
|
62
|
+
<template>
|
|
63
|
+
<div>
|
|
64
|
+
<base-tool-params
|
|
65
|
+
with-json-view
|
|
66
|
+
:tool-params="toolParams"
|
|
67
|
+
:message="message"
|
|
68
|
+
:description="description"
|
|
69
|
+
:custom-accordion-title="accordionTitle"
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { translate } from '../../../../../utils/i18n';
|
|
3
|
+
import PreBlock from './pre_block.vue';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
name: 'ToolParamsJsonView',
|
|
7
|
+
components: {
|
|
8
|
+
PreBlock,
|
|
9
|
+
},
|
|
10
|
+
props: {
|
|
11
|
+
toolParams: {
|
|
12
|
+
type: Object,
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
computed: {
|
|
17
|
+
hasToolParams() {
|
|
18
|
+
return Object.keys(this.toolParams || {}).length > 0;
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
i18n: {
|
|
22
|
+
REQUEST_TEXT: translate('MessageToolApproval.parametersText', 'Request parameters'),
|
|
23
|
+
NO_PARAMETERS_TEXT: translate(
|
|
24
|
+
'MessageToolApproval.noParametersText',
|
|
25
|
+
'No parameters will be sent with this request.'
|
|
26
|
+
),
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
</script>
|
|
30
|
+
<template>
|
|
31
|
+
<figure class="gl-m-0 gl-flex gl-flex-col gl-gap-2">
|
|
32
|
+
<figcaption class="gl-text-subtle">
|
|
33
|
+
{{ $options.i18n.REQUEST_TEXT }}
|
|
34
|
+
</figcaption>
|
|
35
|
+
<pre-block v-if="hasToolParams" class="language-json" data-testid="tool-parameters">{{
|
|
36
|
+
JSON.stringify(toolParams, null, 2)
|
|
37
|
+
}}</pre-block>
|
|
38
|
+
<span v-else class="gl-text-sm gl-text-gray-500" data-testid="no-parameters-message">
|
|
39
|
+
{{ $options.i18n.NO_PARAMETERS_TEXT }}
|
|
40
|
+
</span>
|
|
41
|
+
</figure>
|
|
42
|
+
</template>
|