@gitlab/duo-ui 10.23.1 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/components/agentic_chat/web_agentic_duo_chat.js +725 -0
- package/dist/components/chat/components/duo_chat_header/web_duo_chat_header.js +161 -0
- package/dist/components/chat/web_duo_chat.js +658 -0
- package/dist/components/ui/duo_layout/duo_layout.js +100 -0
- package/dist/components/ui/side_rail/side_rail.js +67 -0
- package/dist/index.js +4 -0
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/package.json +2 -1
- package/src/components/agentic_chat/web_agentic_duo_chat.vue +978 -0
- package/src/components/chat/components/duo_chat_header/web_duo_chat_header.vue +274 -0
- package/src/components/chat/web_duo_chat.vue +891 -0
- package/src/components/ui/duo_layout/duo_layout.md +0 -0
- package/src/components/ui/duo_layout/duo_layout.vue +95 -0
- package/src/components/ui/side_rail/side_rail.vue +56 -0
- package/src/index.js +5 -0
- package/translations.js +42 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
import { GlToast, GlAlert, GlBadge, GlAvatar, GlButton, GlDropdown, GlDropdownItem, GlDisclosureDropdown, GlSafeHtmlDirective, GlTooltipDirective } from '@gitlab/ui';
|
|
3
|
+
import { translate } from '../../../../utils/i18n';
|
|
4
|
+
import { VIEW_TYPES } from './constants';
|
|
5
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
6
|
+
|
|
7
|
+
const i18n = {
|
|
8
|
+
CHAT_BACK_LABEL: translate('WebDuoChat.chatBackLabel', 'Back to history'),
|
|
9
|
+
CHAT_CLOSE_LABEL: translate('WebDuoChat.closeChatHeaderLabel', 'Close chat'),
|
|
10
|
+
CHAT_NEW_LABEL: translate('WebDuoChat.chatNewLabel', 'New chat'),
|
|
11
|
+
CHAT_NEW_TOOLTIP: translate('WebDuoChat.chatNewToolTip', 'New chat'),
|
|
12
|
+
CHAT_HISTORY_TOOLTIP: translate('WebDuoChat.chatHistoryToolTip', 'Chat history'),
|
|
13
|
+
CHAT_BACK_TO_CHAT_TOOLTIP: translate('WebDuoChat.chatBackToChatToolTip', 'Back to chat'),
|
|
14
|
+
CHAT_TITLE: translate('WebDuoChat.chatTitle', 'GitLab Duo Chat'),
|
|
15
|
+
CHAT_DROPDOWN_MORE_OPTIONS: translate('WebDuoChat.chatDropdownMoreOptions', 'More options'),
|
|
16
|
+
CHAT_COPY_TOOLTIP: translate('WebDuoChat.copySessionIdTooltip', 'Copy session ID'),
|
|
17
|
+
CHAT_COPY_SUCCESS_TOAST: translate('WebDuoChat.copySessionIdSuccessToast', 'Session ID copied to clipboard'),
|
|
18
|
+
CHAT_COPY_FAILED_TOAST: translate('WebDuoChat.copySessionIdFailedToast', 'Could not copy session ID')
|
|
19
|
+
};
|
|
20
|
+
Vue.use(GlToast);
|
|
21
|
+
var script = {
|
|
22
|
+
name: 'DuoChatHeader',
|
|
23
|
+
components: {
|
|
24
|
+
GlAlert,
|
|
25
|
+
GlBadge,
|
|
26
|
+
GlAvatar,
|
|
27
|
+
GlButton,
|
|
28
|
+
GlDropdown,
|
|
29
|
+
GlDropdownItem,
|
|
30
|
+
GlDisclosureDropdown
|
|
31
|
+
},
|
|
32
|
+
directives: {
|
|
33
|
+
SafeHtml: GlSafeHtmlDirective,
|
|
34
|
+
GlTooltip: GlTooltipDirective
|
|
35
|
+
},
|
|
36
|
+
props: {
|
|
37
|
+
title: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: false,
|
|
40
|
+
default: i18n.CHAT_TITLE
|
|
41
|
+
},
|
|
42
|
+
subtitle: {
|
|
43
|
+
type: String,
|
|
44
|
+
required: false,
|
|
45
|
+
default: ''
|
|
46
|
+
},
|
|
47
|
+
sessionId: {
|
|
48
|
+
type: String,
|
|
49
|
+
required: false,
|
|
50
|
+
default: ''
|
|
51
|
+
},
|
|
52
|
+
error: {
|
|
53
|
+
type: String,
|
|
54
|
+
required: false,
|
|
55
|
+
default: ''
|
|
56
|
+
},
|
|
57
|
+
isMultithreaded: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
required: false,
|
|
60
|
+
default: false
|
|
61
|
+
},
|
|
62
|
+
shouldRenderResizable: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
required: false,
|
|
65
|
+
default: false
|
|
66
|
+
},
|
|
67
|
+
activeThreadId: {
|
|
68
|
+
type: String,
|
|
69
|
+
required: false,
|
|
70
|
+
default: null
|
|
71
|
+
},
|
|
72
|
+
badgeType: {
|
|
73
|
+
type: String,
|
|
74
|
+
required: false,
|
|
75
|
+
default: null
|
|
76
|
+
},
|
|
77
|
+
currentView: {
|
|
78
|
+
type: String,
|
|
79
|
+
required: true
|
|
80
|
+
},
|
|
81
|
+
agents: {
|
|
82
|
+
type: Array,
|
|
83
|
+
required: false,
|
|
84
|
+
default: () => []
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
computed: {
|
|
88
|
+
VIEW_TYPES() {
|
|
89
|
+
return VIEW_TYPES;
|
|
90
|
+
},
|
|
91
|
+
hasManyAgents() {
|
|
92
|
+
return this.agents.length > 1;
|
|
93
|
+
},
|
|
94
|
+
hasAgents() {
|
|
95
|
+
return this.agents.length > 0;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
methods: {
|
|
99
|
+
startNewChat(agent) {
|
|
100
|
+
if (agent) {
|
|
101
|
+
this.$emit('new-chat', agent);
|
|
102
|
+
} else if (this.hasAgents) {
|
|
103
|
+
this.$emit('new-chat', this.agents[0]);
|
|
104
|
+
} else {
|
|
105
|
+
this.$emit('new-chat');
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
async copySessionIdToClipboard() {
|
|
109
|
+
try {
|
|
110
|
+
await navigator.clipboard.writeText(this.sessionId);
|
|
111
|
+
this.$toast.show('Session ID copied to clipboard');
|
|
112
|
+
} catch {
|
|
113
|
+
this.$toast.show('Could not copy session ID');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
i18n
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/* script */
|
|
121
|
+
const __vue_script__ = script;
|
|
122
|
+
|
|
123
|
+
/* template */
|
|
124
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('header',{staticClass:"gl-border-b gl-shrink-0 gl-bg-default gl-p-0",attrs:{"data-testid":"chat-header"}},[_c('div',{staticClass:"gl-border-b gl-flex gl-w-full gl-items-center gl-px-5 gl-py-3"},[(_vm.subtitle)?_c('h4',{staticClass:"gl-mb-0 gl-shrink-0 gl-overflow-hidden gl-text-ellipsis gl-whitespace-nowrap gl-pr-3 gl-text-sm gl-font-normal gl-text-subtle",attrs:{"data-testid":"chat-subtitle"}},[_vm._v("\n "+_vm._s(_vm.subtitle)+"\n ")]):_vm._e(),_vm._v(" "),_c('gl-button',{staticClass:"gl-ml-auto",attrs:{"category":"tertiary","variant":"default","icon":"close","size":"small","data-testid":"chat-close-button","aria-label":_vm.$options.i18n.CHAT_CLOSE_LABEL},on:{"click":function($event){return _vm.$emit('close')}}})],1),_vm._v(" "),_c('div',{staticClass:"drawer-title gl-flex gl-items-center gl-justify-start gl-p-5"},[_c('div',{staticClass:"gl-flex gl-flex-1 gl-overflow-hidden"},[_c('gl-avatar',{staticClass:"gl-mr-3",attrs:{"size":32,"entity-name":_vm.title,"shape":"circle"}}),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-items-center"},[_c('h3',{staticClass:"gl-my-0 gl-text-[0.875rem]"},[_vm._v(_vm._s(_vm.title))])])],1),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-gap-3"},[(
|
|
125
|
+
_vm.isMultithreaded && (_vm.activeThreadId || _vm.currentView === _vm.VIEW_TYPES.LIST || _vm.hasManyAgents)
|
|
126
|
+
)?[(_vm.hasManyAgents)?_c('gl-disclosure-dropdown',{attrs:{"title":_vm.$options.i18n.CHAT_NEW_TOOLTIP,"toggle-text":_vm.$options.i18n.CHAT_NEW_TOOLTIP,"items":_vm.agents,"data-testid":"chat-new-button","variant":"confirm","category":"tertiary","size":"small","icon":"duo-chat-new","text-sr-only":"","aria-label":_vm.$options.i18n.CHAT_NEW_LABEL,"no-caret":""},on:{"action":_vm.startNewChat},scopedSlots:_vm._u([{key:"list-item",fn:function(ref){
|
|
127
|
+
var item = ref.item;
|
|
128
|
+
return [_c('span',{staticClass:"gl-flex gl-flex-col"},[_c('span',{attrs:{"clas":"gl-block"}},[_vm._v(_vm._s(item.name))]),_vm._v(" "),_c('span',{staticClass:"gl-overflow-hidden gl-text-ellipsis gl-whitespace-nowrap gl-text-sm"},[_vm._v(_vm._s(item.description))])])]}}],null,false,117082970)}):_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],attrs:{"title":_vm.$options.i18n.CHAT_NEW_TOOLTIP,"data-testid":"chat-new-button","variant":"confirm","category":"tertiary","size":"small","icon":"duo-chat-new","aria-label":_vm.$options.i18n.CHAT_NEW_LABEL},on:{"click":_vm.startNewChat}})]:_vm._e(),_vm._v(" "),(_vm.isMultithreaded && _vm.currentView === _vm.VIEW_TYPES.CHAT)?_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],attrs:{"title":_vm.$options.i18n.CHAT_HISTORY_TOOLTIP,"data-testid":"go-back-to-list-button","category":"tertiary","size":"small","icon":"history","aria-label":_vm.$options.i18n.CHAT_BACK_LABEL},on:{"click":function($event){return _vm.$emit('go-back')}}}):_vm._e(),_vm._v(" "),(_vm.isMultithreaded && _vm.activeThreadId && _vm.currentView === _vm.VIEW_TYPES.LIST)?_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],attrs:{"title":_vm.$options.i18n.CHAT_BACK_TO_CHAT_TOOLTIP,"data-testid":"go-back-to-chat-button","category":"tertiary","size":"small","icon":"go-back","aria-label":_vm.$options.i18n.CHAT_BACK_TO_CHAT_TOOLTIP},on:{"click":function($event){return _vm.$emit('go-back-to-chat')}}}):_vm._e(),_vm._v(" "),(_vm.sessionId)?_c('gl-dropdown',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip.hover",modifiers:{"hover":true}}],attrs:{"icon":"ellipsis_v","category":"tertiary","text-sr-only":"","size":"small","text":_vm.$options.i18n.CHAT_DROPDOWN_MORE_OPTIONS,"title":_vm.$options.i18n.CHAT_DROPDOWN_MORE_OPTIONS,"no-caret":""}},[_c('gl-dropdown-item',{on:{"click":function($event){return _vm.copySessionIdToClipboard()}}},[_c('span',{staticClass:"gl-flex gl-items-center gl-gap-2"},[_c('span',{staticClass:"gl-flex-shrink-0"},[_vm._v(_vm._s(_vm.$options.i18n.CHAT_COPY_TOOLTIP))]),_vm._v(" "),_c('gl-badge',{staticClass:"gl-flex-shrink"},[_c('span',{staticClass:"gl-max-w-12 gl-truncate",attrs:{"title":_vm.sessionId}},[_vm._v("\n "+_vm._s(_vm.sessionId)+"\n ")])])],1)])],1):_vm._e()],2)]),_vm._v(" "),_vm._t("subheader"),_vm._v(" "),(_vm.error)?_c('gl-alert',{key:"error",staticClass:"!gl-pl-9",attrs:{"dismissible":false,"variant":"danger","role":"alert","data-testid":"chat-error"}},[_c('span',{directives:[{name:"safe-html",rawName:"v-safe-html",value:(_vm.error),expression:"error"}]})]):_vm._e()],2)};
|
|
129
|
+
var __vue_staticRenderFns__ = [];
|
|
130
|
+
|
|
131
|
+
/* style */
|
|
132
|
+
const __vue_inject_styles__ = undefined;
|
|
133
|
+
/* scoped */
|
|
134
|
+
const __vue_scope_id__ = undefined;
|
|
135
|
+
/* module identifier */
|
|
136
|
+
const __vue_module_identifier__ = undefined;
|
|
137
|
+
/* functional template */
|
|
138
|
+
const __vue_is_functional_template__ = false;
|
|
139
|
+
/* style inject */
|
|
140
|
+
|
|
141
|
+
/* style inject SSR */
|
|
142
|
+
|
|
143
|
+
/* style inject shadow dom */
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
const __vue_component__ = __vue_normalize__(
|
|
148
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
149
|
+
__vue_inject_styles__,
|
|
150
|
+
__vue_script__,
|
|
151
|
+
__vue_scope_id__,
|
|
152
|
+
__vue_is_functional_template__,
|
|
153
|
+
__vue_module_identifier__,
|
|
154
|
+
false,
|
|
155
|
+
undefined,
|
|
156
|
+
undefined,
|
|
157
|
+
undefined
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
export default __vue_component__;
|
|
161
|
+
export { i18n };
|