@copilotkitnext/angular 0.0.2 → 0.0.5
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 +3 -3
- package/dist/README.md +3 -3
- 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/core/copilotkit.providers.d.ts +1 -1
- package/dist/core/copilotkit.service.d.ts +5 -5
- package/dist/core/copilotkit.types.d.ts +8 -10
- package/dist/directives/copilotkit-frontend-tool.directive.d.ts +1 -1
- 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 +426 -0
- package/dist/esm2022/core/copilotkit.types.mjs +13 -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 +128 -0
- package/dist/esm2022/directives/copilotkit-human-in-the-loop.directive.mjs +265 -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 +224 -0
- package/dist/esm2022/utils/human-in-the-loop.utils.mjs +293 -0
- package/dist/fesm2022/copilotkitnext-angular.mjs +174 -187
- package/dist/fesm2022/copilotkitnext-angular.mjs.map +1 -1
- package/dist/utils/frontend-tool.utils.d.ts +1 -1
- package/package.json +23 -20
- package/vitest.config.mts +32 -21
- package/.turbo/turbo-build.log +0 -38
- package/.turbo/turbo-check-types.log +0 -0
- package/.turbo/turbo-test.log +0 -71
- package/ng-package.json +0 -19
- 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,6 +1,6 @@
|
|
|
1
1
|
import { CopilotKitService } from '../core/copilotkit.service';
|
|
2
2
|
import { AngularFrontendTool } from '../core/copilotkit.types';
|
|
3
|
-
import { z } from 'zod';
|
|
3
|
+
import type { z } from 'zod';
|
|
4
4
|
/**
|
|
5
5
|
* Explicitly adds a frontend tool to CopilotKit.
|
|
6
6
|
* Requires CopilotKitService to be passed as a parameter.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copilotkitnext/angular",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Angular library for CopilotKit",
|
|
5
5
|
"main": "dist/fesm2022/copilotkitnext-angular.mjs",
|
|
6
6
|
"module": "dist/fesm2022/copilotkitnext-angular.mjs",
|
|
@@ -21,30 +21,34 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@ag-ui/client": "0.0.36-alpha.1",
|
|
23
23
|
"@ag-ui/core": "0.0.36-alpha.1",
|
|
24
|
+
"clsx": "^2.1.1",
|
|
24
25
|
"highlight.js": "^11.11.1",
|
|
25
26
|
"katex": "^0.16.22",
|
|
26
27
|
"lucide-angular": "^0.540.0",
|
|
27
28
|
"marked": "^16.2.0",
|
|
28
29
|
"rxjs": "^7.8.1",
|
|
30
|
+
"tailwind-merge": "^2.6.0",
|
|
29
31
|
"zod": "^3.22.4",
|
|
30
|
-
"@copilotkitnext/
|
|
31
|
-
"@copilotkitnext/
|
|
32
|
+
"@copilotkitnext/shared": "0.0.5",
|
|
33
|
+
"@copilotkitnext/core": "0.0.5"
|
|
32
34
|
},
|
|
33
35
|
"peerDependencies": {
|
|
34
|
-
"@angular/cdk": "^19.0.0",
|
|
35
|
-
"@angular/common": "^19.0.0",
|
|
36
|
-
"@angular/core": "^19.0.0",
|
|
36
|
+
"@angular/cdk": "^18.0.0 || ^19.0.0",
|
|
37
|
+
"@angular/common": "^18.0.0 || ^19.0.0",
|
|
38
|
+
"@angular/core": "^18.0.0 || ^19.0.0",
|
|
37
39
|
"rxjs": "^7.8.0",
|
|
38
40
|
"tslib": "^2.6.0"
|
|
39
41
|
},
|
|
40
42
|
"devDependencies": {
|
|
41
|
-
"@angular
|
|
42
|
-
"@angular
|
|
43
|
-
"@angular/
|
|
44
|
-
"@angular/
|
|
45
|
-
"@angular/
|
|
46
|
-
"@angular/
|
|
47
|
-
"@angular/
|
|
43
|
+
"@analogjs/vite-plugin-angular": "^1.20.2",
|
|
44
|
+
"@analogjs/vitest-angular": "^1.20.2",
|
|
45
|
+
"@angular/cdk": "^18.0.0",
|
|
46
|
+
"@angular/common": "^18.0.0",
|
|
47
|
+
"@angular/compiler": "^18.0.0",
|
|
48
|
+
"@angular/compiler-cli": "^18.0.0",
|
|
49
|
+
"@angular/core": "^18.0.0",
|
|
50
|
+
"@angular/platform-browser": "^18.0.0",
|
|
51
|
+
"@angular/platform-browser-dynamic": "^18.0.0",
|
|
48
52
|
"@eslint/js": "^9.30.0",
|
|
49
53
|
"@lucide/build-icons": "^1.1.0",
|
|
50
54
|
"@tailwindcss/cli": "^4.1.11",
|
|
@@ -54,24 +58,23 @@
|
|
|
54
58
|
"@types/node": "^22.5.1",
|
|
55
59
|
"@vitest/ui": "^2.0.5",
|
|
56
60
|
"autoprefixer": "^10.4.16",
|
|
57
|
-
"clsx": "^2.1.1",
|
|
58
61
|
"concurrently": "^9.1.0",
|
|
59
62
|
"jsdom": "^24.0.0",
|
|
60
|
-
"ng-packagr": "^
|
|
63
|
+
"ng-packagr": "^18.0.0",
|
|
61
64
|
"postcss": "^8.4.31",
|
|
62
65
|
"reflect-metadata": "^0.2.2",
|
|
63
66
|
"rimraf": "^6.0.1",
|
|
64
67
|
"rxjs": "^7.8.1",
|
|
65
|
-
"tailwind-merge": "^2.6.0",
|
|
66
68
|
"tailwindcss": "^4.0.8",
|
|
67
69
|
"tslib": "^2.8.1",
|
|
68
70
|
"tw-animate-css": "^1.3.5",
|
|
69
|
-
"typescript": "~5.
|
|
71
|
+
"typescript": "~5.4.5",
|
|
70
72
|
"typescript-eslint": "^8.35.0",
|
|
73
|
+
"vite": "^7.1.4",
|
|
71
74
|
"vitest": "^2.0.5",
|
|
72
|
-
"zone.js": "^0.
|
|
73
|
-
"@copilotkitnext/
|
|
74
|
-
"@copilotkitnext/
|
|
75
|
+
"zone.js": "^0.14.0",
|
|
76
|
+
"@copilotkitnext/eslint-config": "0.0.0",
|
|
77
|
+
"@copilotkitnext/typescript-config": "0.0.0"
|
|
75
78
|
},
|
|
76
79
|
"publishConfig": {
|
|
77
80
|
"access": "public"
|
package/vitest.config.mts
CHANGED
|
@@ -1,34 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/// <reference types="vitest" />
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
import angular from '@analogjs/vite-plugin-angular';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { dirname, resolve } from 'node:path';
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const r = (...p: string[]) => resolve(__dirname, ...p);
|
|
9
|
+
|
|
10
|
+
export default defineConfig(({ mode }) => ({
|
|
11
|
+
plugins: [angular()],
|
|
12
|
+
resolve: {
|
|
13
|
+
dedupe: [
|
|
14
|
+
'@angular/core',
|
|
15
|
+
'@angular/common',
|
|
16
|
+
'@angular/platform-browser',
|
|
17
|
+
'@angular/platform-browser-dynamic',
|
|
18
|
+
'@angular/compiler',
|
|
19
|
+
'@angular/core/testing',
|
|
20
|
+
],
|
|
14
21
|
},
|
|
15
22
|
test: {
|
|
16
23
|
globals: true,
|
|
17
24
|
environment: 'jsdom',
|
|
18
|
-
setupFiles: ['
|
|
19
|
-
include: ['src/**/*.{test
|
|
25
|
+
setupFiles: [r('src/test-setup.ts')], // Use absolute path
|
|
26
|
+
include: ['src/**/*.{spec,test}.{ts,tsx}'],
|
|
27
|
+
pool: 'threads',
|
|
28
|
+
poolOptions: { threads: { singleThread: true } },
|
|
20
29
|
coverage: {
|
|
21
30
|
provider: 'v8',
|
|
22
31
|
reporter: ['text', 'json', 'html'],
|
|
23
32
|
exclude: [
|
|
24
33
|
'node_modules/',
|
|
25
34
|
'dist/',
|
|
26
|
-
'*.config
|
|
35
|
+
'*.config.*',
|
|
27
36
|
'src/test-setup.ts',
|
|
28
|
-
'src/**/*.spec.ts',
|
|
29
37
|
'src/index.ts',
|
|
30
|
-
'src/public-api.ts'
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
38
|
+
'src/public-api.ts',
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
define: {
|
|
43
|
+
'import.meta.vitest': mode !== 'production',
|
|
44
|
+
},
|
|
45
|
+
}));
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
> @copilotkitnext/angular@0.0.1 build /Users/mme/Code/vnext_experimental/packages/angular
|
|
4
|
-
> ng-packagr -p ng-package.json && npm run build:css
|
|
5
|
-
|
|
6
|
-
[34mBuilding Angular Package[39m
|
|
7
|
-
[37m[39m
|
|
8
|
-
[37m------------------------------------------------------------------------------[39m
|
|
9
|
-
[37mBuilding entry point '@copilotkitnext/angular'[39m
|
|
10
|
-
[37m------------------------------------------------------------------------------[39m
|
|
11
|
-
[36m⠋[39m Compiling with Angular sources in Ivy partial compilation mode.[2K[1G[36m⠙[39m Compiling with Angular sources in Ivy partial compilation mode.[2K[1G[36m⠹[39m Compiling with Angular sources in Ivy partial compilation mode.[2K[1G[36m⠸[39m Compiling with Angular sources in Ivy partial compilation mode.
|
|
12
|
-
[2K[1G[32m✔[39m Compiling with Angular sources in Ivy partial compilation mode.
|
|
13
|
-
[36m⠋[39m Writing FESM bundles[2K[1G[32m✔[39m Writing FESM bundles
|
|
14
|
-
[36m⠋[39m Copying assets[2K[1G[32m✔[39m Copying assets
|
|
15
|
-
[36m⠋[39m Writing package manifest[33mWARNING: Found a conflicting export condition for ".". The "types" condition would be overridden by ng-packagr. Please unset it.[39m
|
|
16
|
-
[33mWARNING: Found a conflicting export condition for ".". The "default" condition would be overridden by ng-packagr. Please unset it.[39m
|
|
17
|
-
[2K[1G[33m⚠[39m [33m'tslib' is no longer recommended to be used as a 'peerDependencies'. Moving it to 'dependencies'.[39m
|
|
18
|
-
[34mℹ[39m Removing scripts section in package.json as it's considered a potential security vulnerability.
|
|
19
|
-
[34mℹ[39m Removing devDependencies section in package.json.
|
|
20
|
-
[32m✔[39m Writing package manifest
|
|
21
|
-
[32m✔[39m Built @copilotkitnext/angular
|
|
22
|
-
[32m[39m
|
|
23
|
-
[32m------------------------------------------------------------------------------[39m
|
|
24
|
-
[32mBuilt Angular Package[39m
|
|
25
|
-
[32m - from: /Users/mme/Code/vnext_experimental/packages/angular[39m
|
|
26
|
-
[32m - to: /Users/mme/Code/vnext_experimental/packages/angular/dist[39m
|
|
27
|
-
[32m------------------------------------------------------------------------------[39m
|
|
28
|
-
[37m[37m[39m[37m[39m
|
|
29
|
-
[37m[37mBuild at: [1m2025-09-03T13:18:59.922Z[22m - Time: [1m3451[22mms[39m[37m[39m
|
|
30
|
-
[37m[37m[39m[37m[39m
|
|
31
|
-
|
|
32
|
-
> @copilotkitnext/angular@0.0.1 build:css
|
|
33
|
-
> npx @tailwindcss/cli -i ./src/styles/globals.css -o ./dist/styles.css
|
|
34
|
-
|
|
35
|
-
[1G[0K[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K[3m[1m[34m≈[39m[22m[23m tailwindcss [34mv4.1.11[39m
|
|
36
|
-
|
|
37
|
-
Done in [34m110ms[39m
|
|
38
|
-
[1G[0K⠙[1G[0K[1G[0K⠙[1G[0K
|
|
File without changes
|
package/.turbo/turbo-test.log
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @copilotkitnext/angular@0.0.2 test /Users/mme/Code/CopilotKit2/packages/angular
|
|
3
|
-
> vitest run
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
RUN v2.1.9 /Users/mme/Code/CopilotKit2/packages/angular
|
|
7
|
-
|
|
8
|
-
✓ src/utils/__tests__/chat-config.utils.spec.ts (17 tests) 63ms
|
|
9
|
-
✓ src/directives/__tests__/copilotkit-chat-config.directive.spec.ts (11 tests) 105ms
|
|
10
|
-
✓ src/directives/__tests__/copilotkit-agent-context.directive.spec.ts (15 tests) 128ms
|
|
11
|
-
✓ src/directives/__tests__/copilotkit-human-in-the-loop.directive.spec.ts (11 tests) 126ms
|
|
12
|
-
✓ src/utils/__tests__/human-in-the-loop.utils.spec.ts (13 tests) 96ms
|
|
13
|
-
✓ src/lib/slots/__tests__/slot.utils.spec.ts (23 tests) 172ms
|
|
14
|
-
stderr | src/core/__tests__/copilotkit.service.spec.ts > CopilotKitService > Frontend Tools Support > should warn when frontend tools array changes
|
|
15
|
-
frontendTools must be a stable array. To add/remove tools dynamically, use dynamic tool registration.
|
|
16
|
-
|
|
17
|
-
stderr | src/core/__tests__/copilotkit.service.spec.ts > CopilotKitService > Human-in-the-Loop Support > should create placeholder handlers for human-in-the-loop tools
|
|
18
|
-
Human-in-the-loop tool 'getUserInput' called but no interactive handler is set up.
|
|
19
|
-
|
|
20
|
-
stderr | src/core/__tests__/copilotkit.service.spec.ts > CopilotKitService > Human-in-the-Loop Support > should warn when human-in-the-loop array changes
|
|
21
|
-
humanInTheLoop must be a stable array. To add/remove human-in-the-loop tools dynamically, use dynamic tool registration.
|
|
22
|
-
|
|
23
|
-
✓ src/core/__tests__/copilotkit.service.spec.ts (40 tests | 1 skipped) 251ms
|
|
24
|
-
stderr | src/components/chat/__tests__/copilot-chat-input.component.spec.ts > CopilotChatInputComponent > Mode Switching > should switch to audio recorder in transcribe mode
|
|
25
|
-
Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package)
|
|
26
|
-
at module.exports (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@24.1.3/node_modules/jsdom/lib/jsdom/browser/not-implemented.js:9:17)
|
|
27
|
-
at HTMLCanvasElementImpl.getContext (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@24.1.3/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js:42:5)
|
|
28
|
-
at HTMLCanvasElement.getContext (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@24.1.3/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js:131:58)
|
|
29
|
-
at CopilotChatAudioRecorderComponent.startAnimation (/Users/mme/Code/CopilotKit2/packages/angular/src/components/chat/copilot-chat-audio-recorder.component.ts:150:24)
|
|
30
|
-
at CopilotChatAudioRecorderComponent.ngAfterViewInit (/Users/mme/Code/CopilotKit2/packages/angular/src/components/chat/copilot-chat-audio-recorder.component.ts:76:10)
|
|
31
|
-
at callHookInternal (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/hooks.ts:290:10)
|
|
32
|
-
at callHook (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/hooks.ts:319:7)
|
|
33
|
-
at callHooks (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/hooks.ts:270:9)
|
|
34
|
-
at executeInitAndCheckHooks (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/hooks.ts:205:5)
|
|
35
|
-
at refreshView (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/instructions/change_detection.ts:326:11) undefined
|
|
36
|
-
|
|
37
|
-
stderr | src/components/chat/__tests__/copilot-chat-input.component.spec.ts > CopilotChatInputComponent > Mode Switching > should switch back to textarea from transcribe mode
|
|
38
|
-
Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package)
|
|
39
|
-
at module.exports (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@24.1.3/node_modules/jsdom/lib/jsdom/browser/not-implemented.js:9:17)
|
|
40
|
-
at HTMLCanvasElementImpl.getContext (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@24.1.3/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js:42:5)
|
|
41
|
-
at HTMLCanvasElement.getContext (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@24.1.3/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js:131:58)
|
|
42
|
-
at CopilotChatAudioRecorderComponent.startAnimation (/Users/mme/Code/CopilotKit2/packages/angular/src/components/chat/copilot-chat-audio-recorder.component.ts:150:24)
|
|
43
|
-
at CopilotChatAudioRecorderComponent.ngAfterViewInit (/Users/mme/Code/CopilotKit2/packages/angular/src/components/chat/copilot-chat-audio-recorder.component.ts:76:10)
|
|
44
|
-
at callHookInternal (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/hooks.ts:290:10)
|
|
45
|
-
at callHook (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/hooks.ts:319:7)
|
|
46
|
-
at callHooks (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/hooks.ts:270:9)
|
|
47
|
-
at executeInitAndCheckHooks (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/hooks.ts:205:5)
|
|
48
|
-
at refreshView (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/instructions/change_detection.ts:326:11) undefined
|
|
49
|
-
|
|
50
|
-
✓ src/components/chat/__tests__/copilot-chat-input.component.spec.ts (31 tests) 784ms
|
|
51
|
-
✓ src/core/chat-configuration/__tests__/chat-configuration.service.spec.ts (19 tests) 72ms
|
|
52
|
-
✓ src/utils/__tests__/frontend-tool-inject.spec.ts (10 tests) 168ms
|
|
53
|
-
✓ src/utils/__tests__/frontend-tool.utils.spec.ts (12 tests) 77ms
|
|
54
|
-
✓ src/utils/__tests__/agent.utils.spec.ts (11 tests) 122ms
|
|
55
|
-
✓ src/core/__tests__/copilotkit.service.wildcard.spec.ts (9 tests) 38ms
|
|
56
|
-
✓ src/components/chat/__tests__/copilot-chat-message-view.component.spec.ts (25 tests) 953ms
|
|
57
|
-
✓ CopilotChatMessageViewComponent > Performance > should handle large message lists efficiently 366ms
|
|
58
|
-
✓ src/components/chat/__tests__/copilot-chat-assistant-message.component.spec.ts (16 tests) 339ms
|
|
59
|
-
✓ src/directives/__tests__/copilotkit-agent.directive.spec.ts (7 tests) 94ms
|
|
60
|
-
↓ src/directives/__tests__/copilotkit-frontend-tool-simple.directive.spec.ts (5 tests | 5 skipped)
|
|
61
|
-
✓ src/utils/__tests__/frontend-tool-integration.spec.ts (10 tests) 36ms
|
|
62
|
-
✓ src/directives/__tests__/copilotkit-config.directive.spec.ts (2 tests) 43ms
|
|
63
|
-
✓ src/directives/__tests__/copilotkit-frontend-tool.directive.spec.ts (3 tests) 51ms
|
|
64
|
-
✓ src/components/chat/__tests__/copilot-chat-user-message.component.spec.ts (20 tests | 3 skipped) 2336ms
|
|
65
|
-
✓ CopilotChatUserMessageComponent > should copy message content to clipboard when copy button is clicked 2017ms
|
|
66
|
-
|
|
67
|
-
Test Files 20 passed | 1 skipped (21)
|
|
68
|
-
Tests 301 passed | 9 skipped (310)
|
|
69
|
-
Start at 10:46:42
|
|
70
|
-
Duration 5.25s (transform 1.09s, setup 7.16s, collect 3.73s, tests 6.06s, environment 9.62s, prepare 1.91s)
|
|
71
|
-
|
package/ng-package.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
|
3
|
-
"dest": "dist",
|
|
4
|
-
"lib": {
|
|
5
|
-
"entryFile": "src/index.ts"
|
|
6
|
-
},
|
|
7
|
-
"allowedNonPeerDependencies": [
|
|
8
|
-
"@ag-ui/client",
|
|
9
|
-
"@ag-ui/core",
|
|
10
|
-
"@copilotkitnext/shared",
|
|
11
|
-
"@copilotkitnext/core",
|
|
12
|
-
"rxjs",
|
|
13
|
-
"zod",
|
|
14
|
-
"lucide-angular",
|
|
15
|
-
"highlight.js",
|
|
16
|
-
"katex",
|
|
17
|
-
"marked"
|
|
18
|
-
]
|
|
19
|
-
}
|
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { Component } from '@angular/core';
|
|
3
|
-
import { CommonModule } from '@angular/common';
|
|
4
|
-
import { CopilotChatAssistantMessageComponent } from '../copilot-chat-assistant-message.component';
|
|
5
|
-
import { CopilotChatAssistantMessageRendererComponent } from '../copilot-chat-assistant-message-renderer.component';
|
|
6
|
-
import {
|
|
7
|
-
CopilotChatAssistantMessageCopyButtonComponent,
|
|
8
|
-
CopilotChatAssistantMessageThumbsUpButtonComponent,
|
|
9
|
-
CopilotChatAssistantMessageThumbsDownButtonComponent,
|
|
10
|
-
CopilotChatAssistantMessageReadAloudButtonComponent,
|
|
11
|
-
CopilotChatAssistantMessageRegenerateButtonComponent
|
|
12
|
-
} from '../copilot-chat-assistant-message-buttons.component';
|
|
13
|
-
import { CopilotChatAssistantMessageToolbarComponent } from '../copilot-chat-assistant-message-toolbar.component';
|
|
14
|
-
import { CopilotChatViewHandlersService } from '../copilot-chat-view-handlers.service';
|
|
15
|
-
import { provideCopilotKit } from '../../../core/copilotkit.providers';
|
|
16
|
-
import { provideCopilotChatConfiguration } from '../../../core/chat-configuration/chat-configuration.providers';
|
|
17
|
-
import { AssistantMessage } from '@ag-ui/client';
|
|
18
|
-
|
|
19
|
-
describe('CopilotChatAssistantMessageComponent', () => {
|
|
20
|
-
let component: CopilotChatAssistantMessageComponent;
|
|
21
|
-
let fixture: ComponentFixture<CopilotChatAssistantMessageComponent>;
|
|
22
|
-
|
|
23
|
-
const mockMessage: AssistantMessage = {
|
|
24
|
-
id: 'test-msg-1',
|
|
25
|
-
role: 'assistant',
|
|
26
|
-
content: 'Hello! This is a test message with **bold text** and *italic text*.',
|
|
27
|
-
createdAt: new Date()
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
beforeEach(async () => {
|
|
31
|
-
await TestBed.configureTestingModule({
|
|
32
|
-
imports: [
|
|
33
|
-
CommonModule,
|
|
34
|
-
CopilotChatAssistantMessageComponent,
|
|
35
|
-
CopilotChatAssistantMessageRendererComponent,
|
|
36
|
-
CopilotChatAssistantMessageCopyButtonComponent,
|
|
37
|
-
CopilotChatAssistantMessageThumbsUpButtonComponent,
|
|
38
|
-
CopilotChatAssistantMessageThumbsDownButtonComponent,
|
|
39
|
-
CopilotChatAssistantMessageReadAloudButtonComponent,
|
|
40
|
-
CopilotChatAssistantMessageRegenerateButtonComponent,
|
|
41
|
-
CopilotChatAssistantMessageToolbarComponent
|
|
42
|
-
],
|
|
43
|
-
providers: [
|
|
44
|
-
provideCopilotKit({}),
|
|
45
|
-
provideCopilotChatConfiguration({
|
|
46
|
-
labels: {
|
|
47
|
-
assistantMessageToolbarCopyMessageLabel: 'Copy',
|
|
48
|
-
assistantMessageToolbarThumbsUpLabel: 'Good',
|
|
49
|
-
assistantMessageToolbarThumbsDownLabel: 'Bad',
|
|
50
|
-
assistantMessageToolbarReadAloudLabel: 'Read',
|
|
51
|
-
assistantMessageToolbarRegenerateLabel: 'Regenerate'
|
|
52
|
-
}
|
|
53
|
-
}),
|
|
54
|
-
CopilotChatViewHandlersService
|
|
55
|
-
]
|
|
56
|
-
}).compileComponents();
|
|
57
|
-
|
|
58
|
-
fixture = TestBed.createComponent(CopilotChatAssistantMessageComponent);
|
|
59
|
-
component = fixture.componentInstance;
|
|
60
|
-
component.message = mockMessage;
|
|
61
|
-
fixture.detectChanges();
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('should create', () => {
|
|
65
|
-
expect(component).toBeTruthy();
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('should display the message content', () => {
|
|
69
|
-
const element = fixture.nativeElement;
|
|
70
|
-
expect(element.textContent).toContain('Hello! This is a test message');
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('should set data-message-id attribute', () => {
|
|
74
|
-
const element = fixture.nativeElement.querySelector('[data-message-id]');
|
|
75
|
-
expect(element).toBeTruthy();
|
|
76
|
-
expect(element.getAttribute('data-message-id')).toBe('test-msg-1');
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('should show toolbar when toolbarVisible is true', () => {
|
|
80
|
-
component.toolbarVisible = true;
|
|
81
|
-
fixture.detectChanges();
|
|
82
|
-
const toolbar = fixture.nativeElement.querySelector('[copilotChatAssistantMessageToolbar]');
|
|
83
|
-
expect(toolbar).toBeTruthy();
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('should hide toolbar when toolbarVisible is false', () => {
|
|
87
|
-
// Create a fresh instance with toolbarVisible set to false from the start
|
|
88
|
-
TestBed.resetTestingModule();
|
|
89
|
-
TestBed.configureTestingModule({
|
|
90
|
-
imports: [
|
|
91
|
-
CommonModule,
|
|
92
|
-
CopilotChatAssistantMessageComponent,
|
|
93
|
-
CopilotChatAssistantMessageRendererComponent,
|
|
94
|
-
CopilotChatAssistantMessageToolbarComponent
|
|
95
|
-
],
|
|
96
|
-
providers: [
|
|
97
|
-
provideCopilotKit({}),
|
|
98
|
-
provideCopilotChatConfiguration({})
|
|
99
|
-
]
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
const newFixture = TestBed.createComponent(CopilotChatAssistantMessageComponent);
|
|
103
|
-
const newComponent = newFixture.componentInstance;
|
|
104
|
-
newComponent.message = mockMessage;
|
|
105
|
-
newComponent.toolbarVisible = false;
|
|
106
|
-
newFixture.detectChanges();
|
|
107
|
-
|
|
108
|
-
const toolbar = newFixture.nativeElement.querySelector('[copilotChatAssistantMessageToolbar]');
|
|
109
|
-
expect(toolbar).toBeFalsy();
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('should emit thumbsUp event when button is clicked', () => {
|
|
113
|
-
let emittedEvent: any;
|
|
114
|
-
component.thumbsUp.subscribe((event) => {
|
|
115
|
-
emittedEvent = event;
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
component.handleThumbsUp();
|
|
119
|
-
expect(emittedEvent).toEqual({ message: mockMessage });
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('should emit thumbsDown event when button is clicked', () => {
|
|
123
|
-
let emittedEvent: any;
|
|
124
|
-
component.thumbsDown.subscribe((event) => {
|
|
125
|
-
emittedEvent = event;
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
component.handleThumbsDown();
|
|
129
|
-
expect(emittedEvent).toEqual({ message: mockMessage });
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it('should emit readAloud event when button is clicked', () => {
|
|
133
|
-
let emittedEvent: any;
|
|
134
|
-
component.readAloud.subscribe((event) => {
|
|
135
|
-
emittedEvent = event;
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
component.handleReadAloud();
|
|
139
|
-
expect(emittedEvent).toEqual({ message: mockMessage });
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
it('should emit regenerate event when button is clicked', () => {
|
|
143
|
-
let emittedEvent: any;
|
|
144
|
-
component.regenerate.subscribe((event) => {
|
|
145
|
-
emittedEvent = event;
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
component.handleRegenerate();
|
|
149
|
-
expect(emittedEvent).toEqual({ message: mockMessage });
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('should handle empty message content', () => {
|
|
153
|
-
component.message = {
|
|
154
|
-
...mockMessage,
|
|
155
|
-
content: ''
|
|
156
|
-
};
|
|
157
|
-
fixture.detectChanges();
|
|
158
|
-
expect(component).toBeTruthy();
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it('should support custom CSS class', () => {
|
|
162
|
-
const customClass = 'custom-test-class';
|
|
163
|
-
component.inputClass = customClass;
|
|
164
|
-
fixture.detectChanges();
|
|
165
|
-
|
|
166
|
-
const element = fixture.nativeElement.querySelector('div');
|
|
167
|
-
expect(element.className).toContain(customClass);
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
describe('CopilotChatAssistantMessageComponent with code blocks', () => {
|
|
172
|
-
let component: CopilotChatAssistantMessageComponent;
|
|
173
|
-
let fixture: ComponentFixture<CopilotChatAssistantMessageComponent>;
|
|
174
|
-
|
|
175
|
-
const codeMessage: AssistantMessage = {
|
|
176
|
-
id: 'test-code-1',
|
|
177
|
-
role: 'assistant',
|
|
178
|
-
content: `Here's a code example:
|
|
179
|
-
\`\`\`typescript
|
|
180
|
-
function hello(name: string): string {
|
|
181
|
-
return \`Hello, \${name}!\`;
|
|
182
|
-
}
|
|
183
|
-
\`\`\``,
|
|
184
|
-
createdAt: new Date()
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
beforeEach(async () => {
|
|
188
|
-
await TestBed.configureTestingModule({
|
|
189
|
-
imports: [
|
|
190
|
-
CommonModule,
|
|
191
|
-
CopilotChatAssistantMessageComponent,
|
|
192
|
-
CopilotChatAssistantMessageRendererComponent
|
|
193
|
-
],
|
|
194
|
-
providers: [
|
|
195
|
-
provideCopilotKit({}),
|
|
196
|
-
provideCopilotChatConfiguration({})
|
|
197
|
-
]
|
|
198
|
-
}).compileComponents();
|
|
199
|
-
|
|
200
|
-
fixture = TestBed.createComponent(CopilotChatAssistantMessageComponent);
|
|
201
|
-
component = fixture.componentInstance;
|
|
202
|
-
component.message = codeMessage;
|
|
203
|
-
fixture.detectChanges();
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
it('should render code blocks', () => {
|
|
207
|
-
const element = fixture.nativeElement;
|
|
208
|
-
const codeBlock = element.querySelector('.code-block-container');
|
|
209
|
-
expect(codeBlock).toBeTruthy();
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
it('should display language label for code blocks', () => {
|
|
213
|
-
const element = fixture.nativeElement;
|
|
214
|
-
const languageLabel = element.querySelector('.code-block-language');
|
|
215
|
-
expect(languageLabel).toBeTruthy();
|
|
216
|
-
expect(languageLabel.textContent).toBe('typescript');
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
it('should have copy button for code blocks', () => {
|
|
220
|
-
const element = fixture.nativeElement;
|
|
221
|
-
const copyButton = element.querySelector('.code-block-copy-button');
|
|
222
|
-
expect(copyButton).toBeTruthy();
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
describe('CopilotChatAssistantMessageComponent with custom slots', () => {
|
|
227
|
-
@Component({
|
|
228
|
-
selector: 'test-host',
|
|
229
|
-
template: `
|
|
230
|
-
<copilot-chat-assistant-message [message]="message">
|
|
231
|
-
<ng-template #markdownRenderer let-content="content">
|
|
232
|
-
<div class="custom-renderer">{{ content }}</div>
|
|
233
|
-
</ng-template>
|
|
234
|
-
|
|
235
|
-
<ng-template #copyButton let-onClick="onClick">
|
|
236
|
-
<button class="custom-copy-btn" (click)="onClick()">Custom Copy</button>
|
|
237
|
-
</ng-template>
|
|
238
|
-
</copilot-chat-assistant-message>
|
|
239
|
-
`,
|
|
240
|
-
standalone: true,
|
|
241
|
-
imports: [CommonModule, CopilotChatAssistantMessageComponent]
|
|
242
|
-
})
|
|
243
|
-
class TestHostComponent {
|
|
244
|
-
message: AssistantMessage = {
|
|
245
|
-
id: 'test-custom-1',
|
|
246
|
-
role: 'assistant',
|
|
247
|
-
content: 'Custom slot test message',
|
|
248
|
-
createdAt: new Date()
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
let component: TestHostComponent;
|
|
253
|
-
let fixture: ComponentFixture<TestHostComponent>;
|
|
254
|
-
|
|
255
|
-
beforeEach(async () => {
|
|
256
|
-
await TestBed.configureTestingModule({
|
|
257
|
-
imports: [TestHostComponent],
|
|
258
|
-
providers: [
|
|
259
|
-
provideCopilotKit({}),
|
|
260
|
-
provideCopilotChatConfiguration({})
|
|
261
|
-
]
|
|
262
|
-
}).compileComponents();
|
|
263
|
-
|
|
264
|
-
fixture = TestBed.createComponent(TestHostComponent);
|
|
265
|
-
component = fixture.componentInstance;
|
|
266
|
-
fixture.detectChanges();
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
it('should use custom markdown renderer slot', () => {
|
|
270
|
-
const element = fixture.nativeElement;
|
|
271
|
-
const customRenderer = element.querySelector('.custom-renderer');
|
|
272
|
-
expect(customRenderer).toBeTruthy();
|
|
273
|
-
expect(customRenderer.textContent).toBe('Custom slot test message');
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
it('should use custom copy button slot', () => {
|
|
277
|
-
const element = fixture.nativeElement;
|
|
278
|
-
const customCopyBtn = element.querySelector('.custom-copy-btn');
|
|
279
|
-
expect(customCopyBtn).toBeTruthy();
|
|
280
|
-
expect(customCopyBtn.textContent).toBe('Custom Copy');
|
|
281
|
-
});
|
|
282
|
-
});
|