@copilotkitnext/angular 0.0.18 → 0.0.19-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
|
@@ -271,7 +271,8 @@ class RenderToolCalls {
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
#getToolMessage(toolCallId) {
|
|
274
|
-
|
|
274
|
+
const message = this.messages().find((m) => m.role === "tool" && m.toolCallId === toolCallId);
|
|
275
|
+
return message;
|
|
275
276
|
}
|
|
276
277
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: RenderToolCalls, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
277
278
|
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: `
|
|
@@ -2917,23 +2918,13 @@ class CopilotChatUserMessageBranchNavigation {
|
|
|
2917
2918
|
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: `
|
|
2918
2919
|
@if (showNavigation()) {
|
|
2919
2920
|
<div [class]="computedClass()">
|
|
2920
|
-
<button
|
|
2921
|
-
type="button"
|
|
2922
|
-
[class]="buttonClass"
|
|
2923
|
-
[disabled]="!canGoPrev()"
|
|
2924
|
-
(click)="handlePrevious()"
|
|
2925
|
-
>
|
|
2921
|
+
<button type="button" [class]="buttonClass" [disabled]="!canGoPrev()" (click)="handlePrevious()">
|
|
2926
2922
|
<lucide-angular [img]="ChevronLeftIcon" [size]="20"></lucide-angular>
|
|
2927
2923
|
</button>
|
|
2928
2924
|
<span class="text-sm text-muted-foreground px-0 font-medium">
|
|
2929
2925
|
{{ currentBranch() + 1 }}/{{ numberOfBranches() }}
|
|
2930
2926
|
</span>
|
|
2931
|
-
<button
|
|
2932
|
-
type="button"
|
|
2933
|
-
[class]="buttonClass"
|
|
2934
|
-
[disabled]="!canGoNext()"
|
|
2935
|
-
(click)="handleNext()"
|
|
2936
|
-
>
|
|
2927
|
+
<button type="button" [class]="buttonClass" [disabled]="!canGoNext()" (click)="handleNext()">
|
|
2937
2928
|
<lucide-angular [img]="ChevronRightIcon" [size]="20"></lucide-angular>
|
|
2938
2929
|
</button>
|
|
2939
2930
|
</div>
|
|
@@ -2951,23 +2942,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2951
2942
|
template: `
|
|
2952
2943
|
@if (showNavigation()) {
|
|
2953
2944
|
<div [class]="computedClass()">
|
|
2954
|
-
<button
|
|
2955
|
-
type="button"
|
|
2956
|
-
[class]="buttonClass"
|
|
2957
|
-
[disabled]="!canGoPrev()"
|
|
2958
|
-
(click)="handlePrevious()"
|
|
2959
|
-
>
|
|
2945
|
+
<button type="button" [class]="buttonClass" [disabled]="!canGoPrev()" (click)="handlePrevious()">
|
|
2960
2946
|
<lucide-angular [img]="ChevronLeftIcon" [size]="20"></lucide-angular>
|
|
2961
2947
|
</button>
|
|
2962
2948
|
<span class="text-sm text-muted-foreground px-0 font-medium">
|
|
2963
2949
|
{{ currentBranch() + 1 }}/{{ numberOfBranches() }}
|
|
2964
2950
|
</span>
|
|
2965
|
-
<button
|
|
2966
|
-
type="button"
|
|
2967
|
-
[class]="buttonClass"
|
|
2968
|
-
[disabled]="!canGoNext()"
|
|
2969
|
-
(click)="handleNext()"
|
|
2970
|
-
>
|
|
2951
|
+
<button type="button" [class]="buttonClass" [disabled]="!canGoNext()" (click)="handleNext()">
|
|
2971
2952
|
<lucide-angular [img]="ChevronRightIcon" [size]="20"></lucide-angular>
|
|
2972
2953
|
</button>
|
|
2973
2954
|
</div>
|
|
@@ -2976,6 +2957,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2976
2957
|
}]
|
|
2977
2958
|
}] });
|
|
2978
2959
|
|
|
2960
|
+
function flattenUserMessageContent(content) {
|
|
2961
|
+
if (!content) {
|
|
2962
|
+
return "";
|
|
2963
|
+
}
|
|
2964
|
+
if (typeof content === "string") {
|
|
2965
|
+
return content;
|
|
2966
|
+
}
|
|
2967
|
+
return content
|
|
2968
|
+
.map((part) => {
|
|
2969
|
+
if (part &&
|
|
2970
|
+
typeof part === "object" &&
|
|
2971
|
+
"type" in part &&
|
|
2972
|
+
part.type === "text" &&
|
|
2973
|
+
typeof part.text === "string") {
|
|
2974
|
+
return part.text;
|
|
2975
|
+
}
|
|
2976
|
+
return "";
|
|
2977
|
+
})
|
|
2978
|
+
.filter((text) => text.length > 0)
|
|
2979
|
+
.join("\n");
|
|
2980
|
+
}
|
|
2979
2981
|
class CopilotChatUserMessage {
|
|
2980
2982
|
// Capture templates from content projection
|
|
2981
2983
|
messageRendererTemplate;
|
|
@@ -3017,8 +3019,9 @@ class CopilotChatUserMessage {
|
|
|
3017
3019
|
showBranchNavigation = computed(() => (this.numberOfBranches() ?? 1) > 1);
|
|
3018
3020
|
computedClass = computed(() => cn("flex flex-col items-end group pt-10", this.inputClass()));
|
|
3019
3021
|
// Context for slots (reactive via signals)
|
|
3022
|
+
flattenedContent = computed(() => flattenUserMessageContent(this.message()?.content));
|
|
3020
3023
|
messageRendererContext = computed(() => ({
|
|
3021
|
-
content: this.
|
|
3024
|
+
content: this.flattenedContent(),
|
|
3022
3025
|
}));
|
|
3023
3026
|
// Output maps for slots
|
|
3024
3027
|
copyButtonOutputs = { clicked: () => this.handleCopy() };
|
|
@@ -3055,10 +3058,7 @@ class CopilotChatUserMessage {
|
|
|
3055
3058
|
>
|
|
3056
3059
|
</copilot-slot>
|
|
3057
3060
|
} @else {
|
|
3058
|
-
<copilot-chat-user-message-renderer
|
|
3059
|
-
[content]="message()?.content || ''"
|
|
3060
|
-
[inputClass]="messageRendererClass()"
|
|
3061
|
-
>
|
|
3061
|
+
<copilot-chat-user-message-renderer [content]="flattenedContent()" [inputClass]="messageRendererClass()">
|
|
3062
3062
|
</copilot-chat-user-message-renderer>
|
|
3063
3063
|
}
|
|
3064
3064
|
|
|
@@ -3075,23 +3075,21 @@ class CopilotChatUserMessage {
|
|
|
3075
3075
|
<div class="flex items-center gap-1 justify-end">
|
|
3076
3076
|
<!-- Additional toolbar items -->
|
|
3077
3077
|
@if (additionalToolbarItems()) {
|
|
3078
|
-
<ng-container
|
|
3079
|
-
[ngTemplateOutlet]="additionalToolbarItems() || null"
|
|
3080
|
-
></ng-container>
|
|
3078
|
+
<ng-container [ngTemplateOutlet]="additionalToolbarItems() || null"></ng-container>
|
|
3081
3079
|
}
|
|
3082
3080
|
|
|
3083
3081
|
<!-- Copy button -->
|
|
3084
3082
|
@if (copyButtonTemplate || copyButtonComponent()) {
|
|
3085
3083
|
<copilot-slot
|
|
3086
3084
|
[slot]="copyButtonTemplate || copyButtonComponent()"
|
|
3087
|
-
[context]="{ content:
|
|
3085
|
+
[context]="{ content: flattenedContent() }"
|
|
3088
3086
|
[outputs]="copyButtonOutputs"
|
|
3089
3087
|
[defaultComponent]="CopilotChatUserMessageCopyButton"
|
|
3090
3088
|
>
|
|
3091
3089
|
</copilot-slot>
|
|
3092
3090
|
} @else {
|
|
3093
3091
|
<copilot-chat-user-message-copy-button
|
|
3094
|
-
[content]="
|
|
3092
|
+
[content]="flattenedContent()"
|
|
3095
3093
|
[inputClass]="copyButtonClass()"
|
|
3096
3094
|
(clicked)="handleCopy()"
|
|
3097
3095
|
>
|
|
@@ -3109,10 +3107,7 @@ class CopilotChatUserMessage {
|
|
|
3109
3107
|
>
|
|
3110
3108
|
</copilot-slot>
|
|
3111
3109
|
} @else {
|
|
3112
|
-
<copilot-chat-user-message-edit-button
|
|
3113
|
-
[inputClass]="editButtonClass()"
|
|
3114
|
-
(clicked)="handleEdit()"
|
|
3115
|
-
>
|
|
3110
|
+
<copilot-chat-user-message-edit-button [inputClass]="editButtonClass()" (clicked)="handleEdit()">
|
|
3116
3111
|
</copilot-chat-user-message-edit-button>
|
|
3117
3112
|
}
|
|
3118
3113
|
}
|
|
@@ -3121,9 +3116,7 @@ class CopilotChatUserMessage {
|
|
|
3121
3116
|
@if (showBranchNavigation()) {
|
|
3122
3117
|
@if (branchNavigationTemplate || branchNavigationComponent()) {
|
|
3123
3118
|
<copilot-slot
|
|
3124
|
-
[slot]="
|
|
3125
|
-
branchNavigationTemplate || branchNavigationComponent()
|
|
3126
|
-
"
|
|
3119
|
+
[slot]="branchNavigationTemplate || branchNavigationComponent()"
|
|
3127
3120
|
[context]="branchNavigationContext()"
|
|
3128
3121
|
[defaultComponent]="CopilotChatUserMessageBranchNavigation"
|
|
3129
3122
|
>
|
|
@@ -3166,10 +3159,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
3166
3159
|
>
|
|
3167
3160
|
</copilot-slot>
|
|
3168
3161
|
} @else {
|
|
3169
|
-
<copilot-chat-user-message-renderer
|
|
3170
|
-
[content]="message()?.content || ''"
|
|
3171
|
-
[inputClass]="messageRendererClass()"
|
|
3172
|
-
>
|
|
3162
|
+
<copilot-chat-user-message-renderer [content]="flattenedContent()" [inputClass]="messageRendererClass()">
|
|
3173
3163
|
</copilot-chat-user-message-renderer>
|
|
3174
3164
|
}
|
|
3175
3165
|
|
|
@@ -3186,23 +3176,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
3186
3176
|
<div class="flex items-center gap-1 justify-end">
|
|
3187
3177
|
<!-- Additional toolbar items -->
|
|
3188
3178
|
@if (additionalToolbarItems()) {
|
|
3189
|
-
<ng-container
|
|
3190
|
-
[ngTemplateOutlet]="additionalToolbarItems() || null"
|
|
3191
|
-
></ng-container>
|
|
3179
|
+
<ng-container [ngTemplateOutlet]="additionalToolbarItems() || null"></ng-container>
|
|
3192
3180
|
}
|
|
3193
3181
|
|
|
3194
3182
|
<!-- Copy button -->
|
|
3195
3183
|
@if (copyButtonTemplate || copyButtonComponent()) {
|
|
3196
3184
|
<copilot-slot
|
|
3197
3185
|
[slot]="copyButtonTemplate || copyButtonComponent()"
|
|
3198
|
-
[context]="{ content:
|
|
3186
|
+
[context]="{ content: flattenedContent() }"
|
|
3199
3187
|
[outputs]="copyButtonOutputs"
|
|
3200
3188
|
[defaultComponent]="CopilotChatUserMessageCopyButton"
|
|
3201
3189
|
>
|
|
3202
3190
|
</copilot-slot>
|
|
3203
3191
|
} @else {
|
|
3204
3192
|
<copilot-chat-user-message-copy-button
|
|
3205
|
-
[content]="
|
|
3193
|
+
[content]="flattenedContent()"
|
|
3206
3194
|
[inputClass]="copyButtonClass()"
|
|
3207
3195
|
(clicked)="handleCopy()"
|
|
3208
3196
|
>
|
|
@@ -3220,10 +3208,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
3220
3208
|
>
|
|
3221
3209
|
</copilot-slot>
|
|
3222
3210
|
} @else {
|
|
3223
|
-
<copilot-chat-user-message-edit-button
|
|
3224
|
-
[inputClass]="editButtonClass()"
|
|
3225
|
-
(clicked)="handleEdit()"
|
|
3226
|
-
>
|
|
3211
|
+
<copilot-chat-user-message-edit-button [inputClass]="editButtonClass()" (clicked)="handleEdit()">
|
|
3227
3212
|
</copilot-chat-user-message-edit-button>
|
|
3228
3213
|
}
|
|
3229
3214
|
}
|
|
@@ -3232,9 +3217,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
3232
3217
|
@if (showBranchNavigation()) {
|
|
3233
3218
|
@if (branchNavigationTemplate || branchNavigationComponent()) {
|
|
3234
3219
|
<copilot-slot
|
|
3235
|
-
[slot]="
|
|
3236
|
-
branchNavigationTemplate || branchNavigationComponent()
|
|
3237
|
-
"
|
|
3220
|
+
[slot]="branchNavigationTemplate || branchNavigationComponent()"
|
|
3238
3221
|
[context]="branchNavigationContext()"
|
|
3239
3222
|
[defaultComponent]="CopilotChatUserMessageBranchNavigation"
|
|
3240
3223
|
>
|