@copilotkit/react-core 0.19.0-alpha.1 → 0.20.0-demofixes.1
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/.turbo/turbo-build.log +158 -144
- package/CHANGELOG.md +37 -0
- package/dist/{chunk-VP2EU4US.mjs → chunk-4LKP4DMT.mjs} +3 -3
- package/dist/{chunk-4CFJ6A6A.mjs → chunk-4OWTRVNI.mjs} +6 -2
- package/dist/chunk-4OWTRVNI.mjs.map +1 -0
- package/dist/{chunk-IQEWY7P4.mjs → chunk-ABXVFQLN.mjs} +46 -29
- package/dist/chunk-ABXVFQLN.mjs.map +1 -0
- package/dist/{chunk-YOXWT7I6.mjs → chunk-CPEUPJQJ.mjs} +2 -2
- package/dist/{chunk-UAKLDQMP.mjs → chunk-JIKWSWIX.mjs} +4 -4
- package/dist/chunk-JIKWSWIX.mjs.map +1 -0
- package/dist/{chunk-DGUVNY3V.mjs → chunk-K2LVBFRY.mjs} +2 -2
- package/dist/{chunk-GBZZPQ5X.mjs → chunk-KAZJPE2I.mjs} +14 -8
- package/dist/chunk-KAZJPE2I.mjs.map +1 -0
- package/dist/{chunk-5GS7FQPW.mjs → chunk-KZNQLITJ.mjs} +5 -5
- package/dist/chunk-KZNQLITJ.mjs.map +1 -0
- package/dist/chunk-LUGEI4YQ.mjs +1 -0
- package/dist/chunk-LUGEI4YQ.mjs.map +1 -0
- package/dist/chunk-TZPIY754.mjs +102 -0
- package/dist/chunk-TZPIY754.mjs.map +1 -0
- package/dist/{chunk-IQH5AQQC.mjs → chunk-XBLCD24W.mjs} +2 -2
- package/dist/components/copilot-provider/copilotkit.js +12 -6
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +439 -8
- package/dist/components/copilot-provider/copilotkit.mjs.map +1 -1
- package/dist/components/copilot-provider/index.js +12 -6
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +439 -9
- package/dist/components/copilot-provider/index.mjs.map +1 -1
- package/dist/components/copilot-provider/standard-copilot-api-config.mjs +9 -4
- package/dist/components/copilot-provider/standard-copilot-api-config.mjs.map +1 -1
- package/dist/components/index.js +12 -6
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +439 -10
- package/dist/components/index.mjs.map +1 -1
- package/dist/context/copilot-context.d.ts +5 -4
- package/dist/context/copilot-context.js +7 -2
- package/dist/context/copilot-context.js.map +1 -1
- package/dist/context/copilot-context.mjs +65 -5
- package/dist/context/copilot-context.mjs.map +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.js +7 -2
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +65 -6
- package/dist/context/index.mjs.map +1 -1
- package/dist/hooks/index.js +47 -29
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +392 -21
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/use-chat.d.ts +2 -2
- package/dist/hooks/use-chat.js +46 -28
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +204 -4
- package/dist/hooks/use-chat.mjs.map +1 -1
- package/dist/hooks/use-copilot-chat.js +47 -29
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +340 -13
- package/dist/hooks/use-copilot-chat.mjs.map +1 -1
- package/dist/hooks/use-flat-category-store.mjs +65 -4
- package/dist/hooks/use-flat-category-store.mjs.map +1 -1
- package/dist/hooks/use-make-copilot-actionable.js.map +1 -1
- package/dist/hooks/use-make-copilot-actionable.mjs +85 -5
- package/dist/hooks/use-make-copilot-actionable.mjs.map +1 -1
- package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
- package/dist/hooks/use-make-copilot-document-readable.mjs +77 -5
- package/dist/hooks/use-make-copilot-document-readable.mjs.map +1 -1
- package/dist/hooks/use-make-copilot-readable.js.map +1 -1
- package/dist/hooks/use-make-copilot-readable.mjs +77 -5
- package/dist/hooks/use-make-copilot-readable.mjs.map +1 -1
- package/dist/hooks/use-tree.mjs +150 -4
- package/dist/hooks/use-tree.mjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +154 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +981 -41
- package/dist/index.mjs.map +1 -1
- package/dist/lib/copilot-task.d.ts +34 -0
- package/dist/lib/copilot-task.js +206 -0
- package/dist/lib/copilot-task.js.map +1 -0
- package/dist/lib/copilot-task.mjs +188 -0
- package/dist/lib/copilot-task.mjs.map +1 -0
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/index.js +206 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/index.mjs +188 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/openai-assistants/hooks/index.js.map +1 -1
- package/dist/openai-assistants/hooks/index.mjs +228 -14
- package/dist/openai-assistants/hooks/index.mjs.map +1 -1
- package/dist/openai-assistants/hooks/use-assistants.mjs +45 -7
- package/dist/openai-assistants/hooks/use-assistants.mjs.map +1 -1
- package/dist/openai-assistants/hooks/use-copilot-chat-v2.js.map +1 -1
- package/dist/openai-assistants/hooks/use-copilot-chat-v2.mjs +228 -14
- package/dist/openai-assistants/hooks/use-copilot-chat-v2.mjs.map +1 -1
- package/dist/openai-assistants/index.js.map +1 -1
- package/dist/openai-assistants/index.mjs +228 -17
- package/dist/openai-assistants/index.mjs.map +1 -1
- package/dist/openai-assistants/utils/index.mjs +43 -5
- package/dist/openai-assistants/utils/index.mjs.map +1 -1
- package/dist/openai-assistants/utils/process-message-stream.mjs +43 -4
- package/dist/openai-assistants/utils/process-message-stream.mjs.map +1 -1
- package/dist/types/index.mjs +0 -1
- package/dist/utils/fetch-chat-completion.d.ts +3 -3
- package/dist/utils/fetch-chat-completion.js +3 -3
- package/dist/utils/fetch-chat-completion.js.map +1 -1
- package/dist/utils/fetch-chat-completion.mjs +99 -5
- package/dist/utils/fetch-chat-completion.mjs.map +1 -1
- package/package.json +4 -4
- package/src/components/copilot-provider/copilotkit.tsx +17 -8
- package/src/context/copilot-context.tsx +11 -3
- package/src/context/index.ts +1 -1
- package/src/hooks/use-chat.ts +52 -30
- package/src/hooks/use-copilot-chat.ts +3 -3
- package/src/index.tsx +1 -0
- package/src/lib/copilot-task.ts +131 -0
- package/src/lib/index.ts +1 -0
- package/src/utils/fetch-chat-completion.ts +6 -6
- package/dist/chunk-4CFJ6A6A.mjs.map +0 -1
- package/dist/chunk-5GS7FQPW.mjs.map +0 -1
- package/dist/chunk-GBZZPQ5X.mjs.map +0 -1
- package/dist/chunk-IQEWY7P4.mjs.map +0 -1
- package/dist/chunk-UAKLDQMP.mjs.map +0 -1
- /package/dist/{chunk-VP2EU4US.mjs.map → chunk-4LKP4DMT.mjs.map} +0 -0
- /package/dist/{chunk-YOXWT7I6.mjs.map → chunk-CPEUPJQJ.mjs.map} +0 -0
- /package/dist/{chunk-DGUVNY3V.mjs.map → chunk-K2LVBFRY.mjs.map} +0 -0
- /package/dist/{chunk-IQH5AQQC.mjs.map → chunk-XBLCD24W.mjs.map} +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
> @copilotkit/react-core@0.
|
|
2
|
+
> @copilotkit/react-core@0.20.0-tools.0 build /Users/ataibarkai/LocalGit/Recursively.ai/CopilotKit/CopilotKit/packages/react-core
|
|
3
3
|
> tsup --clean
|
|
4
4
|
|
|
5
|
-
CLI Building entry: src/index.tsx, src/
|
|
5
|
+
CLI Building entry: src/index.tsx, src/context/copilot-context.tsx, src/context/index.ts, src/components/index.ts, src/hooks/index.ts, src/hooks/use-chat.ts, src/hooks/use-copilot-chat.ts, src/hooks/use-flat-category-store.ts, src/hooks/use-make-copilot-actionable.ts, src/hooks/use-make-copilot-document-readable.ts, src/hooks/use-make-copilot-readable.ts, src/hooks/use-tree.ts, src/lib/copilot-task.ts, src/lib/index.ts, src/openai-assistants/index.ts, src/types/document-pointer.ts, src/types/index.ts, src/types/system-message.ts, src/utils/fetch-chat-completion.ts, src/utils/utils.test.ts, src/utils/utils.ts, src/components/copilot-provider/copilotkit-props.tsx, src/components/copilot-provider/copilotkit.tsx, src/components/copilot-provider/index.ts, src/components/copilot-provider/standard-copilot-api-config.tsx, src/openai-assistants/hooks/index.ts, src/openai-assistants/hooks/use-assistants.ts, src/openai-assistants/hooks/use-copilot-chat-v2.ts, src/openai-assistants/utils/index.ts, src/openai-assistants/utils/process-message-stream.ts
|
|
6
6
|
CLI Using tsconfig: tsconfig.json
|
|
7
7
|
CLI tsup v6.7.0
|
|
8
8
|
CLI Using tsup config: /Users/ataibarkai/LocalGit/Recursively.ai/CopilotKit/CopilotKit/packages/react-core/tsup.config.ts
|
|
@@ -10,185 +10,199 @@ CLI Target: es6
|
|
|
10
10
|
CLI Cleaning output folder
|
|
11
11
|
ESM Build start
|
|
12
12
|
CJS Build start
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
CJS dist/components/copilot-provider/copilotkit-props.js 878.00 B
|
|
18
|
-
CJS dist/openai-assistants/utils/index.js 2.30 KB
|
|
19
|
-
CJS dist/index.js 30.73 KB
|
|
20
|
-
CJS dist/components/index.js 15.02 KB
|
|
21
|
-
CJS dist/context/copilot-context.js 3.47 KB
|
|
22
|
-
CJS dist/hooks/use-copilot-chat.js 12.46 KB
|
|
23
|
-
CJS dist/hooks/use-flat-category-store.js 2.87 KB
|
|
24
|
-
CJS dist/hooks/use-make-copilot-actionable.js 4.47 KB
|
|
25
|
-
CJS dist/hooks/index.js 14.63 KB
|
|
26
|
-
CJS dist/hooks/use-make-copilot-document-readable.js 4.22 KB
|
|
27
|
-
CJS dist/types/index.js 797.00 B
|
|
28
|
-
CJS dist/hooks/use-chat.js 7.23 KB
|
|
29
|
-
CJS dist/types/system-message.js 833.00 B
|
|
30
|
-
CJS dist/hooks/use-make-copilot-readable.js 4.10 KB
|
|
31
|
-
CJS dist/hooks/use-tree.js 5.53 KB
|
|
32
|
-
CJS dist/components/copilot-provider/copilotkit.js 15.01 KB
|
|
33
|
-
CJS dist/utils/utils.test.js 184.00 B
|
|
34
|
-
CJS dist/utils/utils.js 797.00 B
|
|
35
|
-
CJS dist/openai-assistants/utils/process-message-stream.js 2.33 KB
|
|
36
|
-
CJS dist/components/copilot-provider/standard-copilot-api-config.js 1.48 KB
|
|
37
|
-
CJS dist/context/index.js 3.44 KB
|
|
38
|
-
CJS dist/openai-assistants/hooks/use-copilot-chat-v2.js 9.30 KB
|
|
39
|
-
CJS dist/openai-assistants/hooks/index.js 9.21 KB
|
|
40
|
-
CJS dist/components/copilot-provider/index.js 15.05 KB
|
|
41
|
-
CJS dist/types/document-pointer.js.map 292.00 B
|
|
42
|
-
CJS dist/openai-assistants/index.js.map 20.17 KB
|
|
43
|
-
CJS dist/utils/fetch-chat-completion.js.map 4.05 KB
|
|
44
|
-
CJS dist/openai-assistants/hooks/use-assistants.js.map 5.92 KB
|
|
45
|
-
CJS dist/components/copilot-provider/copilotkit-props.js.map 894.00 B
|
|
46
|
-
CJS dist/openai-assistants/utils/index.js.map 1.44 KB
|
|
47
|
-
CJS dist/index.js.map 56.90 KB
|
|
48
|
-
CJS dist/components/index.js.map 26.92 KB
|
|
49
|
-
CJS dist/hooks/use-copilot-chat.js.map 26.97 KB
|
|
50
|
-
CJS dist/hooks/use-flat-category-store.js.map 4.25 KB
|
|
51
|
-
CJS dist/hooks/use-make-copilot-actionable.js.map 5.72 KB
|
|
52
|
-
CJS dist/hooks/index.js.map 31.88 KB
|
|
53
|
-
CJS dist/context/copilot-context.js.map 4.12 KB
|
|
54
|
-
CJS dist/hooks/use-make-copilot-document-readable.js.map 5.49 KB
|
|
55
|
-
CJS dist/hooks/use-make-copilot-readable.js.map 5.54 KB
|
|
56
|
-
CJS dist/types/index.js.map 253.00 B
|
|
57
|
-
CJS dist/hooks/use-tree.js.map 8.32 KB
|
|
58
|
-
CJS dist/hooks/use-chat.js.map 11.51 KB
|
|
59
|
-
CJS dist/utils/utils.test.js.map 354.00 B
|
|
60
|
-
CJS dist/types/system-message.js.map 249.00 B
|
|
61
|
-
CJS dist/components/copilot-provider/standard-copilot-api-config.js.map 1.17 KB
|
|
62
|
-
CJS dist/openai-assistants/utils/process-message-stream.js.map 1.33 KB
|
|
63
|
-
CJS dist/context/index.js.map 4.33 KB
|
|
64
|
-
CJS dist/components/copilot-provider/copilotkit.js.map 26.86 KB
|
|
65
|
-
CJS dist/utils/utils.js.map 137.00 B
|
|
66
|
-
CJS dist/openai-assistants/hooks/index.js.map 20.47 KB
|
|
67
|
-
CJS dist/components/copilot-provider/index.js.map 27.06 KB
|
|
68
|
-
CJS dist/openai-assistants/hooks/use-copilot-chat-v2.js.map 20.08 KB
|
|
69
|
-
CJS ⚡️ Build success in 35ms
|
|
70
|
-
ESM dist/context/index.mjs 185.00 B
|
|
71
|
-
ESM dist/index.mjs 1.39 KB
|
|
72
|
-
ESM dist/components/index.mjs 407.00 B
|
|
73
|
-
ESM dist/hooks/index.mjs 769.00 B
|
|
74
|
-
ESM dist/chunk-VP2EU4US.mjs 4.39 KB
|
|
75
|
-
ESM dist/chunk-FRAKUJWH.mjs 43.00 B
|
|
76
|
-
ESM dist/chunk-7GFKOIO7.mjs 43.00 B
|
|
77
|
-
ESM dist/chunk-MZ5UN3BY.mjs 802.00 B
|
|
78
|
-
ESM dist/chunk-DGUVNY3V.mjs 970.00 B
|
|
79
|
-
ESM dist/chunk-VNRDQJXW.mjs 43.00 B
|
|
80
|
-
ESM dist/chunk-BABVSMJR.mjs 43.00 B
|
|
81
|
-
ESM dist/chunk-5UGLWBZJ.mjs 43.00 B
|
|
82
|
-
ESM dist/chunk-IQH5AQQC.mjs 700.00 B
|
|
83
|
-
ESM dist/hooks/use-chat.mjs 174.00 B
|
|
84
|
-
ESM dist/chunk-5GS7FQPW.mjs 2.90 KB
|
|
85
|
-
ESM dist/chunk-YOXWT7I6.mjs 640.00 B
|
|
86
|
-
ESM dist/context/copilot-context.mjs 177.00 B
|
|
87
|
-
ESM dist/hooks/use-copilot-chat.mjs 500.00 B
|
|
88
|
-
ESM dist/chunk-JD7BAH7U.mjs 43.00 B
|
|
89
|
-
ESM dist/chunk-EFZPSZWO.mjs 43.00 B
|
|
90
|
-
ESM dist/chunk-VUY2K2DI.mjs 3.89 KB
|
|
91
|
-
ESM dist/chunk-F2JIAPZQ.mjs 405.00 B
|
|
92
|
-
ESM dist/chunk-4CFJ6A6A.mjs 1.33 KB
|
|
93
|
-
ESM dist/chunk-IQEWY7P4.mjs 3.33 KB
|
|
94
|
-
ESM dist/chunk-UAKLDQMP.mjs 2.38 KB
|
|
95
|
-
ESM dist/hooks/use-flat-category-store.mjs 216.00 B
|
|
96
|
-
ESM dist/chunk-MRXNTQOX.mjs 1.89 KB
|
|
97
|
-
ESM dist/chunk-SPCZTZCY.mjs 43.00 B
|
|
98
|
-
ESM dist/chunk-GBZZPQ5X.mjs 4.45 KB
|
|
99
|
-
ESM dist/chunk-YULKJPY3.mjs 1.84 KB
|
|
13
|
+
ESM dist/openai-assistants/hooks/index.mjs 548.00 B
|
|
14
|
+
ESM dist/openai-assistants/hooks/use-copilot-chat-v2.mjs 575.00 B
|
|
15
|
+
ESM dist/openai-assistants/utils/process-message-stream.mjs 188.00 B
|
|
16
|
+
ESM dist/components/copilot-provider/standard-copilot-api-config.mjs 201.00 B
|
|
100
17
|
ESM dist/openai-assistants/hooks/use-assistants.mjs 2.59 KB
|
|
101
18
|
ESM dist/utils/utils.test.mjs 170.00 B
|
|
19
|
+
ESM dist/types/index.mjs 66.00 B
|
|
20
|
+
ESM dist/utils/fetch-chat-completion.mjs 319.00 B
|
|
102
21
|
ESM dist/openai-assistants/utils/index.mjs 206.00 B
|
|
103
|
-
ESM dist/
|
|
22
|
+
ESM dist/types/system-message.mjs 43.00 B
|
|
23
|
+
ESM dist/utils/utils.mjs 34.00 B
|
|
104
24
|
ESM dist/components/copilot-provider/copilotkit-props.mjs 59.00 B
|
|
105
25
|
ESM dist/components/copilot-provider/copilotkit.mjs 380.00 B
|
|
106
26
|
ESM dist/components/copilot-provider/index.mjs 396.00 B
|
|
107
|
-
ESM dist/openai-assistants/hooks/index.mjs 548.00 B
|
|
108
|
-
ESM dist/components/copilot-provider/standard-copilot-api-config.mjs 201.00 B
|
|
109
27
|
ESM dist/hooks/use-make-copilot-actionable.mjs 241.00 B
|
|
110
|
-
ESM dist/
|
|
28
|
+
ESM dist/lib/copilot-task.mjs 410.00 B
|
|
111
29
|
ESM dist/hooks/use-make-copilot-readable.mjs 235.00 B
|
|
112
|
-
ESM dist/hooks/use-make-copilot-document-readable.mjs 260.00 B
|
|
113
30
|
ESM dist/hooks/use-tree.mjs 171.00 B
|
|
114
|
-
ESM dist/
|
|
115
|
-
ESM dist/
|
|
116
|
-
ESM dist/types/system-message.mjs 43.00 B
|
|
117
|
-
ESM dist/utils/utils.mjs 34.00 B
|
|
118
|
-
ESM dist/types/index.mjs 66.00 B
|
|
31
|
+
ESM dist/lib/index.mjs 435.00 B
|
|
32
|
+
ESM dist/types/document-pointer.mjs 45.00 B
|
|
119
33
|
ESM dist/openai-assistants/index.mjs 597.00 B
|
|
120
|
-
ESM dist/
|
|
121
|
-
ESM dist/
|
|
122
|
-
ESM dist/
|
|
123
|
-
ESM dist/
|
|
34
|
+
ESM dist/chunk-EFZPSZWO.mjs 43.00 B
|
|
35
|
+
ESM dist/chunk-7GFKOIO7.mjs 43.00 B
|
|
36
|
+
ESM dist/chunk-LUGEI4YQ.mjs 43.00 B
|
|
37
|
+
ESM dist/chunk-TZPIY754.mjs 3.17 KB
|
|
38
|
+
ESM dist/index.mjs 1.52 KB
|
|
39
|
+
ESM dist/chunk-FRAKUJWH.mjs 43.00 B
|
|
40
|
+
ESM dist/chunk-BABVSMJR.mjs 43.00 B
|
|
41
|
+
ESM dist/chunk-MZ5UN3BY.mjs 802.00 B
|
|
42
|
+
ESM dist/chunk-4LKP4DMT.mjs 4.39 KB
|
|
43
|
+
ESM dist/chunk-VNRDQJXW.mjs 43.00 B
|
|
44
|
+
ESM dist/context/copilot-context.mjs 219.00 B
|
|
45
|
+
ESM dist/context/index.mjs 227.00 B
|
|
46
|
+
ESM dist/hooks/index.mjs 769.00 B
|
|
47
|
+
ESM dist/components/index.mjs 407.00 B
|
|
48
|
+
ESM dist/chunk-K2LVBFRY.mjs 970.00 B
|
|
49
|
+
ESM dist/chunk-5UGLWBZJ.mjs 43.00 B
|
|
50
|
+
ESM dist/chunk-XBLCD24W.mjs 700.00 B
|
|
51
|
+
ESM dist/chunk-CPEUPJQJ.mjs 640.00 B
|
|
52
|
+
ESM dist/chunk-KZNQLITJ.mjs 2.89 KB
|
|
53
|
+
ESM dist/chunk-JD7BAH7U.mjs 43.00 B
|
|
54
|
+
ESM dist/hooks/use-copilot-chat.mjs 500.00 B
|
|
55
|
+
ESM dist/hooks/use-make-copilot-document-readable.mjs 260.00 B
|
|
56
|
+
ESM dist/chunk-KAZJPE2I.mjs 4.55 KB
|
|
57
|
+
ESM dist/chunk-SPCZTZCY.mjs 43.00 B
|
|
58
|
+
ESM dist/chunk-JIKWSWIX.mjs 2.35 KB
|
|
59
|
+
ESM dist/chunk-ABXVFQLN.mjs 3.89 KB
|
|
60
|
+
ESM dist/chunk-VUY2K2DI.mjs 3.89 KB
|
|
61
|
+
ESM dist/hooks/use-flat-category-store.mjs 216.00 B
|
|
62
|
+
ESM dist/chunk-4OWTRVNI.mjs 1.42 KB
|
|
63
|
+
ESM dist/hooks/use-chat.mjs 174.00 B
|
|
64
|
+
ESM dist/chunk-F2JIAPZQ.mjs 405.00 B
|
|
65
|
+
ESM dist/chunk-MRXNTQOX.mjs 1.89 KB
|
|
66
|
+
ESM dist/chunk-YULKJPY3.mjs 1.84 KB
|
|
67
|
+
ESM dist/openai-assistants/hooks/index.mjs.map 71.00 B
|
|
68
|
+
ESM dist/openai-assistants/hooks/use-copilot-chat-v2.mjs.map 71.00 B
|
|
69
|
+
ESM dist/openai-assistants/utils/process-message-stream.mjs.map 71.00 B
|
|
70
|
+
ESM dist/components/copilot-provider/standard-copilot-api-config.mjs.map 71.00 B
|
|
71
|
+
ESM dist/utils/utils.test.mjs.map 352.00 B
|
|
72
|
+
ESM dist/types/index.mjs.map 71.00 B
|
|
73
|
+
ESM dist/utils/fetch-chat-completion.mjs.map 71.00 B
|
|
74
|
+
ESM dist/types/system-message.mjs.map 71.00 B
|
|
75
|
+
ESM dist/openai-assistants/utils/index.mjs.map 71.00 B
|
|
76
|
+
ESM dist/utils/utils.mjs.map 71.00 B
|
|
77
|
+
ESM dist/components/copilot-provider/copilotkit.mjs.map 71.00 B
|
|
78
|
+
ESM dist/components/copilot-provider/index.mjs.map 71.00 B
|
|
79
|
+
ESM dist/lib/copilot-task.mjs.map 71.00 B
|
|
80
|
+
ESM dist/hooks/use-make-copilot-readable.mjs.map 71.00 B
|
|
81
|
+
ESM dist/hooks/use-tree.mjs.map 71.00 B
|
|
82
|
+
ESM dist/lib/index.mjs.map 71.00 B
|
|
83
|
+
ESM dist/openai-assistants/index.mjs.map 71.00 B
|
|
84
|
+
ESM dist/chunk-EFZPSZWO.mjs.map 71.00 B
|
|
124
85
|
ESM dist/chunk-7GFKOIO7.mjs.map 71.00 B
|
|
125
|
-
ESM dist/chunk-
|
|
126
|
-
ESM dist/chunk-
|
|
127
|
-
ESM dist/
|
|
86
|
+
ESM dist/chunk-LUGEI4YQ.mjs.map 71.00 B
|
|
87
|
+
ESM dist/chunk-TZPIY754.mjs.map 5.55 KB
|
|
88
|
+
ESM dist/index.mjs.map 71.00 B
|
|
89
|
+
ESM dist/chunk-FRAKUJWH.mjs.map 71.00 B
|
|
90
|
+
ESM dist/hooks/use-make-copilot-actionable.mjs.map 71.00 B
|
|
128
91
|
ESM dist/chunk-BABVSMJR.mjs.map 71.00 B
|
|
129
|
-
ESM dist/chunk-
|
|
130
|
-
ESM dist/hooks/use-chat.mjs.map 71.00 B
|
|
131
|
-
ESM dist/chunk-YOXWT7I6.mjs.map 1.47 KB
|
|
132
|
-
ESM dist/context/copilot-context.mjs.map 71.00 B
|
|
133
|
-
ESM dist/chunk-VP2EU4US.mjs.map 7.90 KB
|
|
92
|
+
ESM dist/chunk-4LKP4DMT.mjs.map 7.90 KB
|
|
134
93
|
ESM dist/chunk-VNRDQJXW.mjs.map 71.00 B
|
|
94
|
+
ESM dist/context/index.mjs.map 71.00 B
|
|
95
|
+
ESM dist/hooks/index.mjs.map 71.00 B
|
|
96
|
+
ESM dist/components/index.mjs.map 71.00 B
|
|
97
|
+
ESM dist/chunk-K2LVBFRY.mjs.map 1.66 KB
|
|
98
|
+
ESM dist/chunk-5UGLWBZJ.mjs.map 71.00 B
|
|
99
|
+
ESM dist/chunk-XBLCD24W.mjs.map 1.42 KB
|
|
100
|
+
ESM dist/chunk-CPEUPJQJ.mjs.map 1.47 KB
|
|
101
|
+
ESM dist/chunk-KZNQLITJ.mjs.map 4.59 KB
|
|
102
|
+
ESM dist/chunk-JD7BAH7U.mjs.map 71.00 B
|
|
135
103
|
ESM dist/hooks/use-copilot-chat.mjs.map 71.00 B
|
|
104
|
+
ESM dist/hooks/use-make-copilot-document-readable.mjs.map 71.00 B
|
|
105
|
+
ESM dist/chunk-KAZJPE2I.mjs.map 9.62 KB
|
|
106
|
+
ESM dist/chunk-SPCZTZCY.mjs.map 71.00 B
|
|
107
|
+
ESM dist/chunk-JIKWSWIX.mjs.map 3.98 KB
|
|
108
|
+
ESM dist/chunk-ABXVFQLN.mjs.map 8.85 KB
|
|
136
109
|
ESM dist/chunk-VUY2K2DI.mjs.map 8.27 KB
|
|
137
|
-
ESM dist/chunk-
|
|
138
|
-
ESM dist/
|
|
110
|
+
ESM dist/chunk-4OWTRVNI.mjs.map 4.35 KB
|
|
111
|
+
ESM dist/hooks/use-chat.mjs.map 71.00 B
|
|
139
112
|
ESM dist/chunk-F2JIAPZQ.mjs.map 1.12 KB
|
|
140
|
-
ESM dist/chunk-5GS7FQPW.mjs.map 4.59 KB
|
|
141
|
-
ESM dist/chunk-EFZPSZWO.mjs.map 71.00 B
|
|
142
|
-
ESM dist/chunk-UAKLDQMP.mjs.map 4.00 KB
|
|
143
113
|
ESM dist/hooks/use-flat-category-store.mjs.map 71.00 B
|
|
144
|
-
ESM dist/
|
|
145
|
-
ESM dist/chunk-IQEWY7P4.mjs.map 7.81 KB
|
|
146
|
-
ESM dist/chunk-SPCZTZCY.mjs.map 71.00 B
|
|
147
|
-
ESM dist/chunk-MRXNTQOX.mjs.map 71.00 B
|
|
148
|
-
ESM dist/chunk-GBZZPQ5X.mjs.map 9.29 KB
|
|
114
|
+
ESM dist/context/copilot-context.mjs.map 71.00 B
|
|
149
115
|
ESM dist/chunk-YULKJPY3.mjs.map 4.21 KB
|
|
116
|
+
ESM dist/chunk-MRXNTQOX.mjs.map 71.00 B
|
|
150
117
|
ESM dist/openai-assistants/hooks/use-assistants.mjs.map 4.67 KB
|
|
151
|
-
ESM dist/
|
|
118
|
+
ESM dist/chunk-MZ5UN3BY.mjs.map 1.26 KB
|
|
152
119
|
ESM dist/components/copilot-provider/copilotkit-props.mjs.map 71.00 B
|
|
153
|
-
ESM dist/components/copilot-provider/copilotkit.mjs.map 71.00 B
|
|
154
|
-
ESM dist/components/copilot-provider/standard-copilot-api-config.mjs.map 71.00 B
|
|
155
|
-
ESM dist/openai-assistants/hooks/index.mjs.map 71.00 B
|
|
156
120
|
ESM dist/types/document-pointer.mjs.map 71.00 B
|
|
157
|
-
ESM
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
121
|
+
ESM ⚡️ Build success in 49ms
|
|
122
|
+
CJS dist/index.js 34.54 KB
|
|
123
|
+
CJS dist/context/index.js 3.60 KB
|
|
124
|
+
CJS dist/hooks/index.js 15.21 KB
|
|
125
|
+
CJS dist/lib/copilot-task.js 7.17 KB
|
|
126
|
+
CJS dist/components/index.js 15.12 KB
|
|
127
|
+
CJS dist/openai-assistants/index.js 9.31 KB
|
|
128
|
+
CJS dist/utils/fetch-chat-completion.js 4.78 KB
|
|
129
|
+
CJS dist/types/document-pointer.js 841.00 B
|
|
130
|
+
CJS dist/components/copilot-provider/copilotkit-props.js 878.00 B
|
|
131
|
+
CJS dist/openai-assistants/utils/index.js 2.30 KB
|
|
132
|
+
CJS dist/openai-assistants/hooks/use-assistants.js 4.82 KB
|
|
133
|
+
CJS dist/hooks/use-copilot-chat.js 13.04 KB
|
|
134
|
+
CJS dist/hooks/use-tree.js 5.53 KB
|
|
135
|
+
CJS dist/hooks/use-make-copilot-readable.js 4.10 KB
|
|
136
|
+
CJS dist/hooks/use-make-copilot-actionable.js 4.47 KB
|
|
137
|
+
CJS dist/hooks/use-chat.js 7.81 KB
|
|
138
|
+
CJS dist/hooks/use-flat-category-store.js 2.87 KB
|
|
139
|
+
CJS dist/types/index.js 797.00 B
|
|
140
|
+
CJS dist/types/system-message.js 833.00 B
|
|
141
|
+
CJS dist/utils/utils.test.js 184.00 B
|
|
142
|
+
CJS dist/components/copilot-provider/index.js 15.16 KB
|
|
143
|
+
CJS dist/hooks/use-make-copilot-document-readable.js 4.22 KB
|
|
144
|
+
CJS dist/utils/utils.js 797.00 B
|
|
145
|
+
CJS dist/openai-assistants/utils/process-message-stream.js 2.33 KB
|
|
146
|
+
CJS dist/lib/index.js 7.13 KB
|
|
147
|
+
CJS dist/components/copilot-provider/copilotkit.js 15.11 KB
|
|
148
|
+
CJS dist/openai-assistants/hooks/index.js 9.21 KB
|
|
149
|
+
CJS dist/openai-assistants/hooks/use-copilot-chat-v2.js 9.30 KB
|
|
150
|
+
CJS dist/components/copilot-provider/standard-copilot-api-config.js 1.48 KB
|
|
151
|
+
CJS dist/context/copilot-context.js 3.62 KB
|
|
152
|
+
CJS dist/index.js.map 64.08 KB
|
|
153
|
+
CJS dist/context/index.js.map 4.67 KB
|
|
154
|
+
CJS dist/lib/copilot-task.js.map 16.40 KB
|
|
155
|
+
CJS dist/components/index.js.map 27.51 KB
|
|
156
|
+
CJS dist/openai-assistants/index.js.map 20.70 KB
|
|
157
|
+
CJS dist/types/document-pointer.js.map 292.00 B
|
|
158
|
+
CJS dist/utils/fetch-chat-completion.js.map 4.03 KB
|
|
159
|
+
CJS dist/hooks/index.js.map 33.45 KB
|
|
160
|
+
CJS dist/components/copilot-provider/copilotkit-props.js.map 894.00 B
|
|
161
|
+
CJS dist/openai-assistants/utils/index.js.map 1.44 KB
|
|
162
|
+
CJS dist/openai-assistants/hooks/use-assistants.js.map 5.92 KB
|
|
163
|
+
CJS dist/hooks/use-copilot-chat.js.map 28.54 KB
|
|
164
|
+
CJS dist/hooks/use-make-copilot-readable.js.map 5.79 KB
|
|
165
|
+
CJS dist/hooks/use-make-copilot-actionable.js.map 5.98 KB
|
|
166
|
+
CJS dist/hooks/use-flat-category-store.js.map 4.25 KB
|
|
167
|
+
CJS dist/hooks/use-chat.js.map 12.54 KB
|
|
168
|
+
CJS dist/types/index.js.map 253.00 B
|
|
169
|
+
CJS dist/types/system-message.js.map 249.00 B
|
|
170
|
+
CJS dist/utils/utils.test.js.map 354.00 B
|
|
171
|
+
CJS dist/components/copilot-provider/index.js.map 27.64 KB
|
|
172
|
+
CJS dist/hooks/use-make-copilot-document-readable.js.map 5.75 KB
|
|
173
|
+
CJS dist/utils/utils.js.map 137.00 B
|
|
174
|
+
CJS dist/hooks/use-tree.js.map 8.32 KB
|
|
175
|
+
CJS dist/components/copilot-provider/copilotkit.js.map 27.45 KB
|
|
176
|
+
CJS dist/openai-assistants/hooks/index.js.map 21.00 KB
|
|
177
|
+
CJS dist/lib/index.js.map 16.46 KB
|
|
178
|
+
CJS dist/openai-assistants/hooks/use-copilot-chat-v2.js.map 20.61 KB
|
|
179
|
+
CJS dist/components/copilot-provider/standard-copilot-api-config.js.map 1.17 KB
|
|
180
|
+
CJS dist/openai-assistants/utils/process-message-stream.js.map 1.33 KB
|
|
181
|
+
CJS dist/context/copilot-context.js.map 4.44 KB
|
|
182
|
+
CJS ⚡️ Build success in 51ms
|
|
171
183
|
DTS Build start
|
|
172
|
-
DTS ⚡️ Build success in
|
|
173
|
-
DTS dist/index.d.ts 1.
|
|
184
|
+
DTS ⚡️ Build success in 2192ms
|
|
185
|
+
DTS dist/index.d.ts 1.41 KB
|
|
174
186
|
DTS dist/components/copilot-provider/copilotkit.d.ts 1.26 KB
|
|
175
187
|
DTS dist/components/copilot-provider/copilotkit-props.d.ts 749.00 B
|
|
176
|
-
DTS dist/context/copilot-context.d.ts
|
|
188
|
+
DTS dist/context/copilot-context.d.ts 2.06 KB
|
|
177
189
|
DTS dist/hooks/use-copilot-chat.d.ts 1.01 KB
|
|
178
190
|
DTS dist/hooks/use-make-copilot-actionable.d.ts 243.00 B
|
|
179
191
|
DTS dist/hooks/use-make-copilot-readable.d.ts 598.00 B
|
|
180
192
|
DTS dist/hooks/use-make-copilot-document-readable.d.ts 516.00 B
|
|
181
|
-
DTS dist/hooks/use-chat.d.ts 2.
|
|
193
|
+
DTS dist/hooks/use-chat.d.ts 2.69 KB
|
|
182
194
|
DTS dist/types/document-pointer.d.ts 181.00 B
|
|
183
195
|
DTS dist/types/system-message.d.ts 132.00 B
|
|
184
196
|
DTS dist/openai-assistants/hooks/use-copilot-chat-v2.d.ts 1.41 KB
|
|
185
197
|
DTS dist/openai-assistants/utils/process-message-stream.d.ts 196.00 B
|
|
198
|
+
DTS dist/lib/copilot-task.d.ts 1.01 KB
|
|
186
199
|
DTS dist/utils/fetch-chat-completion.d.ts 1.34 KB
|
|
187
200
|
DTS dist/hooks/use-tree.d.ts 543.00 B
|
|
201
|
+
DTS dist/context/index.d.ts 229.00 B
|
|
188
202
|
DTS dist/components/index.d.ts 186.00 B
|
|
189
|
-
DTS dist/context/index.d.ts 210.00 B
|
|
190
203
|
DTS dist/hooks/index.d.ts 574.00 B
|
|
191
204
|
DTS dist/hooks/use-flat-category-store.d.ts 424.00 B
|
|
205
|
+
DTS dist/lib/index.d.ts 223.00 B
|
|
192
206
|
DTS dist/openai-assistants/index.d.ts 262.00 B
|
|
193
207
|
DTS dist/types/index.d.ts 118.00 B
|
|
194
208
|
DTS dist/utils/utils.test.d.ts 12.00 B
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# ui
|
|
2
2
|
|
|
3
|
+
## 0.20.0-demofixes.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- helloworld to presentation, refactor audio gen to util
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @copilotkit/shared@0.4.0-demofixes.1
|
|
13
|
+
|
|
14
|
+
## 0.20.0-tools.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- Test the tools API
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
- @copilotkit/shared@0.4.0-tools.0
|
|
24
|
+
|
|
25
|
+
## 0.19.0
|
|
26
|
+
|
|
27
|
+
### Minor Changes
|
|
28
|
+
|
|
29
|
+
- node CopilotBackend support
|
|
30
|
+
- 58a8524: clean node example impl
|
|
31
|
+
- a34a226: node-native backend support
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies
|
|
36
|
+
- Updated dependencies [58a8524]
|
|
37
|
+
- Updated dependencies [a34a226]
|
|
38
|
+
- @copilotkit/shared@0.3.0
|
|
39
|
+
|
|
3
40
|
## 0.19.0-alpha.1
|
|
4
41
|
|
|
5
42
|
### Minor Changes
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-MZ5UN3BY.mjs";
|
|
4
4
|
import {
|
|
5
5
|
defaultCopilotContextCategories
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KAZJPE2I.mjs";
|
|
7
7
|
import {
|
|
8
8
|
CopilotContext
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4OWTRVNI.mjs";
|
|
10
10
|
import {
|
|
11
11
|
__async,
|
|
12
12
|
__spreadValues
|
|
@@ -134,4 +134,4 @@ export {
|
|
|
134
134
|
useCopilotChatV2,
|
|
135
135
|
defaultSystemMessage
|
|
136
136
|
};
|
|
137
|
-
//# sourceMappingURL=chunk-
|
|
137
|
+
//# sourceMappingURL=chunk-4LKP4DMT.mjs.map
|
|
@@ -37,12 +37,16 @@ var emptyCopilotContext = {
|
|
|
37
37
|
}()
|
|
38
38
|
};
|
|
39
39
|
var CopilotContext = React.createContext(emptyCopilotContext);
|
|
40
|
+
function useCopilotContext() {
|
|
41
|
+
return React.useContext(CopilotContext);
|
|
42
|
+
}
|
|
40
43
|
function returnAndThrowInDebug(value) {
|
|
41
44
|
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
|
|
42
45
|
return value;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
export {
|
|
46
|
-
CopilotContext
|
|
49
|
+
CopilotContext,
|
|
50
|
+
useCopilotContext
|
|
47
51
|
};
|
|
48
|
-
//# sourceMappingURL=chunk-
|
|
52
|
+
//# sourceMappingURL=chunk-4OWTRVNI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/context/copilot-context.tsx"],"sourcesContent":["\"use client\";\n\nimport { FunctionCallHandler, AnnotatedFunction, ToolDefinition } from \"@copilotkit/shared\";\nimport React from \"react\";\nimport { TreeNodeId } from \"../hooks/use-tree\";\nimport { DocumentPointer } from \"../types\";\n\n/**\n * Interface for the configuration of the Copilot API.\n */\nexport interface CopilotApiConfig {\n /**\n * The endpoint for the chat API.\n */\n chatApiEndpoint: string;\n\n /**\n * The endpoint for the chat API v2.\n */\n chatApiEndpointV2: string;\n\n /**\n * additional headers to be sent with the request\n * @default {}\n * @example\n * ```\n * {\n * 'Authorization': 'Bearer your_token_here'\n * }\n * ```\n */\n headers: Record<string, string>;\n\n /**\n * Additional body params to be sent with the request\n * @default {}\n * @example\n * ```\n * {\n * 'message': 'Hello, world!'\n * }\n * ```\n */\n body: Record<string, any>;\n}\n\nexport interface CopilotContextParams {\n // function-calling\n entryPoints: Record<string, AnnotatedFunction<any[]>>;\n setEntryPoint: (id: string, entryPoint: AnnotatedFunction<any[]>) => void;\n removeEntryPoint: (id: string) => void;\n getChatCompletionFunctionDescriptions: (\n customEntryPoints?: Record<string, AnnotatedFunction<any[]>>,\n ) => ToolDefinition[];\n getFunctionCallHandler: (\n customEntryPoints?: Record<string, AnnotatedFunction<any[]>>,\n ) => FunctionCallHandler;\n\n // text context\n addContext: (context: string, parentId?: string, categories?: string[]) => TreeNodeId;\n removeContext: (id: TreeNodeId) => void;\n getContextString: (documents: DocumentPointer[], categories: string[]) => string;\n\n // document context\n addDocumentContext: (documentPointer: DocumentPointer, categories?: string[]) => TreeNodeId;\n removeDocumentContext: (documentId: string) => void;\n getDocumentsContext: (categories: string[]) => DocumentPointer[];\n\n // api endpoints\n copilotApiConfig: CopilotApiConfig;\n}\n\nconst emptyCopilotContext: CopilotContextParams = {\n entryPoints: {},\n setEntryPoint: () => {},\n removeEntryPoint: () => {},\n getChatCompletionFunctionDescriptions: () => returnAndThrowInDebug([]),\n getFunctionCallHandler: () => returnAndThrowInDebug(async () => {}),\n\n getContextString: (documents: DocumentPointer[], categories: string[]) =>\n returnAndThrowInDebug(\"\"),\n addContext: () => \"\",\n removeContext: () => {},\n\n getDocumentsContext: (categories: string[]) => returnAndThrowInDebug([]),\n addDocumentContext: () => returnAndThrowInDebug(\"\"),\n removeDocumentContext: () => {},\n\n copilotApiConfig: new (class implements CopilotApiConfig {\n get chatApiEndpoint(): string {\n throw new Error(\"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!\");\n }\n get chatApiEndpointV2(): string {\n throw new Error(\"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!\");\n }\n get headers(): Record<string, string> {\n return {};\n }\n get body(): Record<string, any> {\n return {};\n }\n })(),\n};\n\nexport const CopilotContext = React.createContext<CopilotContextParams>(emptyCopilotContext);\n\nexport function useCopilotContext(): CopilotContextParams {\n return React.useContext(CopilotContext);\n}\n\nfunction returnAndThrowInDebug<T>(value: T): T {\n throw new Error(\"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!\");\n return value;\n}\n"],"mappings":";;;;;AAGA,OAAO,WAAW;AAqElB,IAAM,sBAA4C;AAAA,EAChD,aAAa,CAAC;AAAA,EACd,eAAe,MAAM;AAAA,EAAC;AAAA,EACtB,kBAAkB,MAAM;AAAA,EAAC;AAAA,EACzB,uCAAuC,MAAM,sBAAsB,CAAC,CAAC;AAAA,EACrE,wBAAwB,MAAM,sBAAsB,MAAY;AAAA,EAAC,EAAC;AAAA,EAElE,kBAAkB,CAAC,WAA8B,eAC/C,sBAAsB,EAAE;AAAA,EAC1B,YAAY,MAAM;AAAA,EAClB,eAAe,MAAM;AAAA,EAAC;AAAA,EAEtB,qBAAqB,CAAC,eAAyB,sBAAsB,CAAC,CAAC;AAAA,EACvE,oBAAoB,MAAM,sBAAsB,EAAE;AAAA,EAClD,uBAAuB,MAAM;AAAA,EAAC;AAAA,EAE9B,kBAAkB,IAAK,MAAkC;AAAA,IACvD,IAAI,kBAA0B;AAC5B,YAAM,IAAI,MAAM,uEAAuE;AAAA,IACzF;AAAA,IACA,IAAI,oBAA4B;AAC9B,YAAM,IAAI,MAAM,uEAAuE;AAAA,IACzF;AAAA,IACA,IAAI,UAAkC;AACpC,aAAO,CAAC;AAAA,IACV;AAAA,IACA,IAAI,OAA4B;AAC9B,aAAO,CAAC;AAAA,IACV;AAAA,EACF,EAAG;AACL;AAEO,IAAM,iBAAiB,MAAM,cAAoC,mBAAmB;AAEpF,SAAS,oBAA0C;AACxD,SAAO,MAAM,WAAW,cAAc;AACxC;AAEA,SAAS,sBAAyB,OAAa;AAC7C,QAAM,IAAI,MAAM,uEAAuE;AACvF,SAAO;AACT;","names":[]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fetchAndDecodeChatCompletion
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JIKWSWIX.mjs";
|
|
4
4
|
import {
|
|
5
|
-
__async
|
|
6
|
-
__spreadValues
|
|
5
|
+
__async
|
|
7
6
|
} from "./chunk-MRXNTQOX.mjs";
|
|
8
7
|
|
|
9
8
|
// src/hooks/use-chat.ts
|
|
@@ -15,21 +14,24 @@ function useChat(options) {
|
|
|
15
14
|
const [isLoading, setIsLoading] = useState(false);
|
|
16
15
|
const abortControllerRef = useRef();
|
|
17
16
|
const runChatCompletion = (messages2) => __async(this, null, function* () {
|
|
17
|
+
var _a;
|
|
18
18
|
setIsLoading(true);
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const newMessages = [
|
|
20
|
+
{
|
|
21
|
+
id: nanoid(),
|
|
22
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
23
|
+
content: "",
|
|
24
|
+
role: "assistant"
|
|
25
|
+
}
|
|
26
|
+
];
|
|
25
27
|
const abortController = new AbortController();
|
|
26
28
|
abortControllerRef.current = abortController;
|
|
27
|
-
setMessages([...messages2,
|
|
29
|
+
setMessages([...messages2, ...newMessages]);
|
|
28
30
|
const messagesWithContext = [...options.initialMessages || [], ...messages2];
|
|
29
31
|
const response = yield fetchAndDecodeChatCompletion({
|
|
30
32
|
copilotConfig: options.copilotConfig,
|
|
31
33
|
messages: messagesWithContext,
|
|
32
|
-
|
|
34
|
+
tools: options.tools,
|
|
33
35
|
headers: options.headers,
|
|
34
36
|
signal: abortController.signal
|
|
35
37
|
});
|
|
@@ -37,36 +39,51 @@ function useChat(options) {
|
|
|
37
39
|
throw new Error("Failed to fetch chat completion");
|
|
38
40
|
}
|
|
39
41
|
const reader = response.events.getReader();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
try {
|
|
43
|
+
while (true) {
|
|
42
44
|
const { done, value } = yield reader.read();
|
|
43
45
|
if (done) {
|
|
44
|
-
|
|
45
|
-
return __spreadValues({}, assistantMessage);
|
|
46
|
+
return newMessages.slice();
|
|
46
47
|
}
|
|
48
|
+
let currentMessage = Object.assign({}, newMessages[newMessages.length - 1]);
|
|
47
49
|
if (value.type === "content") {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
if (currentMessage.function_call) {
|
|
51
|
+
currentMessage = {
|
|
52
|
+
id: nanoid(),
|
|
53
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
54
|
+
content: "",
|
|
55
|
+
role: "assistant"
|
|
56
|
+
};
|
|
57
|
+
newMessages.push(currentMessage);
|
|
58
|
+
}
|
|
59
|
+
currentMessage.content += value.content;
|
|
60
|
+
newMessages[newMessages.length - 1] = currentMessage;
|
|
61
|
+
setMessages([...messages2, ...newMessages]);
|
|
50
62
|
} else if (value.type === "function") {
|
|
51
|
-
|
|
63
|
+
if (currentMessage.content != "" || currentMessage.function_call) {
|
|
64
|
+
currentMessage = {
|
|
65
|
+
id: nanoid(),
|
|
66
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
67
|
+
content: "",
|
|
68
|
+
role: "assistant"
|
|
69
|
+
};
|
|
70
|
+
newMessages.push(currentMessage);
|
|
71
|
+
}
|
|
72
|
+
currentMessage.function_call = {
|
|
52
73
|
name: value.name,
|
|
53
74
|
arguments: JSON.stringify(value.arguments)
|
|
54
75
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
76
|
+
newMessages[newMessages.length - 1] = currentMessage;
|
|
77
|
+
setMessages([...messages2, ...newMessages]);
|
|
78
|
+
yield (_a = options.onFunctionCall) == null ? void 0 : _a.call(options, messages2, currentMessage.function_call);
|
|
58
79
|
}
|
|
59
|
-
} catch (error) {
|
|
60
|
-
setIsLoading(false);
|
|
61
|
-
throw error;
|
|
62
80
|
}
|
|
81
|
+
} finally {
|
|
82
|
+
setIsLoading(false);
|
|
63
83
|
}
|
|
64
84
|
});
|
|
65
85
|
const runChatCompletionAndHandleFunctionCall = (messages2) => __async(this, null, function* () {
|
|
66
|
-
|
|
67
|
-
if (message.function_call && options.onFunctionCall) {
|
|
68
|
-
yield options.onFunctionCall(messages2, message.function_call);
|
|
69
|
-
}
|
|
86
|
+
yield runChatCompletion(messages2);
|
|
70
87
|
});
|
|
71
88
|
const append = (message) => __async(this, null, function* () {
|
|
72
89
|
if (isLoading) {
|
|
@@ -106,4 +123,4 @@ function useChat(options) {
|
|
|
106
123
|
export {
|
|
107
124
|
useChat
|
|
108
125
|
};
|
|
109
|
-
//# sourceMappingURL=chunk-
|
|
126
|
+
//# sourceMappingURL=chunk-ABXVFQLN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-chat.ts"],"sourcesContent":["import { useRef, useState } from \"react\";\nimport { Message, ToolDefinition, FunctionCallHandler } from \"@copilotkit/shared\";\nimport { nanoid } from \"nanoid\";\nimport { fetchAndDecodeChatCompletion } from \"../utils/fetch-chat-completion\";\nimport { CopilotApiConfig } from \"../context\";\n\nexport type UseChatOptions = {\n /**\n * The API endpoint that accepts a `{ messages: Message[] }` object and returns\n * a stream of tokens of the AI chat response. Defaults to `/api/chat`.\n */\n api?: string;\n /**\n * A unique identifier for the chat. If not provided, a random one will be\n * generated. When provided, the `useChat` hook with the same `id` will\n * have shared states across components.\n */\n id?: string;\n /**\n * System messages of the chat. Defaults to an empty array.\n */\n initialMessages?: Message[];\n /**\n * Callback function to be called when a function call is received.\n * If the function returns a `ChatRequest` object, the request will be sent\n * automatically to the API and will be used to update the chat.\n */\n onFunctionCall?: FunctionCallHandler;\n /**\n * HTTP headers to be sent with the API request.\n */\n headers?: Record<string, string> | Headers;\n /**\n * Extra body object to be sent with the API request.\n * @example\n * Send a `sessionId` to the API along with the messages.\n * ```js\n * useChat({\n * body: {\n * sessionId: '123',\n * }\n * })\n * ```\n */\n body?: object;\n /**\n * Function definitions to be sent to the API.\n */\n tools?: ToolDefinition[];\n};\n\nexport type UseChatHelpers = {\n /** Current messages in the chat */\n messages: Message[];\n /**\n * Append a user message to the chat list. This triggers the API call to fetch\n * the assistant's response.\n * @param message The message to append\n */\n append: (message: Message) => Promise<void>;\n /**\n * Reload the last AI chat response for the given chat history. If the last\n * message isn't from the assistant, it will request the API to generate a\n * new response.\n */\n reload: () => Promise<void>;\n /**\n * Abort the current request immediately, keep the generated tokens if any.\n */\n stop: () => void;\n /** The current value of the input */\n input: string;\n /** setState-powered method to update the input value */\n setInput: React.Dispatch<React.SetStateAction<string>>;\n /** Whether the API request is in progress */\n isLoading: boolean;\n};\n\nexport type UseChatOptionsWithCopilotConfig = UseChatOptions & {\n copilotConfig: CopilotApiConfig;\n};\n\nexport function useChat(options: UseChatOptionsWithCopilotConfig): UseChatHelpers {\n const [messages, setMessages] = useState<Message[]>([]);\n const [input, setInput] = useState(\"\");\n const [isLoading, setIsLoading] = useState(false);\n const abortControllerRef = useRef<AbortController>();\n\n const runChatCompletion = async (messages: Message[]): Promise<Message[]> => {\n setIsLoading(true);\n\n const newMessages: Message[] = [\n {\n id: nanoid(),\n createdAt: new Date(),\n content: \"\",\n role: \"assistant\",\n },\n ];\n const abortController = new AbortController();\n abortControllerRef.current = abortController;\n\n setMessages([...messages, ...newMessages]);\n\n const messagesWithContext = [...(options.initialMessages || []), ...messages];\n const response = await fetchAndDecodeChatCompletion({\n copilotConfig: options.copilotConfig,\n messages: messagesWithContext,\n tools: options.tools,\n headers: options.headers,\n signal: abortController.signal,\n });\n\n if (!response.events) {\n throw new Error(\"Failed to fetch chat completion\");\n }\n\n const reader = response.events.getReader();\n try {\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) {\n return newMessages.slice();\n }\n\n let currentMessage = Object.assign({}, newMessages[newMessages.length - 1]);\n\n if (value.type === \"content\") {\n if (currentMessage.function_call) {\n // Create a new message if the previous one is a function call\n currentMessage = {\n id: nanoid(),\n createdAt: new Date(),\n content: \"\",\n role: \"assistant\",\n };\n newMessages.push(currentMessage);\n }\n currentMessage.content += value.content;\n newMessages[newMessages.length - 1] = currentMessage;\n setMessages([...messages, ...newMessages]);\n } else if (value.type === \"function\") {\n // Create a new message if the previous one is not empty\n if (currentMessage.content != \"\" || currentMessage.function_call) {\n currentMessage = {\n id: nanoid(),\n createdAt: new Date(),\n content: \"\",\n role: \"assistant\",\n };\n newMessages.push(currentMessage);\n }\n currentMessage.function_call = {\n name: value.name,\n arguments: JSON.stringify(value.arguments),\n };\n\n newMessages[newMessages.length - 1] = currentMessage;\n setMessages([...messages, ...newMessages]);\n\n // Execute the function call\n await options.onFunctionCall?.(messages, currentMessage.function_call);\n }\n }\n } finally {\n setIsLoading(false);\n }\n };\n\n const runChatCompletionAndHandleFunctionCall = async (messages: Message[]): Promise<void> => {\n await runChatCompletion(messages);\n };\n\n const append = async (message: Message): Promise<void> => {\n if (isLoading) {\n return;\n }\n const newMessages = [...messages, message];\n setMessages(newMessages);\n return runChatCompletionAndHandleFunctionCall(newMessages);\n };\n\n const reload = async (): Promise<void> => {\n if (isLoading || messages.length === 0) {\n return;\n }\n let newMessages = [...messages];\n const lastMessage = messages[messages.length - 1];\n\n if (lastMessage.role === \"assistant\") {\n newMessages = newMessages.slice(0, -1);\n }\n setMessages(newMessages);\n\n return runChatCompletionAndHandleFunctionCall(newMessages);\n };\n\n const stop = (): void => {\n abortControllerRef.current?.abort();\n };\n\n return {\n messages,\n append,\n reload,\n stop,\n isLoading,\n input,\n setInput,\n };\n}\n"],"mappings":"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","names":["messages"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4OWTRVNI.mjs";
|
|
4
4
|
|
|
5
5
|
// src/hooks/use-make-copilot-readable.ts
|
|
6
6
|
import { useContext, useEffect, useRef } from "react";
|
|
@@ -20,4 +20,4 @@ function useMakeCopilotReadable(information, parentId, categories) {
|
|
|
20
20
|
export {
|
|
21
21
|
useMakeCopilotReadable
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-CPEUPJQJ.mjs.map
|