@copilotkitnext/angular 0.0.19 → 0.0.21-alpha.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/dist/esm2022/lib/components/chat/copilot-chat-user-message-branch-navigation.mjs +6 -26
- package/dist/esm2022/lib/components/chat/copilot-chat-user-message.mjs +36 -34
- package/dist/esm2022/lib/components/chat/copilot-chat-user-message.types.mjs +1 -1
- package/dist/esm2022/lib/copilotkit.mjs +7 -16
- package/dist/esm2022/lib/render-tool-calls.mjs +25 -5
- package/dist/esm2022/lib/tools.mjs +1 -1
- package/dist/fesm2022/copilotkitnext-angular.mjs +68 -75
- package/dist/fesm2022/copilotkitnext-angular.mjs.map +1 -1
- package/dist/lib/agent.d.ts +16 -1
- package/dist/lib/components/chat/copilot-chat-assistant-message.d.ts +32 -2
- package/dist/lib/components/chat/copilot-chat-message-view.d.ts +112 -7
- package/dist/lib/components/chat/copilot-chat-tool-calls-view.d.ts +16 -1
- package/dist/lib/components/chat/copilot-chat-user-message-branch-navigation.d.ts +17 -2
- package/dist/lib/components/chat/copilot-chat-user-message.d.ts +18 -2
- package/dist/lib/components/chat/copilot-chat-user-message.types.d.ts +1 -7
- package/dist/lib/components/chat/copilot-chat-view-scroll-view.d.ts +16 -1
- package/dist/lib/components/chat/copilot-chat-view.d.ts +48 -3
- package/dist/lib/components/chat/copilot-chat.d.ts +16 -1
- package/dist/lib/render-tool-calls.d.ts +16 -1
- package/dist/lib/tools.d.ts +5 -3
- package/package.json +7 -7
- package/vitest.config.mts.timestamp-1760727629337-603c9e5c1f334.mjs +0 -49
|
@@ -28,4 +28,4 @@ export function registerHumanInTheLoop(humanInTheLoop) {
|
|
|
28
28
|
copilotKit.removeTool(humanInTheLoop.name);
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid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IGZyb250ZW5kVG9vbDogRnJvbnRlbmRUb29sQ29uZmlnPEFyZ3M+LFxuKTogdm9pZCB7XG4gIGNvbnN0IGluamVjdG9yID0gaW5qZWN0KEluamVjdG9yKTtcbiAgY29uc3QgZGVzdHJveVJlZiA9IGluamVjdChEZXN0cm95UmVmKTtcbiAgY29uc3QgY29waWxvdEtpdCA9IGluamVjdChDb3BpbG90S2l0KTtcblxuICBjb3BpbG90S2l0LmFkZEZyb250ZW5kVG9vbCh7XG4gICAgLi4uKGZyb250ZW5kVG9vbCBhcyBGcm9udGVuZFRvb2xDb25maWcpLFxuICAgIGluamVjdG9yLFxuICB9KTtcblxuICBkZXN0cm95UmVmLm9uRGVzdHJveSgoKSA9PiB7XG4gICAgY29waWxvdEtpdC5yZW1vdmVUb29sKGZyb250ZW5kVG9vbC5uYW1lKTtcbiAgfSk7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiByZWdpc3Rlckh1bWFuSW5UaGVMb29wPEFyZ3MgZXh0ZW5kcyBSZWNvcmQ8c3RyaW5nLCB1bmtub3duPiA9IFJlY29yZDxzdHJpbmcsIHVua25vd24+PihcbiAgaHVtYW5JblRoZUxvb3A6IEh1bWFuSW5UaGVMb29wQ29uZmlnPEFyZ3M+LFxuKTogdm9pZCB7XG4gIGNvbnN0IGRlc3Ryb3lSZWYgPSBpbmplY3QoRGVzdHJveVJlZik7XG4gIGNvbnN0IGNvcGlsb3RLaXQgPSBpbmplY3QoQ29waWxvdEtpdCk7XG5cbiAgY29waWxvdEtpdC5hZGRIdW1hbkluVGhlTG9vcChodW1hbkluVGhlTG9vcCk7XG5cbiAgZGVzdHJveVJlZi5vbkRlc3Ryb3koKCkgPT4ge1xuICAgIGNvcGlsb3RLaXQucmVtb3ZlVG9vbChodW1hbkluVGhlTG9vcC5uYW1lKTtcbiAgfSk7XG59XG4iXX0=
|
|
@@ -99,10 +99,7 @@ class CopilotKit {
|
|
|
99
99
|
addFrontendTool(clientToolWithInjector) {
|
|
100
100
|
const tool = this.#bindClientTool(clientToolWithInjector);
|
|
101
101
|
this.core.addTool(tool);
|
|
102
|
-
this.#clientToolCallRenderConfigs.update((current) => [
|
|
103
|
-
...current,
|
|
104
|
-
clientToolWithInjector,
|
|
105
|
-
]);
|
|
102
|
+
this.#clientToolCallRenderConfigs.update((current) => [...current, clientToolWithInjector]);
|
|
106
103
|
}
|
|
107
104
|
addRenderToolCall(renderConfig) {
|
|
108
105
|
this.#toolCallRenderConfigs.update((current) => [...current, renderConfig]);
|
|
@@ -116,10 +113,7 @@ class CopilotKit {
|
|
|
116
113
|
};
|
|
117
114
|
}
|
|
118
115
|
addHumanInTheLoop(humanInTheLoopTool) {
|
|
119
|
-
this.#humanInTheLoopToolRenderConfigs.update((current) => [
|
|
120
|
-
...current,
|
|
121
|
-
humanInTheLoopTool,
|
|
122
|
-
]);
|
|
116
|
+
this.#humanInTheLoopToolRenderConfigs.update((current) => [...current, humanInTheLoopTool]);
|
|
123
117
|
const tool = this.#bindHumanInTheLoopTool(humanInTheLoopTool);
|
|
124
118
|
this.core.addTool(tool);
|
|
125
119
|
}
|
|
@@ -131,12 +125,9 @@ class CopilotKit {
|
|
|
131
125
|
}
|
|
132
126
|
removeTool(toolName, agentId) {
|
|
133
127
|
this.core.removeTool(toolName);
|
|
134
|
-
this.#clientToolCallRenderConfigs.update((current) => current.filter((renderConfig) => renderConfig.name !== toolName &&
|
|
135
|
-
|
|
136
|
-
this.#
|
|
137
|
-
this.#isSameAgentId(renderConfig, agentId)));
|
|
138
|
-
this.#toolCallRenderConfigs.update((current) => current.filter((renderConfig) => renderConfig.name !== toolName &&
|
|
139
|
-
this.#isSameAgentId(renderConfig, agentId)));
|
|
128
|
+
this.#clientToolCallRenderConfigs.update((current) => current.filter((renderConfig) => renderConfig.name !== toolName && this.#isSameAgentId(renderConfig, agentId)));
|
|
129
|
+
this.#humanInTheLoopToolRenderConfigs.update((current) => current.filter((renderConfig) => renderConfig.name !== toolName && this.#isSameAgentId(renderConfig, agentId)));
|
|
130
|
+
this.#toolCallRenderConfigs.update((current) => current.filter((renderConfig) => renderConfig.name !== toolName && this.#isSameAgentId(renderConfig, agentId)));
|
|
140
131
|
}
|
|
141
132
|
getAgent(agentId) {
|
|
142
133
|
return this.core.getAgent(agentId);
|
|
@@ -245,11 +236,15 @@ class RenderToolCalls {
|
|
|
245
236
|
buildHumanInTheLoopToolCall(toolCall) {
|
|
246
237
|
const args = partialJSONParse(toolCall.function.arguments);
|
|
247
238
|
const message = this.#getToolMessage(toolCall.id);
|
|
239
|
+
const respond = (result) => {
|
|
240
|
+
this.#hitl.addResult(toolCall.id, toolCall.function.name, result);
|
|
241
|
+
};
|
|
248
242
|
if (message) {
|
|
249
243
|
return {
|
|
250
244
|
args,
|
|
251
245
|
status: "complete",
|
|
252
246
|
result: message.content,
|
|
247
|
+
respond,
|
|
253
248
|
};
|
|
254
249
|
}
|
|
255
250
|
else if (this.isLoading()) {
|
|
@@ -257,6 +252,7 @@ class RenderToolCalls {
|
|
|
257
252
|
args,
|
|
258
253
|
status: "in-progress",
|
|
259
254
|
result: undefined,
|
|
255
|
+
respond,
|
|
260
256
|
};
|
|
261
257
|
}
|
|
262
258
|
else {
|
|
@@ -264,14 +260,13 @@ class RenderToolCalls {
|
|
|
264
260
|
args,
|
|
265
261
|
status: "executing",
|
|
266
262
|
result: undefined,
|
|
267
|
-
respond
|
|
268
|
-
this.#hitl.addResult(toolCall.id, toolCall.function.name, result);
|
|
269
|
-
},
|
|
263
|
+
respond,
|
|
270
264
|
};
|
|
271
265
|
}
|
|
272
266
|
}
|
|
273
267
|
#getToolMessage(toolCallId) {
|
|
274
|
-
|
|
268
|
+
const message = this.messages().find((m) => m.role === "tool" && m.toolCallId === toolCallId);
|
|
269
|
+
return message;
|
|
275
270
|
}
|
|
276
271
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: RenderToolCalls, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
277
272
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: RenderToolCalls, isStandalone: true, selector: "copilot-render-tool-calls", inputs: { message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: true, transformFunction: null }, messages: { classPropertyName: "messages", publicName: "messages", isSignal: true, isRequired: true, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
@@ -282,6 +277,14 @@ class RenderToolCalls {
|
|
|
282
277
|
*ngComponentOutlet="renderConfig.config.component; inputs: { toolCall: buildToolCall(toolCall) }"
|
|
283
278
|
/>
|
|
284
279
|
}
|
|
280
|
+
@if (renderConfig && renderConfig.type === "humanInTheLoopTool" && renderConfig.config.component) {
|
|
281
|
+
<ng-container
|
|
282
|
+
*ngComponentOutlet="
|
|
283
|
+
renderConfig.config.component;
|
|
284
|
+
inputs: { toolCall: buildHumanInTheLoopToolCall(toolCall) }
|
|
285
|
+
"
|
|
286
|
+
/>
|
|
287
|
+
}
|
|
285
288
|
}
|
|
286
289
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }] });
|
|
287
290
|
}
|
|
@@ -299,6 +302,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
299
302
|
*ngComponentOutlet="renderConfig.config.component; inputs: { toolCall: buildToolCall(toolCall) }"
|
|
300
303
|
/>
|
|
301
304
|
}
|
|
305
|
+
@if (renderConfig && renderConfig.type === "humanInTheLoopTool" && renderConfig.config.component) {
|
|
306
|
+
<ng-container
|
|
307
|
+
*ngComponentOutlet="
|
|
308
|
+
renderConfig.config.component;
|
|
309
|
+
inputs: { toolCall: buildHumanInTheLoopToolCall(toolCall) }
|
|
310
|
+
"
|
|
311
|
+
/>
|
|
312
|
+
}
|
|
302
313
|
}
|
|
303
314
|
`,
|
|
304
315
|
}]
|
|
@@ -2940,23 +2951,13 @@ class CopilotChatUserMessageBranchNavigation {
|
|
|
2940
2951
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: CopilotChatUserMessageBranchNavigation, isStandalone: true, selector: "copilot-chat-user-message-branch-navigation", inputs: { currentBranch: { classPropertyName: "currentBranch", publicName: "currentBranch", isSignal: true, isRequired: false, transformFunction: null }, numberOfBranches: { classPropertyName: "numberOfBranches", publicName: "numberOfBranches", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { switchToBranch: "switchToBranch" }, ngImport: i0, template: `
|
|
2941
2952
|
@if (showNavigation()) {
|
|
2942
2953
|
<div [class]="computedClass()">
|
|
2943
|
-
<button
|
|
2944
|
-
type="button"
|
|
2945
|
-
[class]="buttonClass"
|
|
2946
|
-
[disabled]="!canGoPrev()"
|
|
2947
|
-
(click)="handlePrevious()"
|
|
2948
|
-
>
|
|
2954
|
+
<button type="button" [class]="buttonClass" [disabled]="!canGoPrev()" (click)="handlePrevious()">
|
|
2949
2955
|
<lucide-angular [img]="ChevronLeftIcon" [size]="20"></lucide-angular>
|
|
2950
2956
|
</button>
|
|
2951
2957
|
<span class="text-sm text-muted-foreground px-0 font-medium">
|
|
2952
2958
|
{{ currentBranch() + 1 }}/{{ numberOfBranches() }}
|
|
2953
2959
|
</span>
|
|
2954
|
-
<button
|
|
2955
|
-
type="button"
|
|
2956
|
-
[class]="buttonClass"
|
|
2957
|
-
[disabled]="!canGoNext()"
|
|
2958
|
-
(click)="handleNext()"
|
|
2959
|
-
>
|
|
2960
|
+
<button type="button" [class]="buttonClass" [disabled]="!canGoNext()" (click)="handleNext()">
|
|
2960
2961
|
<lucide-angular [img]="ChevronRightIcon" [size]="20"></lucide-angular>
|
|
2961
2962
|
</button>
|
|
2962
2963
|
</div>
|
|
@@ -2974,23 +2975,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2974
2975
|
template: `
|
|
2975
2976
|
@if (showNavigation()) {
|
|
2976
2977
|
<div [class]="computedClass()">
|
|
2977
|
-
<button
|
|
2978
|
-
type="button"
|
|
2979
|
-
[class]="buttonClass"
|
|
2980
|
-
[disabled]="!canGoPrev()"
|
|
2981
|
-
(click)="handlePrevious()"
|
|
2982
|
-
>
|
|
2978
|
+
<button type="button" [class]="buttonClass" [disabled]="!canGoPrev()" (click)="handlePrevious()">
|
|
2983
2979
|
<lucide-angular [img]="ChevronLeftIcon" [size]="20"></lucide-angular>
|
|
2984
2980
|
</button>
|
|
2985
2981
|
<span class="text-sm text-muted-foreground px-0 font-medium">
|
|
2986
2982
|
{{ currentBranch() + 1 }}/{{ numberOfBranches() }}
|
|
2987
2983
|
</span>
|
|
2988
|
-
<button
|
|
2989
|
-
type="button"
|
|
2990
|
-
[class]="buttonClass"
|
|
2991
|
-
[disabled]="!canGoNext()"
|
|
2992
|
-
(click)="handleNext()"
|
|
2993
|
-
>
|
|
2984
|
+
<button type="button" [class]="buttonClass" [disabled]="!canGoNext()" (click)="handleNext()">
|
|
2994
2985
|
<lucide-angular [img]="ChevronRightIcon" [size]="20"></lucide-angular>
|
|
2995
2986
|
</button>
|
|
2996
2987
|
</div>
|
|
@@ -2999,6 +2990,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2999
2990
|
}]
|
|
3000
2991
|
}] });
|
|
3001
2992
|
|
|
2993
|
+
function flattenUserMessageContent(content) {
|
|
2994
|
+
if (!content) {
|
|
2995
|
+
return "";
|
|
2996
|
+
}
|
|
2997
|
+
if (typeof content === "string") {
|
|
2998
|
+
return content;
|
|
2999
|
+
}
|
|
3000
|
+
return content
|
|
3001
|
+
.map((part) => {
|
|
3002
|
+
if (part &&
|
|
3003
|
+
typeof part === "object" &&
|
|
3004
|
+
"type" in part &&
|
|
3005
|
+
part.type === "text" &&
|
|
3006
|
+
typeof part.text === "string") {
|
|
3007
|
+
return part.text;
|
|
3008
|
+
}
|
|
3009
|
+
return "";
|
|
3010
|
+
})
|
|
3011
|
+
.filter((text) => text.length > 0)
|
|
3012
|
+
.join("\n");
|
|
3013
|
+
}
|
|
3002
3014
|
class CopilotChatUserMessage {
|
|
3003
3015
|
// Capture templates from content projection
|
|
3004
3016
|
messageRendererTemplate;
|
|
@@ -3040,8 +3052,9 @@ class CopilotChatUserMessage {
|
|
|
3040
3052
|
showBranchNavigation = computed(() => (this.numberOfBranches() ?? 1) > 1);
|
|
3041
3053
|
computedClass = computed(() => cn("flex flex-col items-end group pt-10", this.inputClass()));
|
|
3042
3054
|
// Context for slots (reactive via signals)
|
|
3055
|
+
flattenedContent = computed(() => flattenUserMessageContent(this.message()?.content));
|
|
3043
3056
|
messageRendererContext = computed(() => ({
|
|
3044
|
-
content: this.
|
|
3057
|
+
content: this.flattenedContent(),
|
|
3045
3058
|
}));
|
|
3046
3059
|
// Output maps for slots
|
|
3047
3060
|
copyButtonOutputs = { clicked: () => this.handleCopy() };
|
|
@@ -3078,10 +3091,7 @@ class CopilotChatUserMessage {
|
|
|
3078
3091
|
>
|
|
3079
3092
|
</copilot-slot>
|
|
3080
3093
|
} @else {
|
|
3081
|
-
<copilot-chat-user-message-renderer
|
|
3082
|
-
[content]="message()?.content || ''"
|
|
3083
|
-
[inputClass]="messageRendererClass()"
|
|
3084
|
-
>
|
|
3094
|
+
<copilot-chat-user-message-renderer [content]="flattenedContent()" [inputClass]="messageRendererClass()">
|
|
3085
3095
|
</copilot-chat-user-message-renderer>
|
|
3086
3096
|
}
|
|
3087
3097
|
|
|
@@ -3098,23 +3108,21 @@ class CopilotChatUserMessage {
|
|
|
3098
3108
|
<div class="flex items-center gap-1 justify-end">
|
|
3099
3109
|
<!-- Additional toolbar items -->
|
|
3100
3110
|
@if (additionalToolbarItems()) {
|
|
3101
|
-
<ng-container
|
|
3102
|
-
[ngTemplateOutlet]="additionalToolbarItems() || null"
|
|
3103
|
-
></ng-container>
|
|
3111
|
+
<ng-container [ngTemplateOutlet]="additionalToolbarItems() || null"></ng-container>
|
|
3104
3112
|
}
|
|
3105
3113
|
|
|
3106
3114
|
<!-- Copy button -->
|
|
3107
3115
|
@if (copyButtonTemplate || copyButtonComponent()) {
|
|
3108
3116
|
<copilot-slot
|
|
3109
3117
|
[slot]="copyButtonTemplate || copyButtonComponent()"
|
|
3110
|
-
[context]="{ content:
|
|
3118
|
+
[context]="{ content: flattenedContent() }"
|
|
3111
3119
|
[outputs]="copyButtonOutputs"
|
|
3112
3120
|
[defaultComponent]="CopilotChatUserMessageCopyButton"
|
|
3113
3121
|
>
|
|
3114
3122
|
</copilot-slot>
|
|
3115
3123
|
} @else {
|
|
3116
3124
|
<copilot-chat-user-message-copy-button
|
|
3117
|
-
[content]="
|
|
3125
|
+
[content]="flattenedContent()"
|
|
3118
3126
|
[inputClass]="copyButtonClass()"
|
|
3119
3127
|
(clicked)="handleCopy()"
|
|
3120
3128
|
>
|
|
@@ -3132,10 +3140,7 @@ class CopilotChatUserMessage {
|
|
|
3132
3140
|
>
|
|
3133
3141
|
</copilot-slot>
|
|
3134
3142
|
} @else {
|
|
3135
|
-
<copilot-chat-user-message-edit-button
|
|
3136
|
-
[inputClass]="editButtonClass()"
|
|
3137
|
-
(clicked)="handleEdit()"
|
|
3138
|
-
>
|
|
3143
|
+
<copilot-chat-user-message-edit-button [inputClass]="editButtonClass()" (clicked)="handleEdit()">
|
|
3139
3144
|
</copilot-chat-user-message-edit-button>
|
|
3140
3145
|
}
|
|
3141
3146
|
}
|
|
@@ -3144,9 +3149,7 @@ class CopilotChatUserMessage {
|
|
|
3144
3149
|
@if (showBranchNavigation()) {
|
|
3145
3150
|
@if (branchNavigationTemplate || branchNavigationComponent()) {
|
|
3146
3151
|
<copilot-slot
|
|
3147
|
-
[slot]="
|
|
3148
|
-
branchNavigationTemplate || branchNavigationComponent()
|
|
3149
|
-
"
|
|
3152
|
+
[slot]="branchNavigationTemplate || branchNavigationComponent()"
|
|
3150
3153
|
[context]="branchNavigationContext()"
|
|
3151
3154
|
[defaultComponent]="CopilotChatUserMessageBranchNavigation"
|
|
3152
3155
|
>
|
|
@@ -3189,10 +3192,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
3189
3192
|
>
|
|
3190
3193
|
</copilot-slot>
|
|
3191
3194
|
} @else {
|
|
3192
|
-
<copilot-chat-user-message-renderer
|
|
3193
|
-
[content]="message()?.content || ''"
|
|
3194
|
-
[inputClass]="messageRendererClass()"
|
|
3195
|
-
>
|
|
3195
|
+
<copilot-chat-user-message-renderer [content]="flattenedContent()" [inputClass]="messageRendererClass()">
|
|
3196
3196
|
</copilot-chat-user-message-renderer>
|
|
3197
3197
|
}
|
|
3198
3198
|
|
|
@@ -3209,23 +3209,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
3209
3209
|
<div class="flex items-center gap-1 justify-end">
|
|
3210
3210
|
<!-- Additional toolbar items -->
|
|
3211
3211
|
@if (additionalToolbarItems()) {
|
|
3212
|
-
<ng-container
|
|
3213
|
-
[ngTemplateOutlet]="additionalToolbarItems() || null"
|
|
3214
|
-
></ng-container>
|
|
3212
|
+
<ng-container [ngTemplateOutlet]="additionalToolbarItems() || null"></ng-container>
|
|
3215
3213
|
}
|
|
3216
3214
|
|
|
3217
3215
|
<!-- Copy button -->
|
|
3218
3216
|
@if (copyButtonTemplate || copyButtonComponent()) {
|
|
3219
3217
|
<copilot-slot
|
|
3220
3218
|
[slot]="copyButtonTemplate || copyButtonComponent()"
|
|
3221
|
-
[context]="{ content:
|
|
3219
|
+
[context]="{ content: flattenedContent() }"
|
|
3222
3220
|
[outputs]="copyButtonOutputs"
|
|
3223
3221
|
[defaultComponent]="CopilotChatUserMessageCopyButton"
|
|
3224
3222
|
>
|
|
3225
3223
|
</copilot-slot>
|
|
3226
3224
|
} @else {
|
|
3227
3225
|
<copilot-chat-user-message-copy-button
|
|
3228
|
-
[content]="
|
|
3226
|
+
[content]="flattenedContent()"
|
|
3229
3227
|
[inputClass]="copyButtonClass()"
|
|
3230
3228
|
(clicked)="handleCopy()"
|
|
3231
3229
|
>
|
|
@@ -3243,10 +3241,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
3243
3241
|
>
|
|
3244
3242
|
</copilot-slot>
|
|
3245
3243
|
} @else {
|
|
3246
|
-
<copilot-chat-user-message-edit-button
|
|
3247
|
-
[inputClass]="editButtonClass()"
|
|
3248
|
-
(clicked)="handleEdit()"
|
|
3249
|
-
>
|
|
3244
|
+
<copilot-chat-user-message-edit-button [inputClass]="editButtonClass()" (clicked)="handleEdit()">
|
|
3250
3245
|
</copilot-chat-user-message-edit-button>
|
|
3251
3246
|
}
|
|
3252
3247
|
}
|
|
@@ -3255,9 +3250,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
3255
3250
|
@if (showBranchNavigation()) {
|
|
3256
3251
|
@if (branchNavigationTemplate || branchNavigationComponent()) {
|
|
3257
3252
|
<copilot-slot
|
|
3258
|
-
[slot]="
|
|
3259
|
-
branchNavigationTemplate || branchNavigationComponent()
|
|
3260
|
-
"
|
|
3253
|
+
[slot]="branchNavigationTemplate || branchNavigationComponent()"
|
|
3261
3254
|
[context]="branchNavigationContext()"
|
|
3262
3255
|
[defaultComponent]="CopilotChatUserMessageBranchNavigation"
|
|
3263
3256
|
>
|