@copilotkitnext/angular 0.0.20 → 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/render-tool-calls.mjs +3 -2
- package/dist/fesm2022/copilotkitnext-angular.mjs +41 -58
- 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/package.json +7 -7
- package/vitest.config.mts.timestamp-1760727629337-603c9e5c1f334.mjs +0 -49
|
@@ -265,7 +265,8 @@ class RenderToolCalls {
|
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
#getToolMessage(toolCallId) {
|
|
268
|
-
|
|
268
|
+
const message = this.messages().find((m) => m.role === "tool" && m.toolCallId === toolCallId);
|
|
269
|
+
return message;
|
|
269
270
|
}
|
|
270
271
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: RenderToolCalls, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
271
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: `
|
|
@@ -2950,23 +2951,13 @@ class CopilotChatUserMessageBranchNavigation {
|
|
|
2950
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: `
|
|
2951
2952
|
@if (showNavigation()) {
|
|
2952
2953
|
<div [class]="computedClass()">
|
|
2953
|
-
<button
|
|
2954
|
-
type="button"
|
|
2955
|
-
[class]="buttonClass"
|
|
2956
|
-
[disabled]="!canGoPrev()"
|
|
2957
|
-
(click)="handlePrevious()"
|
|
2958
|
-
>
|
|
2954
|
+
<button type="button" [class]="buttonClass" [disabled]="!canGoPrev()" (click)="handlePrevious()">
|
|
2959
2955
|
<lucide-angular [img]="ChevronLeftIcon" [size]="20"></lucide-angular>
|
|
2960
2956
|
</button>
|
|
2961
2957
|
<span class="text-sm text-muted-foreground px-0 font-medium">
|
|
2962
2958
|
{{ currentBranch() + 1 }}/{{ numberOfBranches() }}
|
|
2963
2959
|
</span>
|
|
2964
|
-
<button
|
|
2965
|
-
type="button"
|
|
2966
|
-
[class]="buttonClass"
|
|
2967
|
-
[disabled]="!canGoNext()"
|
|
2968
|
-
(click)="handleNext()"
|
|
2969
|
-
>
|
|
2960
|
+
<button type="button" [class]="buttonClass" [disabled]="!canGoNext()" (click)="handleNext()">
|
|
2970
2961
|
<lucide-angular [img]="ChevronRightIcon" [size]="20"></lucide-angular>
|
|
2971
2962
|
</button>
|
|
2972
2963
|
</div>
|
|
@@ -2984,23 +2975,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2984
2975
|
template: `
|
|
2985
2976
|
@if (showNavigation()) {
|
|
2986
2977
|
<div [class]="computedClass()">
|
|
2987
|
-
<button
|
|
2988
|
-
type="button"
|
|
2989
|
-
[class]="buttonClass"
|
|
2990
|
-
[disabled]="!canGoPrev()"
|
|
2991
|
-
(click)="handlePrevious()"
|
|
2992
|
-
>
|
|
2978
|
+
<button type="button" [class]="buttonClass" [disabled]="!canGoPrev()" (click)="handlePrevious()">
|
|
2993
2979
|
<lucide-angular [img]="ChevronLeftIcon" [size]="20"></lucide-angular>
|
|
2994
2980
|
</button>
|
|
2995
2981
|
<span class="text-sm text-muted-foreground px-0 font-medium">
|
|
2996
2982
|
{{ currentBranch() + 1 }}/{{ numberOfBranches() }}
|
|
2997
2983
|
</span>
|
|
2998
|
-
<button
|
|
2999
|
-
type="button"
|
|
3000
|
-
[class]="buttonClass"
|
|
3001
|
-
[disabled]="!canGoNext()"
|
|
3002
|
-
(click)="handleNext()"
|
|
3003
|
-
>
|
|
2984
|
+
<button type="button" [class]="buttonClass" [disabled]="!canGoNext()" (click)="handleNext()">
|
|
3004
2985
|
<lucide-angular [img]="ChevronRightIcon" [size]="20"></lucide-angular>
|
|
3005
2986
|
</button>
|
|
3006
2987
|
</div>
|
|
@@ -3009,6 +2990,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
3009
2990
|
}]
|
|
3010
2991
|
}] });
|
|
3011
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
|
+
}
|
|
3012
3014
|
class CopilotChatUserMessage {
|
|
3013
3015
|
// Capture templates from content projection
|
|
3014
3016
|
messageRendererTemplate;
|
|
@@ -3050,8 +3052,9 @@ class CopilotChatUserMessage {
|
|
|
3050
3052
|
showBranchNavigation = computed(() => (this.numberOfBranches() ?? 1) > 1);
|
|
3051
3053
|
computedClass = computed(() => cn("flex flex-col items-end group pt-10", this.inputClass()));
|
|
3052
3054
|
// Context for slots (reactive via signals)
|
|
3055
|
+
flattenedContent = computed(() => flattenUserMessageContent(this.message()?.content));
|
|
3053
3056
|
messageRendererContext = computed(() => ({
|
|
3054
|
-
content: this.
|
|
3057
|
+
content: this.flattenedContent(),
|
|
3055
3058
|
}));
|
|
3056
3059
|
// Output maps for slots
|
|
3057
3060
|
copyButtonOutputs = { clicked: () => this.handleCopy() };
|
|
@@ -3088,10 +3091,7 @@ class CopilotChatUserMessage {
|
|
|
3088
3091
|
>
|
|
3089
3092
|
</copilot-slot>
|
|
3090
3093
|
} @else {
|
|
3091
|
-
<copilot-chat-user-message-renderer
|
|
3092
|
-
[content]="message()?.content || ''"
|
|
3093
|
-
[inputClass]="messageRendererClass()"
|
|
3094
|
-
>
|
|
3094
|
+
<copilot-chat-user-message-renderer [content]="flattenedContent()" [inputClass]="messageRendererClass()">
|
|
3095
3095
|
</copilot-chat-user-message-renderer>
|
|
3096
3096
|
}
|
|
3097
3097
|
|
|
@@ -3108,23 +3108,21 @@ class CopilotChatUserMessage {
|
|
|
3108
3108
|
<div class="flex items-center gap-1 justify-end">
|
|
3109
3109
|
<!-- Additional toolbar items -->
|
|
3110
3110
|
@if (additionalToolbarItems()) {
|
|
3111
|
-
<ng-container
|
|
3112
|
-
[ngTemplateOutlet]="additionalToolbarItems() || null"
|
|
3113
|
-
></ng-container>
|
|
3111
|
+
<ng-container [ngTemplateOutlet]="additionalToolbarItems() || null"></ng-container>
|
|
3114
3112
|
}
|
|
3115
3113
|
|
|
3116
3114
|
<!-- Copy button -->
|
|
3117
3115
|
@if (copyButtonTemplate || copyButtonComponent()) {
|
|
3118
3116
|
<copilot-slot
|
|
3119
3117
|
[slot]="copyButtonTemplate || copyButtonComponent()"
|
|
3120
|
-
[context]="{ content:
|
|
3118
|
+
[context]="{ content: flattenedContent() }"
|
|
3121
3119
|
[outputs]="copyButtonOutputs"
|
|
3122
3120
|
[defaultComponent]="CopilotChatUserMessageCopyButton"
|
|
3123
3121
|
>
|
|
3124
3122
|
</copilot-slot>
|
|
3125
3123
|
} @else {
|
|
3126
3124
|
<copilot-chat-user-message-copy-button
|
|
3127
|
-
[content]="
|
|
3125
|
+
[content]="flattenedContent()"
|
|
3128
3126
|
[inputClass]="copyButtonClass()"
|
|
3129
3127
|
(clicked)="handleCopy()"
|
|
3130
3128
|
>
|
|
@@ -3142,10 +3140,7 @@ class CopilotChatUserMessage {
|
|
|
3142
3140
|
>
|
|
3143
3141
|
</copilot-slot>
|
|
3144
3142
|
} @else {
|
|
3145
|
-
<copilot-chat-user-message-edit-button
|
|
3146
|
-
[inputClass]="editButtonClass()"
|
|
3147
|
-
(clicked)="handleEdit()"
|
|
3148
|
-
>
|
|
3143
|
+
<copilot-chat-user-message-edit-button [inputClass]="editButtonClass()" (clicked)="handleEdit()">
|
|
3149
3144
|
</copilot-chat-user-message-edit-button>
|
|
3150
3145
|
}
|
|
3151
3146
|
}
|
|
@@ -3154,9 +3149,7 @@ class CopilotChatUserMessage {
|
|
|
3154
3149
|
@if (showBranchNavigation()) {
|
|
3155
3150
|
@if (branchNavigationTemplate || branchNavigationComponent()) {
|
|
3156
3151
|
<copilot-slot
|
|
3157
|
-
[slot]="
|
|
3158
|
-
branchNavigationTemplate || branchNavigationComponent()
|
|
3159
|
-
"
|
|
3152
|
+
[slot]="branchNavigationTemplate || branchNavigationComponent()"
|
|
3160
3153
|
[context]="branchNavigationContext()"
|
|
3161
3154
|
[defaultComponent]="CopilotChatUserMessageBranchNavigation"
|
|
3162
3155
|
>
|
|
@@ -3199,10 +3192,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
3199
3192
|
>
|
|
3200
3193
|
</copilot-slot>
|
|
3201
3194
|
} @else {
|
|
3202
|
-
<copilot-chat-user-message-renderer
|
|
3203
|
-
[content]="message()?.content || ''"
|
|
3204
|
-
[inputClass]="messageRendererClass()"
|
|
3205
|
-
>
|
|
3195
|
+
<copilot-chat-user-message-renderer [content]="flattenedContent()" [inputClass]="messageRendererClass()">
|
|
3206
3196
|
</copilot-chat-user-message-renderer>
|
|
3207
3197
|
}
|
|
3208
3198
|
|
|
@@ -3219,23 +3209,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
3219
3209
|
<div class="flex items-center gap-1 justify-end">
|
|
3220
3210
|
<!-- Additional toolbar items -->
|
|
3221
3211
|
@if (additionalToolbarItems()) {
|
|
3222
|
-
<ng-container
|
|
3223
|
-
[ngTemplateOutlet]="additionalToolbarItems() || null"
|
|
3224
|
-
></ng-container>
|
|
3212
|
+
<ng-container [ngTemplateOutlet]="additionalToolbarItems() || null"></ng-container>
|
|
3225
3213
|
}
|
|
3226
3214
|
|
|
3227
3215
|
<!-- Copy button -->
|
|
3228
3216
|
@if (copyButtonTemplate || copyButtonComponent()) {
|
|
3229
3217
|
<copilot-slot
|
|
3230
3218
|
[slot]="copyButtonTemplate || copyButtonComponent()"
|
|
3231
|
-
[context]="{ content:
|
|
3219
|
+
[context]="{ content: flattenedContent() }"
|
|
3232
3220
|
[outputs]="copyButtonOutputs"
|
|
3233
3221
|
[defaultComponent]="CopilotChatUserMessageCopyButton"
|
|
3234
3222
|
>
|
|
3235
3223
|
</copilot-slot>
|
|
3236
3224
|
} @else {
|
|
3237
3225
|
<copilot-chat-user-message-copy-button
|
|
3238
|
-
[content]="
|
|
3226
|
+
[content]="flattenedContent()"
|
|
3239
3227
|
[inputClass]="copyButtonClass()"
|
|
3240
3228
|
(clicked)="handleCopy()"
|
|
3241
3229
|
>
|
|
@@ -3253,10 +3241,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
3253
3241
|
>
|
|
3254
3242
|
</copilot-slot>
|
|
3255
3243
|
} @else {
|
|
3256
|
-
<copilot-chat-user-message-edit-button
|
|
3257
|
-
[inputClass]="editButtonClass()"
|
|
3258
|
-
(clicked)="handleEdit()"
|
|
3259
|
-
>
|
|
3244
|
+
<copilot-chat-user-message-edit-button [inputClass]="editButtonClass()" (clicked)="handleEdit()">
|
|
3260
3245
|
</copilot-chat-user-message-edit-button>
|
|
3261
3246
|
}
|
|
3262
3247
|
}
|
|
@@ -3265,9 +3250,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
3265
3250
|
@if (showBranchNavigation()) {
|
|
3266
3251
|
@if (branchNavigationTemplate || branchNavigationComponent()) {
|
|
3267
3252
|
<copilot-slot
|
|
3268
|
-
[slot]="
|
|
3269
|
-
branchNavigationTemplate || branchNavigationComponent()
|
|
3270
|
-
"
|
|
3253
|
+
[slot]="branchNavigationTemplate || branchNavigationComponent()"
|
|
3271
3254
|
[context]="branchNavigationContext()"
|
|
3272
3255
|
[defaultComponent]="CopilotChatUserMessageBranchNavigation"
|
|
3273
3256
|
>
|