@copilotkitnext/angular 0.0.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/.turbo/turbo-build.log +39 -0
- package/.turbo/turbo-check-types.log +0 -0
- package/.turbo/turbo-test.log +71 -0
- package/LICENSE +10 -0
- package/README-agent-context.md +310 -0
- package/dist/LICENSE +10 -0
- package/dist/components/chat/copilot-chat-assistant-message-buttons.component.d.ts +75 -0
- package/dist/components/chat/copilot-chat-assistant-message-renderer.component.d.ts +31 -0
- package/dist/components/chat/copilot-chat-assistant-message-toolbar.component.d.ts +8 -0
- package/dist/components/chat/copilot-chat-assistant-message.component.d.ts +131 -0
- package/dist/components/chat/copilot-chat-assistant-message.types.d.ts +31 -0
- package/dist/components/chat/copilot-chat-audio-recorder.component.d.ts +40 -0
- package/dist/components/chat/copilot-chat-buttons.component.d.ts +66 -0
- package/dist/components/chat/copilot-chat-input-defaults.d.ts +37 -0
- package/dist/components/chat/copilot-chat-input.component.d.ts +133 -0
- package/dist/components/chat/copilot-chat-input.types.d.ts +129 -0
- package/dist/components/chat/copilot-chat-message-view-cursor.component.d.ts +15 -0
- package/dist/components/chat/copilot-chat-message-view.component.d.ts +293 -0
- package/dist/components/chat/copilot-chat-message-view.types.d.ts +24 -0
- package/dist/components/chat/copilot-chat-textarea.component.d.ts +45 -0
- package/dist/components/chat/copilot-chat-tool-calls-view.component.d.ts +35 -0
- package/dist/components/chat/copilot-chat-toolbar.component.d.ts +8 -0
- package/dist/components/chat/copilot-chat-tools-menu.component.d.ts +20 -0
- package/dist/components/chat/copilot-chat-user-message-branch-navigation.component.d.ts +23 -0
- package/dist/components/chat/copilot-chat-user-message-buttons.component.d.ts +39 -0
- package/dist/components/chat/copilot-chat-user-message-renderer.component.d.ts +9 -0
- package/dist/components/chat/copilot-chat-user-message-toolbar.component.d.ts +8 -0
- package/dist/components/chat/copilot-chat-user-message.component.d.ts +55 -0
- package/dist/components/chat/copilot-chat-user-message.types.d.ts +33 -0
- package/dist/components/chat/copilot-chat-view-disclaimer.component.d.ts +15 -0
- package/dist/components/chat/copilot-chat-view-feather.component.d.ts +15 -0
- package/dist/components/chat/copilot-chat-view-handlers.service.d.ts +11 -0
- package/dist/components/chat/copilot-chat-view-input-container.component.d.ts +23 -0
- package/dist/components/chat/copilot-chat-view-scroll-to-bottom-button.component.d.ts +17 -0
- package/dist/components/chat/copilot-chat-view-scroll-view.component.d.ts +84 -0
- package/dist/components/chat/copilot-chat-view.component.d.ts +205 -0
- package/dist/components/chat/copilot-chat-view.types.d.ts +42 -0
- package/dist/components/chat/copilot-chat.component.d.ts +37 -0
- package/dist/components/copilotkit-tool-render.component.d.ts +25 -0
- package/dist/core/chat-configuration/chat-configuration.providers.d.ts +54 -0
- package/dist/core/chat-configuration/chat-configuration.service.d.ts +75 -0
- package/dist/core/chat-configuration/chat-configuration.types.d.ts +27 -0
- package/dist/core/copilotkit.providers.d.ts +13 -0
- package/dist/core/copilotkit.service.d.ts +119 -0
- package/dist/core/copilotkit.types.d.ts +83 -0
- package/dist/directives/copilotkit-agent-context.directive.d.ts +68 -0
- package/dist/directives/copilotkit-agent.directive.d.ts +106 -0
- package/dist/directives/copilotkit-chat-config.directive.d.ts +84 -0
- package/dist/directives/copilotkit-config.directive.d.ts +44 -0
- package/dist/directives/copilotkit-frontend-tool.directive.d.ts +25 -0
- package/dist/directives/copilotkit-human-in-the-loop.directive.d.ts +124 -0
- package/dist/directives/stick-to-bottom.directive.d.ts +62 -0
- package/dist/fesm2022/copilotkitnext-angular.mjs +9314 -0
- package/dist/fesm2022/copilotkitnext-angular.mjs.map +1 -0
- package/dist/index.d.ts +55 -0
- package/dist/lib/directives/tooltip.directive.d.ts +33 -0
- package/dist/lib/slots/copilot-slot.component.d.ts +34 -0
- package/dist/lib/slots/slot.types.d.ts +55 -0
- package/dist/lib/slots/slot.utils.d.ts +108 -0
- package/dist/lib/utils.d.ts +6 -0
- package/dist/services/resize-observer.service.d.ts +44 -0
- package/dist/services/scroll-position.service.d.ts +50 -0
- package/dist/styles.css +1963 -0
- package/dist/types/frontend-tool.d.ts +37 -0
- package/dist/types/human-in-the-loop.d.ts +44 -0
- package/dist/utils/agent-context.utils.d.ts +75 -0
- package/dist/utils/agent.utils.d.ts +99 -0
- package/dist/utils/chat-config.utils.d.ts +166 -0
- package/dist/utils/copilotkit.utils.d.ts +16 -0
- package/dist/utils/frontend-tool.utils.d.ts +119 -0
- package/dist/utils/human-in-the-loop.utils.d.ts +92 -0
- package/eslint.config.mjs +20 -0
- package/ng-package.json +19 -0
- package/package.json +96 -0
- package/slots.md +331 -0
- package/src/components/chat/__tests__/copilot-chat-assistant-message.component.spec.ts +282 -0
- package/src/components/chat/__tests__/copilot-chat-input.component.spec.ts +419 -0
- package/src/components/chat/__tests__/copilot-chat-message-view.component.spec.ts +372 -0
- package/src/components/chat/__tests__/copilot-chat-user-message.component.spec.ts +249 -0
- package/src/components/chat/copilot-chat-assistant-message-buttons.component.ts +292 -0
- package/src/components/chat/copilot-chat-assistant-message-renderer.component.ts +472 -0
- package/src/components/chat/copilot-chat-assistant-message-toolbar.component.ts +29 -0
- package/src/components/chat/copilot-chat-assistant-message.component.ts +463 -0
- package/src/components/chat/copilot-chat-assistant-message.types.ts +50 -0
- package/src/components/chat/copilot-chat-audio-recorder.component.ts +241 -0
- package/src/components/chat/copilot-chat-buttons.component.ts +308 -0
- package/src/components/chat/copilot-chat-buttons.component.ts.bak +471 -0
- package/src/components/chat/copilot-chat-input-defaults.ts +47 -0
- package/src/components/chat/copilot-chat-input.component.ts +512 -0
- package/src/components/chat/copilot-chat-input.types.ts +148 -0
- package/src/components/chat/copilot-chat-message-view-cursor.component.ts +51 -0
- package/src/components/chat/copilot-chat-message-view.component.ts +233 -0
- package/src/components/chat/copilot-chat-message-view.types.ts +39 -0
- package/src/components/chat/copilot-chat-textarea.component.ts +220 -0
- package/src/components/chat/copilot-chat-tool-calls-view.component.ts +261 -0
- package/src/components/chat/copilot-chat-toolbar.component.ts +35 -0
- package/src/components/chat/copilot-chat-tools-menu.component.ts +185 -0
- package/src/components/chat/copilot-chat-user-message-branch-navigation.component.ts +121 -0
- package/src/components/chat/copilot-chat-user-message-buttons.component.ts +170 -0
- package/src/components/chat/copilot-chat-user-message-renderer.component.ts +37 -0
- package/src/components/chat/copilot-chat-user-message-toolbar.component.ts +37 -0
- package/src/components/chat/copilot-chat-user-message.component.ts +247 -0
- package/src/components/chat/copilot-chat-user-message.types.ts +42 -0
- package/src/components/chat/copilot-chat-view-disclaimer.component.ts +51 -0
- package/src/components/chat/copilot-chat-view-feather.component.ts +47 -0
- package/src/components/chat/copilot-chat-view-handlers.service.ts +14 -0
- package/src/components/chat/copilot-chat-view-input-container.component.ts +87 -0
- package/src/components/chat/copilot-chat-view-scroll-to-bottom-button.component.ts +79 -0
- package/src/components/chat/copilot-chat-view-scroll-view.component.ts +322 -0
- package/src/components/chat/copilot-chat-view.component.ts +420 -0
- package/src/components/chat/copilot-chat-view.types.ts +52 -0
- package/src/components/chat/copilot-chat.component.ts +232 -0
- package/src/components/copilotkit-tool-render.component.ts +169 -0
- package/src/core/__tests__/copilotkit.service.spec.ts +1051 -0
- package/src/core/__tests__/copilotkit.service.wildcard.spec.ts +316 -0
- package/src/core/chat-configuration/__tests__/chat-configuration.service.spec.ts +287 -0
- package/src/core/chat-configuration/chat-configuration.providers.ts +71 -0
- package/src/core/chat-configuration/chat-configuration.service.ts +162 -0
- package/src/core/chat-configuration/chat-configuration.types.ts +57 -0
- package/src/core/copilotkit.providers.ts +59 -0
- package/src/core/copilotkit.service.ts +542 -0
- package/src/core/copilotkit.types.ts +132 -0
- package/src/directives/__tests__/copilotkit-agent-context.directive.spec.ts +384 -0
- package/src/directives/__tests__/copilotkit-agent.directive.spec.ts +253 -0
- package/src/directives/__tests__/copilotkit-chat-config.directive.spec.ts +385 -0
- package/src/directives/__tests__/copilotkit-config.directive.spec.ts +69 -0
- package/src/directives/__tests__/copilotkit-frontend-tool-simple.directive.spec.ts +60 -0
- package/src/directives/__tests__/copilotkit-frontend-tool.directive.spec.ts +108 -0
- package/src/directives/__tests__/copilotkit-human-in-the-loop.directive.spec.ts +452 -0
- package/src/directives/copilotkit-agent-context.directive.ts +138 -0
- package/src/directives/copilotkit-agent.directive.ts +225 -0
- package/src/directives/copilotkit-chat-config.directive.ts +241 -0
- package/src/directives/copilotkit-config.directive.ts +81 -0
- package/src/directives/copilotkit-frontend-tool.directive.ts +145 -0
- package/src/directives/copilotkit-human-in-the-loop.directive.ts +281 -0
- package/src/directives/stick-to-bottom.directive.ts +204 -0
- package/src/index.ts +105 -0
- package/src/lib/directives/tooltip.directive.ts +292 -0
- package/src/lib/slots/__tests__/slot.utils.spec.ts +377 -0
- package/src/lib/slots/copilot-slot.component.ts +135 -0
- package/src/lib/slots/index.ts +3 -0
- package/src/lib/slots/slot.types.ts +64 -0
- package/src/lib/slots/slot.utils.ts +289 -0
- package/src/lib/utils.ts +10 -0
- package/src/public-api.ts +1 -0
- package/src/services/resize-observer.service.ts +181 -0
- package/src/services/scroll-position.service.ts +169 -0
- package/src/styles/globals.css +266 -0
- package/src/styles/index.css +3 -0
- package/src/test-setup.ts +15 -0
- package/src/testing/index.ts +3 -0
- package/src/testing/testing.utils.ts +248 -0
- package/src/types/frontend-tool.ts +44 -0
- package/src/types/human-in-the-loop.ts +52 -0
- package/src/utils/__tests__/agent.utils.spec.ts +234 -0
- package/src/utils/__tests__/chat-config.utils.spec.ts +306 -0
- package/src/utils/__tests__/frontend-tool-inject.spec.ts +350 -0
- package/src/utils/__tests__/frontend-tool-integration.spec.ts +199 -0
- package/src/utils/__tests__/frontend-tool.utils.spec.ts +272 -0
- package/src/utils/__tests__/human-in-the-loop.utils.spec.ts +365 -0
- package/src/utils/agent-context.utils.ts +133 -0
- package/src/utils/agent.utils.ts +239 -0
- package/src/utils/chat-config.utils.ts +221 -0
- package/src/utils/copilotkit.utils.ts +20 -0
- package/src/utils/frontend-tool.utils.ts +266 -0
- package/src/utils/human-in-the-loop.utils.ts +359 -0
- package/tsconfig.json +33 -0
- package/tsconfig.spec.json +12 -0
- package/vitest.config.mts +34 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
Input,
|
|
4
|
+
Output,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
signal,
|
|
7
|
+
computed,
|
|
8
|
+
ChangeDetectionStrategy,
|
|
9
|
+
ViewEncapsulation,
|
|
10
|
+
inject
|
|
11
|
+
} from '@angular/core';
|
|
12
|
+
import { CommonModule } from '@angular/common';
|
|
13
|
+
import { LucideAngularModule, Copy, Check, ThumbsUp, ThumbsDown, Volume2, RefreshCw } from 'lucide-angular';
|
|
14
|
+
import { CopilotTooltipDirective } from '../../lib/directives/tooltip.directive';
|
|
15
|
+
import { CopilotChatConfigurationService } from '../../core/chat-configuration/chat-configuration.service';
|
|
16
|
+
import { cn } from '../../lib/utils';
|
|
17
|
+
|
|
18
|
+
// Base toolbar button component
|
|
19
|
+
@Component({
|
|
20
|
+
selector: 'button[copilotChatAssistantMessageToolbarButton]',
|
|
21
|
+
standalone: true,
|
|
22
|
+
imports: [CommonModule],
|
|
23
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
|
+
encapsulation: ViewEncapsulation.None,
|
|
25
|
+
template: `
|
|
26
|
+
<ng-content></ng-content>
|
|
27
|
+
`,
|
|
28
|
+
host: {
|
|
29
|
+
'[class]': 'computedClass()',
|
|
30
|
+
'[attr.disabled]': 'disabled ? true : null',
|
|
31
|
+
'type': 'button',
|
|
32
|
+
'[attr.aria-label]': 'title'
|
|
33
|
+
},
|
|
34
|
+
hostDirectives: [
|
|
35
|
+
{
|
|
36
|
+
directive: CopilotTooltipDirective,
|
|
37
|
+
inputs: ['copilotTooltip: title', 'tooltipPosition', 'tooltipDelay']
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
})
|
|
41
|
+
export class CopilotChatAssistantMessageToolbarButtonComponent {
|
|
42
|
+
@Input() title = '';
|
|
43
|
+
@Input() disabled = false;
|
|
44
|
+
@Input() set inputClass(value: string | undefined) {
|
|
45
|
+
this.customClass.set(value);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private customClass = signal<string | undefined>(undefined);
|
|
49
|
+
|
|
50
|
+
computedClass = computed(() => {
|
|
51
|
+
return cn(
|
|
52
|
+
// Flex centering with gap (from React button base styles)
|
|
53
|
+
'inline-flex items-center justify-center gap-2',
|
|
54
|
+
// Cursor
|
|
55
|
+
'cursor-pointer',
|
|
56
|
+
// Background and text
|
|
57
|
+
'p-0 text-[rgb(93,93,93)] hover:bg-[#E8E8E8]',
|
|
58
|
+
// Dark mode
|
|
59
|
+
'dark:text-[rgb(243,243,243)] dark:hover:bg-[#303030]',
|
|
60
|
+
// Shape and sizing
|
|
61
|
+
'h-8 w-8 rounded-md',
|
|
62
|
+
// Interactions
|
|
63
|
+
'transition-colors',
|
|
64
|
+
// Hover states
|
|
65
|
+
'hover:text-[rgb(93,93,93)]',
|
|
66
|
+
'dark:hover:text-[rgb(243,243,243)]',
|
|
67
|
+
// Focus states
|
|
68
|
+
'focus:outline-none focus:ring-2 focus:ring-offset-2',
|
|
69
|
+
// Disabled state
|
|
70
|
+
'disabled:opacity-50 disabled:cursor-not-allowed',
|
|
71
|
+
// SVG styling from React Button component
|
|
72
|
+
'[&_svg]:pointer-events-none [&_svg]:shrink-0',
|
|
73
|
+
// Ensure proper sizing
|
|
74
|
+
'shrink-0',
|
|
75
|
+
this.customClass()
|
|
76
|
+
);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Copy button component
|
|
81
|
+
@Component({
|
|
82
|
+
selector: 'copilot-chat-assistant-message-copy-button',
|
|
83
|
+
standalone: true,
|
|
84
|
+
imports: [CommonModule, LucideAngularModule, CopilotChatAssistantMessageToolbarButtonComponent],
|
|
85
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
86
|
+
encapsulation: ViewEncapsulation.None,
|
|
87
|
+
template: `
|
|
88
|
+
<button
|
|
89
|
+
copilotChatAssistantMessageToolbarButton
|
|
90
|
+
[title]="title || labels.assistantMessageToolbarCopyMessageLabel"
|
|
91
|
+
[disabled]="disabled"
|
|
92
|
+
[inputClass]="inputClass"
|
|
93
|
+
(click)="handleCopy($event)">
|
|
94
|
+
@if (copied()) {
|
|
95
|
+
<lucide-angular [img]="CheckIcon" [size]="18"></lucide-angular>
|
|
96
|
+
} @else {
|
|
97
|
+
<lucide-angular [img]="CopyIcon" [size]="18"></lucide-angular>
|
|
98
|
+
}
|
|
99
|
+
</button>
|
|
100
|
+
`
|
|
101
|
+
})
|
|
102
|
+
export class CopilotChatAssistantMessageCopyButtonComponent {
|
|
103
|
+
@Input() title?: string;
|
|
104
|
+
@Input() disabled = false;
|
|
105
|
+
@Input() inputClass?: string;
|
|
106
|
+
@Input() content?: string;
|
|
107
|
+
@Output() clicked = new EventEmitter<void>();
|
|
108
|
+
|
|
109
|
+
readonly CopyIcon = Copy;
|
|
110
|
+
readonly CheckIcon = Check;
|
|
111
|
+
|
|
112
|
+
copied = signal(false);
|
|
113
|
+
private chatConfig = inject(CopilotChatConfigurationService);
|
|
114
|
+
|
|
115
|
+
get labels() {
|
|
116
|
+
return this.chatConfig.labels();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
handleCopy(event?: Event): void {
|
|
120
|
+
event?.stopPropagation();
|
|
121
|
+
if (!this.content) return;
|
|
122
|
+
|
|
123
|
+
// Set copied immediately for instant feedback
|
|
124
|
+
this.copied.set(true);
|
|
125
|
+
setTimeout(() => this.copied.set(false), 2000);
|
|
126
|
+
|
|
127
|
+
// Copy to clipboard (fire and forget)
|
|
128
|
+
navigator.clipboard.writeText(this.content).then(
|
|
129
|
+
() => this.clicked.emit(),
|
|
130
|
+
(err) => {
|
|
131
|
+
console.error('Failed to copy message:', err);
|
|
132
|
+
this.copied.set(false);
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Thumbs up button component
|
|
139
|
+
@Component({
|
|
140
|
+
selector: 'copilot-chat-assistant-message-thumbs-up-button',
|
|
141
|
+
standalone: true,
|
|
142
|
+
imports: [CommonModule, LucideAngularModule, CopilotChatAssistantMessageToolbarButtonComponent],
|
|
143
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
144
|
+
encapsulation: ViewEncapsulation.None,
|
|
145
|
+
template: `
|
|
146
|
+
<button
|
|
147
|
+
copilotChatAssistantMessageToolbarButton
|
|
148
|
+
[title]="title || labels.assistantMessageToolbarThumbsUpLabel"
|
|
149
|
+
[disabled]="disabled"
|
|
150
|
+
[inputClass]="inputClass"
|
|
151
|
+
(click)="handleClick($event)">
|
|
152
|
+
<lucide-angular [img]="ThumbsUpIcon" [size]="18"></lucide-angular>
|
|
153
|
+
</button>
|
|
154
|
+
`
|
|
155
|
+
})
|
|
156
|
+
export class CopilotChatAssistantMessageThumbsUpButtonComponent {
|
|
157
|
+
@Input() title?: string;
|
|
158
|
+
@Input() disabled = false;
|
|
159
|
+
@Input() inputClass?: string;
|
|
160
|
+
@Output() clicked = new EventEmitter<void>();
|
|
161
|
+
|
|
162
|
+
readonly ThumbsUpIcon = ThumbsUp;
|
|
163
|
+
private chatConfig = inject(CopilotChatConfigurationService);
|
|
164
|
+
|
|
165
|
+
get labels() {
|
|
166
|
+
return this.chatConfig.labels();
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
handleClick(event?: Event): void {
|
|
170
|
+
event?.stopPropagation();
|
|
171
|
+
if (!this.disabled) {
|
|
172
|
+
this.clicked.emit();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Thumbs down button component
|
|
178
|
+
@Component({
|
|
179
|
+
selector: 'copilot-chat-assistant-message-thumbs-down-button',
|
|
180
|
+
standalone: true,
|
|
181
|
+
imports: [CommonModule, LucideAngularModule, CopilotChatAssistantMessageToolbarButtonComponent],
|
|
182
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
183
|
+
encapsulation: ViewEncapsulation.None,
|
|
184
|
+
template: `
|
|
185
|
+
<button
|
|
186
|
+
copilotChatAssistantMessageToolbarButton
|
|
187
|
+
[title]="title || labels.assistantMessageToolbarThumbsDownLabel"
|
|
188
|
+
[disabled]="disabled"
|
|
189
|
+
[inputClass]="inputClass"
|
|
190
|
+
(click)="handleClick($event)">
|
|
191
|
+
<lucide-angular [img]="ThumbsDownIcon" [size]="18"></lucide-angular>
|
|
192
|
+
</button>
|
|
193
|
+
`
|
|
194
|
+
})
|
|
195
|
+
export class CopilotChatAssistantMessageThumbsDownButtonComponent {
|
|
196
|
+
@Input() title?: string;
|
|
197
|
+
@Input() disabled = false;
|
|
198
|
+
@Input() inputClass?: string;
|
|
199
|
+
@Output() clicked = new EventEmitter<void>();
|
|
200
|
+
|
|
201
|
+
readonly ThumbsDownIcon = ThumbsDown;
|
|
202
|
+
private chatConfig = inject(CopilotChatConfigurationService);
|
|
203
|
+
|
|
204
|
+
get labels() {
|
|
205
|
+
return this.chatConfig.labels();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
handleClick(event?: Event): void {
|
|
209
|
+
event?.stopPropagation();
|
|
210
|
+
if (!this.disabled) {
|
|
211
|
+
this.clicked.emit();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Read aloud button component
|
|
217
|
+
@Component({
|
|
218
|
+
selector: 'copilot-chat-assistant-message-read-aloud-button',
|
|
219
|
+
standalone: true,
|
|
220
|
+
imports: [CommonModule, LucideAngularModule, CopilotChatAssistantMessageToolbarButtonComponent],
|
|
221
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
222
|
+
encapsulation: ViewEncapsulation.None,
|
|
223
|
+
template: `
|
|
224
|
+
<button
|
|
225
|
+
copilotChatAssistantMessageToolbarButton
|
|
226
|
+
[title]="title || labels.assistantMessageToolbarReadAloudLabel"
|
|
227
|
+
[disabled]="disabled"
|
|
228
|
+
[inputClass]="inputClass"
|
|
229
|
+
(click)="handleClick($event)">
|
|
230
|
+
<lucide-angular [img]="Volume2Icon" [size]="20"></lucide-angular>
|
|
231
|
+
</button>
|
|
232
|
+
`
|
|
233
|
+
})
|
|
234
|
+
export class CopilotChatAssistantMessageReadAloudButtonComponent {
|
|
235
|
+
@Input() title?: string;
|
|
236
|
+
@Input() disabled = false;
|
|
237
|
+
@Input() inputClass?: string;
|
|
238
|
+
@Output() clicked = new EventEmitter<void>();
|
|
239
|
+
|
|
240
|
+
readonly Volume2Icon = Volume2;
|
|
241
|
+
private chatConfig = inject(CopilotChatConfigurationService);
|
|
242
|
+
|
|
243
|
+
get labels() {
|
|
244
|
+
return this.chatConfig.labels();
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
handleClick(event?: Event): void {
|
|
248
|
+
event?.stopPropagation();
|
|
249
|
+
if (!this.disabled) {
|
|
250
|
+
this.clicked.emit();
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Regenerate button component
|
|
256
|
+
@Component({
|
|
257
|
+
selector: 'copilot-chat-assistant-message-regenerate-button',
|
|
258
|
+
standalone: true,
|
|
259
|
+
imports: [CommonModule, LucideAngularModule, CopilotChatAssistantMessageToolbarButtonComponent],
|
|
260
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
261
|
+
encapsulation: ViewEncapsulation.None,
|
|
262
|
+
template: `
|
|
263
|
+
<button
|
|
264
|
+
copilotChatAssistantMessageToolbarButton
|
|
265
|
+
[title]="title || labels.assistantMessageToolbarRegenerateLabel"
|
|
266
|
+
[disabled]="disabled"
|
|
267
|
+
[inputClass]="inputClass"
|
|
268
|
+
(click)="handleClick($event)">
|
|
269
|
+
<lucide-angular [img]="RefreshCwIcon" [size]="18"></lucide-angular>
|
|
270
|
+
</button>
|
|
271
|
+
`
|
|
272
|
+
})
|
|
273
|
+
export class CopilotChatAssistantMessageRegenerateButtonComponent {
|
|
274
|
+
@Input() title?: string;
|
|
275
|
+
@Input() disabled = false;
|
|
276
|
+
@Input() inputClass?: string;
|
|
277
|
+
@Output() clicked = new EventEmitter<void>();
|
|
278
|
+
|
|
279
|
+
readonly RefreshCwIcon = RefreshCw;
|
|
280
|
+
private chatConfig = inject(CopilotChatConfigurationService);
|
|
281
|
+
|
|
282
|
+
get labels() {
|
|
283
|
+
return this.chatConfig.labels();
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
handleClick(event?: Event): void {
|
|
287
|
+
event?.stopPropagation();
|
|
288
|
+
if (!this.disabled) {
|
|
289
|
+
this.clicked.emit();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|