@gitlab/duo-ui 9.1.1 → 10.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
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# [10.0.0](https://gitlab.com/gitlab-org/duo-ui/compare/v9.1.1...v10.0.0) (2025-07-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* agentic chat resolve input not clearing after submission ([68c9dee](https://gitlab.com/gitlab-org/duo-ui/commit/68c9deeda19073fdce046544b4adc3f826189ec0))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* The chat input would remain populated after sending a
|
|
12
|
+
message due to a race condition where the textarea was disabled before
|
|
13
|
+
the prompt could be cleared. This happened because `canSubmit = [secure]`
|
|
14
|
+
executed before `setPromptAndFocus()` completed its async DOM update.
|
|
15
|
+
|
|
1
16
|
## [9.1.1](https://gitlab.com/gitlab-org/duo-ui/compare/v9.1.0...v9.1.1) (2025-07-02)
|
|
2
17
|
|
|
3
18
|
|
|
@@ -2,7 +2,7 @@ import throttle from 'lodash/throttle';
|
|
|
2
2
|
import VueResizable from 'vue-resizable';
|
|
3
3
|
import { GlButton, GlAlert, GlFormInputGroup, GlFormTextarea, GlForm, GlExperimentBadge, GlCard, GlDropdownItem, GlSafeHtmlDirective } from '@gitlab/ui';
|
|
4
4
|
import { translate } from '../../utils/i18n';
|
|
5
|
-
import { badgeTypes, badgeTypeValidator, CHAT_RESET_MESSAGE, CHAT_INCLUDE_MESSAGE, MESSAGE_MODEL_ROLES,
|
|
5
|
+
import { badgeTypes, badgeTypeValidator, CHAT_RESET_MESSAGE, CHAT_INCLUDE_MESSAGE, MESSAGE_MODEL_ROLES, CHAT_BASE_COMMANDS } from '../chat/constants';
|
|
6
6
|
import { VIEW_TYPES } from '../chat/components/duo_chat_header/constants';
|
|
7
7
|
import DuoChatLoader from '../chat/components/duo_chat_loader/duo_chat_loader';
|
|
8
8
|
import DuoChatPredefinedPrompts from '../chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts';
|
|
@@ -427,26 +427,35 @@ var script = {
|
|
|
427
427
|
this.$emit('chat-cancel');
|
|
428
428
|
this.setPromptAndFocus();
|
|
429
429
|
},
|
|
430
|
-
sendChatPrompt() {
|
|
430
|
+
async sendChatPrompt() {
|
|
431
431
|
if (!this.canSubmit || this.contextItemsMenuIsOpen) {
|
|
432
432
|
return;
|
|
433
433
|
}
|
|
434
434
|
if (this.prompt) {
|
|
435
|
-
|
|
435
|
+
// Store these before any async operations that might clear the prompt
|
|
436
|
+
const trimmedPrompt = this.prompt.trim();
|
|
437
|
+
const lowerCasePrompt = this.prompt.toLowerCase().trim();
|
|
438
|
+
if (lowerCasePrompt.startsWith(CHAT_INCLUDE_MESSAGE) && this.hasContextItemSelectionMenu) {
|
|
436
439
|
this.contextItemsMenuIsOpen = true;
|
|
437
440
|
return;
|
|
438
441
|
}
|
|
439
|
-
if (![CHAT_RESET_MESSAGE, CHAT_CLEAR_MESSAGE, CHAT_NEW_MESSAGE].includes(this.caseInsensitivePrompt)) {
|
|
440
|
-
this.canSubmit = false;
|
|
441
|
-
}
|
|
442
442
|
|
|
443
443
|
/**
|
|
444
444
|
* Emitted when a new user prompt should be sent out.
|
|
445
445
|
*
|
|
446
446
|
* @param {String} prompt The user prompt to send.
|
|
447
447
|
*/
|
|
448
|
-
this.$emit('send-chat-prompt',
|
|
449
|
-
|
|
448
|
+
this.$emit('send-chat-prompt', trimmedPrompt);
|
|
449
|
+
|
|
450
|
+
// Always clear the prompt after sending, regardless of the command type
|
|
451
|
+
await this.setPromptAndFocus();
|
|
452
|
+
|
|
453
|
+
// Check if it was a special command using the stored value (before clearing)
|
|
454
|
+
if (!CHAT_BASE_COMMANDS.includes(lowerCasePrompt)) {
|
|
455
|
+
// Wait for all reactive updates to complete before setting canSubmit
|
|
456
|
+
await this.$nextTick();
|
|
457
|
+
this.canSubmit = false;
|
|
458
|
+
}
|
|
450
459
|
}
|
|
451
460
|
},
|
|
452
461
|
sendPredefinedPrompt(prompt) {
|
|
@@ -2,6 +2,7 @@ const CHAT_RESET_MESSAGE = '/reset';
|
|
|
2
2
|
const CHAT_CLEAR_MESSAGE = '/clear';
|
|
3
3
|
const CHAT_NEW_MESSAGE = '/new';
|
|
4
4
|
const CHAT_INCLUDE_MESSAGE = '/include';
|
|
5
|
+
const CHAT_BASE_COMMANDS = [CHAT_RESET_MESSAGE, CHAT_CLEAR_MESSAGE, CHAT_NEW_MESSAGE];
|
|
5
6
|
const LOADING_TRANSITION_DURATION = 7500;
|
|
6
7
|
const DOCUMENTATION_SOURCE_TYPES = {
|
|
7
8
|
HANDBOOK: {
|
|
@@ -29,4 +30,4 @@ const SELECTED_CONTEXT_ITEMS_DEFAULT_COLLAPSED = true;
|
|
|
29
30
|
const badgeTypes = ['experiment', 'beta', null];
|
|
30
31
|
const badgeTypeValidator = value => badgeTypes.includes(value);
|
|
31
32
|
|
|
32
|
-
export { CHAT_CLEAR_MESSAGE, CHAT_INCLUDE_MESSAGE, CHAT_NEW_MESSAGE, CHAT_RESET_MESSAGE, DOCUMENTATION_SOURCE_TYPES, LOADING_TRANSITION_DURATION, MESSAGE_MODEL_ROLES, SELECTED_CONTEXT_ITEMS_DEFAULT_COLLAPSED, badgeTypeValidator, badgeTypes };
|
|
33
|
+
export { CHAT_BASE_COMMANDS, CHAT_CLEAR_MESSAGE, CHAT_INCLUDE_MESSAGE, CHAT_NEW_MESSAGE, CHAT_RESET_MESSAGE, DOCUMENTATION_SOURCE_TYPES, LOADING_TRANSITION_DURATION, MESSAGE_MODEL_ROLES, SELECTED_CONTEXT_ITEMS_DEFAULT_COLLAPSED, badgeTypeValidator, badgeTypes };
|
package/package.json
CHANGED
|
@@ -20,9 +20,8 @@ import {
|
|
|
20
20
|
badgeTypes,
|
|
21
21
|
badgeTypeValidator,
|
|
22
22
|
CHAT_RESET_MESSAGE,
|
|
23
|
-
CHAT_CLEAR_MESSAGE,
|
|
24
|
-
CHAT_NEW_MESSAGE,
|
|
25
23
|
CHAT_INCLUDE_MESSAGE,
|
|
24
|
+
CHAT_BASE_COMMANDS,
|
|
26
25
|
MESSAGE_MODEL_ROLES,
|
|
27
26
|
} from '../chat/constants';
|
|
28
27
|
import { VIEW_TYPES } from '../chat/components/duo_chat_header/constants';
|
|
@@ -501,35 +500,36 @@ export default {
|
|
|
501
500
|
this.$emit('chat-cancel');
|
|
502
501
|
this.setPromptAndFocus();
|
|
503
502
|
},
|
|
504
|
-
sendChatPrompt() {
|
|
503
|
+
async sendChatPrompt() {
|
|
505
504
|
if (!this.canSubmit || this.contextItemsMenuIsOpen) {
|
|
506
505
|
return;
|
|
507
506
|
}
|
|
508
507
|
if (this.prompt) {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
508
|
+
// Store these before any async operations that might clear the prompt
|
|
509
|
+
const trimmedPrompt = this.prompt.trim();
|
|
510
|
+
const lowerCasePrompt = this.prompt.toLowerCase().trim();
|
|
511
|
+
|
|
512
|
+
if (lowerCasePrompt.startsWith(CHAT_INCLUDE_MESSAGE) && this.hasContextItemSelectionMenu) {
|
|
513
513
|
this.contextItemsMenuIsOpen = true;
|
|
514
514
|
return;
|
|
515
515
|
}
|
|
516
516
|
|
|
517
|
-
if (
|
|
518
|
-
![CHAT_RESET_MESSAGE, CHAT_CLEAR_MESSAGE, CHAT_NEW_MESSAGE].includes(
|
|
519
|
-
this.caseInsensitivePrompt
|
|
520
|
-
)
|
|
521
|
-
) {
|
|
522
|
-
this.canSubmit = false;
|
|
523
|
-
}
|
|
524
|
-
|
|
525
517
|
/**
|
|
526
518
|
* Emitted when a new user prompt should be sent out.
|
|
527
519
|
*
|
|
528
520
|
* @param {String} prompt The user prompt to send.
|
|
529
521
|
*/
|
|
530
|
-
this.$emit('send-chat-prompt',
|
|
522
|
+
this.$emit('send-chat-prompt', trimmedPrompt);
|
|
531
523
|
|
|
532
|
-
|
|
524
|
+
// Always clear the prompt after sending, regardless of the command type
|
|
525
|
+
await this.setPromptAndFocus();
|
|
526
|
+
|
|
527
|
+
// Check if it was a special command using the stored value (before clearing)
|
|
528
|
+
if (!CHAT_BASE_COMMANDS.includes(lowerCasePrompt)) {
|
|
529
|
+
// Wait for all reactive updates to complete before setting canSubmit
|
|
530
|
+
await this.$nextTick();
|
|
531
|
+
this.canSubmit = false;
|
|
532
|
+
}
|
|
533
533
|
}
|
|
534
534
|
},
|
|
535
535
|
sendPredefinedPrompt(prompt) {
|
|
@@ -3,6 +3,8 @@ export const CHAT_CLEAR_MESSAGE = '/clear';
|
|
|
3
3
|
export const CHAT_NEW_MESSAGE = '/new';
|
|
4
4
|
export const CHAT_INCLUDE_MESSAGE = '/include';
|
|
5
5
|
|
|
6
|
+
export const CHAT_BASE_COMMANDS = [CHAT_RESET_MESSAGE, CHAT_CLEAR_MESSAGE, CHAT_NEW_MESSAGE];
|
|
7
|
+
|
|
6
8
|
export const LOADING_TRANSITION_DURATION = 7500;
|
|
7
9
|
|
|
8
10
|
export const DOCUMENTATION_SOURCE_TYPES = {
|