@copilotkitnext/angular 0.0.1 → 0.0.4
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/README.md +248 -0
- package/dist/README.md +248 -0
- package/dist/components/chat/copilot-chat-assistant-message.component.d.ts +10 -10
- package/dist/components/chat/copilot-chat-message-view.component.d.ts +42 -42
- package/dist/components/chat/copilot-chat-view.component.d.ts +14 -14
- package/dist/esm2022/components/chat/copilot-chat-assistant-message-buttons.component.mjs +384 -0
- package/dist/esm2022/components/chat/copilot-chat-assistant-message-renderer.component.mjs +286 -0
- package/dist/esm2022/components/chat/copilot-chat-assistant-message-toolbar.component.mjs +27 -0
- package/dist/esm2022/components/chat/copilot-chat-assistant-message.component.mjs +433 -0
- package/dist/esm2022/components/chat/copilot-chat-assistant-message.types.mjs +2 -0
- package/dist/esm2022/components/chat/copilot-chat-audio-recorder.component.mjs +202 -0
- package/dist/esm2022/components/chat/copilot-chat-buttons.component.mjs +321 -0
- package/dist/esm2022/components/chat/copilot-chat-input-defaults.mjs +38 -0
- package/dist/esm2022/components/chat/copilot-chat-input.component.mjs +666 -0
- package/dist/esm2022/components/chat/copilot-chat-input.types.mjs +10 -0
- package/dist/esm2022/components/chat/copilot-chat-message-view-cursor.component.mjs +45 -0
- package/dist/esm2022/components/chat/copilot-chat-message-view.component.mjs +296 -0
- package/dist/esm2022/components/chat/copilot-chat-message-view.types.mjs +2 -0
- package/dist/esm2022/components/chat/copilot-chat-textarea.component.mjs +188 -0
- package/dist/esm2022/components/chat/copilot-chat-tool-calls-view.component.mjs +216 -0
- package/dist/esm2022/components/chat/copilot-chat-toolbar.component.mjs +25 -0
- package/dist/esm2022/components/chat/copilot-chat-tools-menu.component.mjs +199 -0
- package/dist/esm2022/components/chat/copilot-chat-user-message-branch-navigation.component.mjs +137 -0
- package/dist/esm2022/components/chat/copilot-chat-user-message-buttons.component.mjs +207 -0
- package/dist/esm2022/components/chat/copilot-chat-user-message-renderer.component.mjs +35 -0
- package/dist/esm2022/components/chat/copilot-chat-user-message-toolbar.component.mjs +34 -0
- package/dist/esm2022/components/chat/copilot-chat-user-message.component.mjs +341 -0
- package/dist/esm2022/components/chat/copilot-chat-user-message.types.mjs +2 -0
- package/dist/esm2022/components/chat/copilot-chat-view-disclaimer.component.mjs +52 -0
- package/dist/esm2022/components/chat/copilot-chat-view-feather.component.mjs +55 -0
- package/dist/esm2022/components/chat/copilot-chat-view-handlers.service.mjs +19 -0
- package/dist/esm2022/components/chat/copilot-chat-view-input-container.component.mjs +110 -0
- package/dist/esm2022/components/chat/copilot-chat-view-scroll-to-bottom-button.component.mjs +93 -0
- package/dist/esm2022/components/chat/copilot-chat-view-scroll-view.component.mjs +443 -0
- package/dist/esm2022/components/chat/copilot-chat-view.component.mjs +479 -0
- package/dist/esm2022/components/chat/copilot-chat-view.types.mjs +2 -0
- package/dist/esm2022/components/chat/copilot-chat.component.mjs +214 -0
- package/dist/esm2022/components/copilotkit-tool-render.component.mjs +153 -0
- package/dist/esm2022/copilotkitnext-angular.mjs +5 -0
- package/dist/esm2022/core/chat-configuration/chat-configuration.providers.mjs +65 -0
- package/dist/esm2022/core/chat-configuration/chat-configuration.service.mjs +145 -0
- package/dist/esm2022/core/chat-configuration/chat-configuration.types.mjs +26 -0
- package/dist/esm2022/core/copilotkit.providers.mjs +34 -0
- package/dist/esm2022/core/copilotkit.service.mjs +430 -0
- package/dist/esm2022/core/copilotkit.types.mjs +12 -0
- package/dist/esm2022/directives/copilotkit-agent-context.directive.mjs +130 -0
- package/dist/esm2022/directives/copilotkit-agent.directive.mjs +217 -0
- package/dist/esm2022/directives/copilotkit-chat-config.directive.mjs +218 -0
- package/dist/esm2022/directives/copilotkit-config.directive.mjs +94 -0
- package/dist/esm2022/directives/copilotkit-frontend-tool.directive.mjs +130 -0
- package/dist/esm2022/directives/copilotkit-human-in-the-loop.directive.mjs +266 -0
- package/dist/esm2022/directives/stick-to-bottom.directive.mjs +181 -0
- package/dist/esm2022/index.mjs +70 -0
- package/dist/esm2022/lib/directives/tooltip.directive.mjs +211 -0
- package/dist/esm2022/lib/slots/copilot-slot.component.mjs +144 -0
- package/dist/esm2022/lib/slots/slot.types.mjs +6 -0
- package/dist/esm2022/lib/slots/slot.utils.mjs +222 -0
- package/dist/esm2022/lib/utils.mjs +10 -0
- package/dist/esm2022/services/resize-observer.service.mjs +152 -0
- package/dist/esm2022/services/scroll-position.service.mjs +124 -0
- package/dist/esm2022/types/frontend-tool.mjs +2 -0
- package/dist/esm2022/types/human-in-the-loop.mjs +2 -0
- package/dist/esm2022/utils/agent-context.utils.mjs +114 -0
- package/dist/esm2022/utils/agent.utils.mjs +204 -0
- package/dist/esm2022/utils/chat-config.utils.mjs +186 -0
- package/dist/esm2022/utils/copilotkit.utils.mjs +20 -0
- package/dist/esm2022/utils/frontend-tool.utils.mjs +228 -0
- package/dist/esm2022/utils/human-in-the-loop.utils.mjs +296 -0
- package/dist/fesm2022/copilotkitnext-angular.mjs +163 -164
- package/dist/fesm2022/copilotkitnext-angular.mjs.map +1 -1
- package/dist/styles.css +0 -27
- package/package.json +23 -20
- package/vitest.config.mts +32 -21
- package/.turbo/turbo-build.log +0 -39
- package/.turbo/turbo-check-types.log +0 -0
- package/.turbo/turbo-test.log +0 -71
- package/README-agent-context.md +0 -310
- package/ng-package.json +0 -19
- package/slots.md +0 -331
- package/src/components/chat/__tests__/copilot-chat-assistant-message.component.spec.ts +0 -282
- package/src/components/chat/__tests__/copilot-chat-input.component.spec.ts +0 -419
- package/src/components/chat/__tests__/copilot-chat-message-view.component.spec.ts +0 -372
- package/src/components/chat/__tests__/copilot-chat-user-message.component.spec.ts +0 -249
- package/src/components/chat/copilot-chat-assistant-message-buttons.component.ts +0 -292
- package/src/components/chat/copilot-chat-assistant-message-renderer.component.ts +0 -472
- package/src/components/chat/copilot-chat-assistant-message-toolbar.component.ts +0 -29
- package/src/components/chat/copilot-chat-assistant-message.component.ts +0 -463
- package/src/components/chat/copilot-chat-assistant-message.types.ts +0 -50
- package/src/components/chat/copilot-chat-audio-recorder.component.ts +0 -241
- package/src/components/chat/copilot-chat-buttons.component.ts +0 -308
- package/src/components/chat/copilot-chat-buttons.component.ts.bak +0 -471
- package/src/components/chat/copilot-chat-input-defaults.ts +0 -47
- package/src/components/chat/copilot-chat-input.component.ts +0 -512
- package/src/components/chat/copilot-chat-input.types.ts +0 -148
- package/src/components/chat/copilot-chat-message-view-cursor.component.ts +0 -51
- package/src/components/chat/copilot-chat-message-view.component.ts +0 -233
- package/src/components/chat/copilot-chat-message-view.types.ts +0 -39
- package/src/components/chat/copilot-chat-textarea.component.ts +0 -220
- package/src/components/chat/copilot-chat-tool-calls-view.component.ts +0 -261
- package/src/components/chat/copilot-chat-toolbar.component.ts +0 -35
- package/src/components/chat/copilot-chat-tools-menu.component.ts +0 -185
- package/src/components/chat/copilot-chat-user-message-branch-navigation.component.ts +0 -121
- package/src/components/chat/copilot-chat-user-message-buttons.component.ts +0 -170
- package/src/components/chat/copilot-chat-user-message-renderer.component.ts +0 -37
- package/src/components/chat/copilot-chat-user-message-toolbar.component.ts +0 -37
- package/src/components/chat/copilot-chat-user-message.component.ts +0 -247
- package/src/components/chat/copilot-chat-user-message.types.ts +0 -42
- package/src/components/chat/copilot-chat-view-disclaimer.component.ts +0 -51
- package/src/components/chat/copilot-chat-view-feather.component.ts +0 -47
- package/src/components/chat/copilot-chat-view-handlers.service.ts +0 -14
- package/src/components/chat/copilot-chat-view-input-container.component.ts +0 -87
- package/src/components/chat/copilot-chat-view-scroll-to-bottom-button.component.ts +0 -79
- package/src/components/chat/copilot-chat-view-scroll-view.component.ts +0 -322
- package/src/components/chat/copilot-chat-view.component.ts +0 -420
- package/src/components/chat/copilot-chat-view.types.ts +0 -52
- package/src/components/chat/copilot-chat.component.ts +0 -232
- package/src/components/copilotkit-tool-render.component.ts +0 -169
- package/src/core/__tests__/copilotkit.service.spec.ts +0 -1051
- package/src/core/__tests__/copilotkit.service.wildcard.spec.ts +0 -316
- package/src/core/chat-configuration/__tests__/chat-configuration.service.spec.ts +0 -287
- package/src/core/chat-configuration/chat-configuration.providers.ts +0 -71
- package/src/core/chat-configuration/chat-configuration.service.ts +0 -162
- package/src/core/chat-configuration/chat-configuration.types.ts +0 -57
- package/src/core/copilotkit.providers.ts +0 -59
- package/src/core/copilotkit.service.ts +0 -542
- package/src/core/copilotkit.types.ts +0 -132
- package/src/directives/__tests__/copilotkit-agent-context.directive.spec.ts +0 -384
- package/src/directives/__tests__/copilotkit-agent.directive.spec.ts +0 -253
- package/src/directives/__tests__/copilotkit-chat-config.directive.spec.ts +0 -385
- package/src/directives/__tests__/copilotkit-config.directive.spec.ts +0 -69
- package/src/directives/__tests__/copilotkit-frontend-tool-simple.directive.spec.ts +0 -60
- package/src/directives/__tests__/copilotkit-frontend-tool.directive.spec.ts +0 -108
- package/src/directives/__tests__/copilotkit-human-in-the-loop.directive.spec.ts +0 -452
- package/src/directives/copilotkit-agent-context.directive.ts +0 -138
- package/src/directives/copilotkit-agent.directive.ts +0 -225
- package/src/directives/copilotkit-chat-config.directive.ts +0 -241
- package/src/directives/copilotkit-config.directive.ts +0 -81
- package/src/directives/copilotkit-frontend-tool.directive.ts +0 -145
- package/src/directives/copilotkit-human-in-the-loop.directive.ts +0 -281
- package/src/directives/stick-to-bottom.directive.ts +0 -204
- package/src/index.ts +0 -105
- package/src/lib/directives/tooltip.directive.ts +0 -292
- package/src/lib/slots/__tests__/slot.utils.spec.ts +0 -377
- package/src/lib/slots/copilot-slot.component.ts +0 -135
- package/src/lib/slots/index.ts +0 -3
- package/src/lib/slots/slot.types.ts +0 -64
- package/src/lib/slots/slot.utils.ts +0 -289
- package/src/lib/utils.ts +0 -10
- package/src/public-api.ts +0 -1
- package/src/services/resize-observer.service.ts +0 -181
- package/src/services/scroll-position.service.ts +0 -169
- package/src/styles/globals.css +0 -266
- package/src/styles/index.css +0 -3
- package/src/test-setup.ts +0 -15
- package/src/testing/index.ts +0 -3
- package/src/testing/testing.utils.ts +0 -248
- package/src/types/frontend-tool.ts +0 -44
- package/src/types/human-in-the-loop.ts +0 -52
- package/src/utils/__tests__/agent.utils.spec.ts +0 -234
- package/src/utils/__tests__/chat-config.utils.spec.ts +0 -306
- package/src/utils/__tests__/frontend-tool-inject.spec.ts +0 -350
- package/src/utils/__tests__/frontend-tool-integration.spec.ts +0 -199
- package/src/utils/__tests__/frontend-tool.utils.spec.ts +0 -272
- package/src/utils/__tests__/human-in-the-loop.utils.spec.ts +0 -365
- package/src/utils/agent-context.utils.ts +0 -133
- package/src/utils/agent.utils.ts +0 -239
- package/src/utils/chat-config.utils.ts +0 -221
- package/src/utils/copilotkit.utils.ts +0 -20
- package/src/utils/frontend-tool.utils.ts +0 -266
- package/src/utils/human-in-the-loop.utils.ts +0 -359
- package/tsconfig.spec.json +0 -12
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { Injectable, Inject, Optional, signal } from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
CopilotChatConfiguration,
|
|
4
|
-
CopilotChatLabels,
|
|
5
|
-
COPILOT_CHAT_DEFAULT_LABELS,
|
|
6
|
-
COPILOT_CHAT_INITIAL_CONFIG
|
|
7
|
-
} from './chat-configuration.types';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Service for managing CopilotKit chat configuration.
|
|
11
|
-
* Can be provided at different component levels for scoped configuration.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* // Global configuration
|
|
16
|
-
* providers: [provideCopilotChatConfiguration({ labels: { ... } })]
|
|
17
|
-
*
|
|
18
|
-
* // Component-scoped configuration
|
|
19
|
-
* @Component({
|
|
20
|
-
* providers: [provideCopilotChatConfiguration()],
|
|
21
|
-
* ...
|
|
22
|
-
* })
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
@Injectable()
|
|
26
|
-
export class CopilotChatConfigurationService {
|
|
27
|
-
// State signals
|
|
28
|
-
private readonly _labels: ReturnType<typeof signal<CopilotChatLabels>>;
|
|
29
|
-
private readonly _inputValue: ReturnType<typeof signal<string | undefined>>;
|
|
30
|
-
private readonly _onSubmitInput: ReturnType<typeof signal<((value: string) => void) | undefined>>;
|
|
31
|
-
private readonly _onChangeInput: ReturnType<typeof signal<((value: string) => void) | undefined>>;
|
|
32
|
-
|
|
33
|
-
// Public readonly signals
|
|
34
|
-
readonly labels: ReturnType<typeof signal<CopilotChatLabels>>['asReadonly'] extends () => infer R ? R : never;
|
|
35
|
-
readonly inputValue: ReturnType<typeof signal<string | undefined>>['asReadonly'] extends () => infer R ? R : never;
|
|
36
|
-
|
|
37
|
-
constructor(
|
|
38
|
-
@Optional() @Inject(COPILOT_CHAT_INITIAL_CONFIG) private readonly initialConfig: CopilotChatConfiguration | null
|
|
39
|
-
) {
|
|
40
|
-
// Initialize state signals
|
|
41
|
-
this._labels = signal<CopilotChatLabels>(
|
|
42
|
-
this.mergeLabels(this.initialConfig?.labels)
|
|
43
|
-
);
|
|
44
|
-
this._inputValue = signal<string | undefined>(
|
|
45
|
-
this.initialConfig?.inputValue
|
|
46
|
-
);
|
|
47
|
-
this._onSubmitInput = signal<((value: string) => void) | undefined>(
|
|
48
|
-
this.initialConfig?.onSubmitInput
|
|
49
|
-
);
|
|
50
|
-
this._onChangeInput = signal<((value: string) => void) | undefined>(
|
|
51
|
-
this.initialConfig?.onChangeInput
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
// Initialize public readonly signals
|
|
55
|
-
this.labels = this._labels.asReadonly();
|
|
56
|
-
this.inputValue = this._inputValue.asReadonly();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Update chat labels (partial update, merged with defaults)
|
|
61
|
-
*/
|
|
62
|
-
setLabels(labels: Partial<CopilotChatLabels>): void {
|
|
63
|
-
this._labels.set(this.mergeLabels(labels));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Update the current input value
|
|
68
|
-
*/
|
|
69
|
-
setInputValue(value: string | undefined): void {
|
|
70
|
-
this._inputValue.set(value);
|
|
71
|
-
// Also trigger change handler if set
|
|
72
|
-
if (value !== undefined) {
|
|
73
|
-
this.changeInput(value);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Set the submit input handler
|
|
79
|
-
*/
|
|
80
|
-
setSubmitHandler(handler: ((value: string) => void) | undefined): void {
|
|
81
|
-
this._onSubmitInput.set(handler);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Set the change input handler
|
|
86
|
-
*/
|
|
87
|
-
setChangeHandler(handler: ((value: string) => void) | undefined): void {
|
|
88
|
-
this._onChangeInput.set(handler);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Submit the current input value
|
|
93
|
-
*/
|
|
94
|
-
submitInput(value: string): void {
|
|
95
|
-
const handler = this._onSubmitInput();
|
|
96
|
-
if (handler) {
|
|
97
|
-
handler(value);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Handle input value change
|
|
103
|
-
*/
|
|
104
|
-
changeInput(value: string): void {
|
|
105
|
-
const handler = this._onChangeInput();
|
|
106
|
-
if (handler) {
|
|
107
|
-
handler(value);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Update the entire configuration at once
|
|
113
|
-
*/
|
|
114
|
-
updateConfiguration(config: CopilotChatConfiguration): void {
|
|
115
|
-
if (config.labels) {
|
|
116
|
-
this.setLabels(config.labels);
|
|
117
|
-
}
|
|
118
|
-
if (config.inputValue !== undefined) {
|
|
119
|
-
this._inputValue.set(config.inputValue);
|
|
120
|
-
}
|
|
121
|
-
if (config.onSubmitInput) {
|
|
122
|
-
this.setSubmitHandler(config.onSubmitInput);
|
|
123
|
-
}
|
|
124
|
-
if (config.onChangeInput) {
|
|
125
|
-
this.setChangeHandler(config.onChangeInput);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Reset configuration to defaults
|
|
131
|
-
*/
|
|
132
|
-
reset(): void {
|
|
133
|
-
this._labels.set(COPILOT_CHAT_DEFAULT_LABELS);
|
|
134
|
-
this._inputValue.set(undefined);
|
|
135
|
-
this._onSubmitInput.set(undefined);
|
|
136
|
-
this._onChangeInput.set(undefined);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Get the current submit handler
|
|
141
|
-
*/
|
|
142
|
-
getSubmitHandler(): ((value: string) => void) | undefined {
|
|
143
|
-
return this._onSubmitInput();
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Get the current change handler
|
|
148
|
-
*/
|
|
149
|
-
getChangeHandler(): ((value: string) => void) | undefined {
|
|
150
|
-
return this._onChangeInput();
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Merge partial labels with defaults
|
|
155
|
-
*/
|
|
156
|
-
private mergeLabels(partial?: Partial<CopilotChatLabels>): CopilotChatLabels {
|
|
157
|
-
return {
|
|
158
|
-
...COPILOT_CHAT_DEFAULT_LABELS,
|
|
159
|
-
...partial
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from "@angular/core";
|
|
2
|
-
|
|
3
|
-
// Type for chat labels
|
|
4
|
-
export interface CopilotChatLabels {
|
|
5
|
-
chatInputPlaceholder: string;
|
|
6
|
-
chatInputToolbarStartTranscribeButtonLabel: string;
|
|
7
|
-
chatInputToolbarCancelTranscribeButtonLabel: string;
|
|
8
|
-
chatInputToolbarFinishTranscribeButtonLabel: string;
|
|
9
|
-
chatInputToolbarAddButtonLabel: string;
|
|
10
|
-
chatInputToolbarToolsButtonLabel: string;
|
|
11
|
-
assistantMessageToolbarCopyCodeLabel: string;
|
|
12
|
-
assistantMessageToolbarCopyCodeCopiedLabel: string;
|
|
13
|
-
assistantMessageToolbarCopyMessageLabel: string;
|
|
14
|
-
assistantMessageToolbarThumbsUpLabel: string;
|
|
15
|
-
assistantMessageToolbarThumbsDownLabel: string;
|
|
16
|
-
assistantMessageToolbarReadAloudLabel: string;
|
|
17
|
-
assistantMessageToolbarRegenerateLabel: string;
|
|
18
|
-
userMessageToolbarCopyMessageLabel: string;
|
|
19
|
-
userMessageToolbarEditMessageLabel: string;
|
|
20
|
-
chatDisclaimerText: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Default labels constant
|
|
24
|
-
export const COPILOT_CHAT_DEFAULT_LABELS: CopilotChatLabels = {
|
|
25
|
-
chatInputPlaceholder: "Type a message...",
|
|
26
|
-
chatInputToolbarStartTranscribeButtonLabel: "Transcribe",
|
|
27
|
-
chatInputToolbarCancelTranscribeButtonLabel: "Cancel",
|
|
28
|
-
chatInputToolbarFinishTranscribeButtonLabel: "Finish",
|
|
29
|
-
chatInputToolbarAddButtonLabel: "Add photos or files",
|
|
30
|
-
chatInputToolbarToolsButtonLabel: "Tools",
|
|
31
|
-
assistantMessageToolbarCopyCodeLabel: "Copy",
|
|
32
|
-
assistantMessageToolbarCopyCodeCopiedLabel: "Copied",
|
|
33
|
-
assistantMessageToolbarCopyMessageLabel: "Copy",
|
|
34
|
-
assistantMessageToolbarThumbsUpLabel: "Good response",
|
|
35
|
-
assistantMessageToolbarThumbsDownLabel: "Bad response",
|
|
36
|
-
assistantMessageToolbarReadAloudLabel: "Read aloud",
|
|
37
|
-
assistantMessageToolbarRegenerateLabel: "Regenerate",
|
|
38
|
-
userMessageToolbarCopyMessageLabel: "Copy",
|
|
39
|
-
userMessageToolbarEditMessageLabel: "Edit",
|
|
40
|
-
chatDisclaimerText:
|
|
41
|
-
"AI can make mistakes. Please verify important information.",
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// Configuration interface
|
|
45
|
-
export interface CopilotChatConfiguration {
|
|
46
|
-
labels?: Partial<CopilotChatLabels>;
|
|
47
|
-
inputValue?: string;
|
|
48
|
-
onSubmitInput?: (value: string) => void;
|
|
49
|
-
onChangeInput?: (value: string) => void;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Injection token for initial configuration
|
|
53
|
-
export const COPILOT_CHAT_INITIAL_CONFIG =
|
|
54
|
-
new InjectionToken<CopilotChatConfiguration>("COPILOT_CHAT_INITIAL_CONFIG", {
|
|
55
|
-
providedIn: "root",
|
|
56
|
-
factory: () => ({}),
|
|
57
|
-
});
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Provider } from "@angular/core";
|
|
2
|
-
import {
|
|
3
|
-
COPILOTKIT_RUNTIME_URL,
|
|
4
|
-
COPILOTKIT_HEADERS,
|
|
5
|
-
COPILOTKIT_PROPERTIES,
|
|
6
|
-
COPILOTKIT_AGENTS,
|
|
7
|
-
COPILOTKIT_RENDER_TOOL_CALLS,
|
|
8
|
-
COPILOTKIT_FRONTEND_TOOLS,
|
|
9
|
-
COPILOTKIT_HUMAN_IN_THE_LOOP,
|
|
10
|
-
ToolCallRender,
|
|
11
|
-
AngularFrontendTool,
|
|
12
|
-
AngularHumanInTheLoop,
|
|
13
|
-
} from "./copilotkit.types";
|
|
14
|
-
import { AbstractAgent } from "@ag-ui/client";
|
|
15
|
-
|
|
16
|
-
export interface ProvideCopilotKitOptions {
|
|
17
|
-
runtimeUrl?: string;
|
|
18
|
-
headers?: Record<string, string>;
|
|
19
|
-
properties?: Record<string, unknown>;
|
|
20
|
-
agents?: Record<string, AbstractAgent>;
|
|
21
|
-
renderToolCalls?: ToolCallRender<unknown>[];
|
|
22
|
-
frontendTools?: AngularFrontendTool<any>[];
|
|
23
|
-
humanInTheLoop?: AngularHumanInTheLoop<any>[];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function provideCopilotKit(
|
|
27
|
-
options: ProvideCopilotKitOptions = {}
|
|
28
|
-
): Provider[] {
|
|
29
|
-
return [
|
|
30
|
-
{
|
|
31
|
-
provide: COPILOTKIT_RUNTIME_URL,
|
|
32
|
-
useValue: options.runtimeUrl,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
provide: COPILOTKIT_HEADERS,
|
|
36
|
-
useValue: options.headers ?? {},
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
provide: COPILOTKIT_PROPERTIES,
|
|
40
|
-
useValue: options.properties ?? {},
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
provide: COPILOTKIT_AGENTS,
|
|
44
|
-
useValue: options.agents ?? {},
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
provide: COPILOTKIT_RENDER_TOOL_CALLS,
|
|
48
|
-
useValue: options.renderToolCalls ?? [],
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
provide: COPILOTKIT_FRONTEND_TOOLS,
|
|
52
|
-
useValue: options.frontendTools ?? [],
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
provide: COPILOTKIT_HUMAN_IN_THE_LOOP,
|
|
56
|
-
useValue: options.humanInTheLoop ?? [],
|
|
57
|
-
},
|
|
58
|
-
];
|
|
59
|
-
}
|