@copilotkit/react-textarea 0.0.0-fix-mcp-parameters-extract-20250710161807 → 0.0.0-fix-surface-agui-stream-errors-20250730142248
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/CHANGELOG.md +176 -4
- package/README.md +124 -29
- package/dist/{chunk-4ECCCOFV.mjs → chunk-6SGWO63I.mjs} +4 -4
- package/dist/{chunk-YDHTZ3EW.mjs → chunk-F44ZOUO7.mjs} +9 -9
- package/dist/{chunk-Q2R7EHCH.mjs → chunk-WQA62MUP.mjs} +5 -5
- package/dist/chunk-WQA62MUP.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +5 -5
- package/dist/components/copilot-textarea/copilot-textarea.d.ts +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +12 -12
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +12 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -19
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +2 -2
- package/dist/types/autosuggestions-config/index.mjs +2 -2
- package/dist/types/index.mjs +3 -3
- package/package.json +6 -6
- package/src/components/copilot-textarea/copilot-textarea.tsx +1 -1
- package/dist/chunk-Q2R7EHCH.mjs.map +0 -1
- /package/dist/{chunk-4ECCCOFV.mjs.map → chunk-6SGWO63I.mjs.map} +0 -0
- /package/dist/{chunk-YDHTZ3EW.mjs.map → chunk-F44ZOUO7.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,146 @@
|
|
|
1
1
|
# ui
|
|
2
2
|
|
|
3
|
-
## 0.0.0-fix-
|
|
3
|
+
## 0.0.0-fix-surface-agui-stream-errors-20250730142248
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [967d0ab]
|
|
8
|
+
- Updated dependencies [a8c0263]
|
|
9
|
+
- Updated dependencies [8674da1]
|
|
10
|
+
- Updated dependencies [6de24ce]
|
|
11
|
+
- @copilotkit/react-core@0.0.0-fix-surface-agui-stream-errors-20250730142248
|
|
12
|
+
- @copilotkit/shared@0.0.0-fix-surface-agui-stream-errors-20250730142248
|
|
13
|
+
- @copilotkit/runtime-client-gql@0.0.0-fix-surface-agui-stream-errors-20250730142248
|
|
14
|
+
|
|
15
|
+
## 1.10.0-next.8
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [6de24ce]
|
|
20
|
+
- @copilotkit/react-core@1.10.0-next.8
|
|
21
|
+
- @copilotkit/runtime-client-gql@1.10.0-next.8
|
|
22
|
+
- @copilotkit/shared@1.10.0-next.8
|
|
23
|
+
|
|
24
|
+
## 1.10.0-next.7
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- @copilotkit/runtime-client-gql@1.10.0-next.7
|
|
29
|
+
- @copilotkit/react-core@1.10.0-next.7
|
|
30
|
+
- @copilotkit/shared@1.10.0-next.7
|
|
31
|
+
|
|
32
|
+
## 1.10.0-next.6
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- @copilotkit/runtime-client-gql@1.10.0-next.6
|
|
37
|
+
- @copilotkit/react-core@1.10.0-next.6
|
|
38
|
+
- @copilotkit/shared@1.10.0-next.6
|
|
39
|
+
|
|
40
|
+
## 1.10.0-next.5
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- Updated dependencies [a8c0263]
|
|
45
|
+
- @copilotkit/shared@1.10.0-next.5
|
|
46
|
+
- @copilotkit/react-core@1.10.0-next.5
|
|
47
|
+
- @copilotkit/runtime-client-gql@1.10.0-next.5
|
|
48
|
+
|
|
49
|
+
## 1.10.0-next.4
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- Updated dependencies [967d0ab]
|
|
54
|
+
- @copilotkit/react-core@1.10.0-next.4
|
|
55
|
+
- @copilotkit/runtime-client-gql@1.10.0-next.4
|
|
56
|
+
- @copilotkit/shared@1.10.0-next.4
|
|
57
|
+
|
|
58
|
+
## 1.10.0-next.3
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- @copilotkit/runtime-client-gql@1.10.0-next.3
|
|
63
|
+
- @copilotkit/react-core@1.10.0-next.3
|
|
64
|
+
- @copilotkit/shared@1.10.0-next.3
|
|
65
|
+
|
|
66
|
+
## 1.10.0-next.2
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- @copilotkit/runtime-client-gql@1.10.0-next.2
|
|
71
|
+
- @copilotkit/react-core@1.10.0-next.2
|
|
72
|
+
- @copilotkit/shared@1.10.0-next.2
|
|
73
|
+
|
|
74
|
+
## 1.10.0-next.1
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- @copilotkit/runtime-client-gql@1.10.0-next.1
|
|
79
|
+
- @copilotkit/react-core@1.10.0-next.1
|
|
80
|
+
- @copilotkit/shared@1.10.0-next.1
|
|
81
|
+
|
|
82
|
+
## 1.10.0-next.0
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- Updated dependencies [8674da1]
|
|
87
|
+
- @copilotkit/react-core@1.10.0-next.0
|
|
88
|
+
- @copilotkit/shared@1.10.0-next.0
|
|
89
|
+
- @copilotkit/runtime-client-gql@1.10.0-next.0
|
|
90
|
+
|
|
91
|
+
## 1.9.3
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- Updated dependencies [f83bda0]
|
|
96
|
+
- Updated dependencies [1bda332]
|
|
97
|
+
- @copilotkit/react-core@1.9.3
|
|
98
|
+
- @copilotkit/shared@1.9.3
|
|
99
|
+
- @copilotkit/runtime-client-gql@1.9.3
|
|
100
|
+
|
|
101
|
+
## 1.9.3-next.4
|
|
102
|
+
|
|
103
|
+
### Patch Changes
|
|
104
|
+
|
|
105
|
+
- Updated dependencies [f83bda0]
|
|
106
|
+
- @copilotkit/react-core@1.9.3-next.4
|
|
107
|
+
- @copilotkit/runtime-client-gql@1.9.3-next.4
|
|
108
|
+
- @copilotkit/shared@1.9.3-next.4
|
|
109
|
+
|
|
110
|
+
## 1.9.3-next.3
|
|
111
|
+
|
|
112
|
+
### Patch Changes
|
|
113
|
+
|
|
114
|
+
- Updated dependencies [1bda332]
|
|
115
|
+
- @copilotkit/shared@1.9.3-next.3
|
|
116
|
+
- @copilotkit/runtime-client-gql@1.9.3-next.3
|
|
117
|
+
- @copilotkit/react-core@1.9.3-next.3
|
|
118
|
+
|
|
119
|
+
## 1.9.3-next.2
|
|
120
|
+
|
|
121
|
+
### Patch Changes
|
|
122
|
+
|
|
123
|
+
- @copilotkit/runtime-client-gql@1.9.3-next.2
|
|
124
|
+
- @copilotkit/react-core@1.9.3-next.2
|
|
125
|
+
- @copilotkit/shared@1.9.3-next.2
|
|
126
|
+
|
|
127
|
+
## 1.9.3-next.1
|
|
128
|
+
|
|
129
|
+
### Patch Changes
|
|
130
|
+
|
|
131
|
+
- @copilotkit/runtime-client-gql@1.9.3-next.1
|
|
132
|
+
- @copilotkit/react-core@1.9.3-next.1
|
|
133
|
+
- @copilotkit/shared@1.9.3-next.1
|
|
134
|
+
|
|
135
|
+
## 1.9.3-next.0
|
|
136
|
+
|
|
137
|
+
### Patch Changes
|
|
138
|
+
|
|
139
|
+
- @copilotkit/runtime-client-gql@1.9.3-next.0
|
|
140
|
+
- @copilotkit/react-core@1.9.3-next.0
|
|
141
|
+
- @copilotkit/shared@1.9.3-next.0
|
|
142
|
+
|
|
143
|
+
## 1.9.2
|
|
4
144
|
|
|
5
145
|
### Patch Changes
|
|
6
146
|
|
|
@@ -17,9 +157,41 @@
|
|
|
17
157
|
- Updated dependencies [10345a5]
|
|
18
158
|
- Updated dependencies [9169ad7]
|
|
19
159
|
- Updated dependencies [35537f1]
|
|
20
|
-
- @copilotkit/react-core@
|
|
21
|
-
- @copilotkit/shared@
|
|
22
|
-
- @copilotkit/runtime-client-gql@
|
|
160
|
+
- @copilotkit/react-core@1.9.2
|
|
161
|
+
- @copilotkit/shared@1.9.2
|
|
162
|
+
- @copilotkit/runtime-client-gql@1.9.2
|
|
163
|
+
|
|
164
|
+
## 1.9.2-next.26
|
|
165
|
+
|
|
166
|
+
### Patch Changes
|
|
167
|
+
|
|
168
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.26
|
|
169
|
+
- @copilotkit/react-core@1.9.2-next.26
|
|
170
|
+
- @copilotkit/shared@1.9.2-next.26
|
|
171
|
+
|
|
172
|
+
## 1.9.2-next.25
|
|
173
|
+
|
|
174
|
+
### Patch Changes
|
|
175
|
+
|
|
176
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.25
|
|
177
|
+
- @copilotkit/react-core@1.9.2-next.25
|
|
178
|
+
- @copilotkit/shared@1.9.2-next.25
|
|
179
|
+
|
|
180
|
+
## 1.9.2-next.24
|
|
181
|
+
|
|
182
|
+
### Patch Changes
|
|
183
|
+
|
|
184
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.24
|
|
185
|
+
- @copilotkit/react-core@1.9.2-next.24
|
|
186
|
+
- @copilotkit/shared@1.9.2-next.24
|
|
187
|
+
|
|
188
|
+
## 1.9.2-next.23
|
|
189
|
+
|
|
190
|
+
### Patch Changes
|
|
191
|
+
|
|
192
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.23
|
|
193
|
+
- @copilotkit/react-core@1.9.2-next.23
|
|
194
|
+
- @copilotkit/shared@1.9.2-next.23
|
|
23
195
|
|
|
24
196
|
## 1.9.2-next.22
|
|
25
197
|
|
package/README.md
CHANGED
|
@@ -1,46 +1,141 @@
|
|
|
1
|
-
|
|
2
|
-
<a href="https://copilotkit.ai" target="_blank">
|
|
3
|
-
<img src="https://github.com/copilotkit/copilotkit/raw/main/assets/banner.png" alt="CopilotKit Logo">
|
|
4
|
-
</a>
|
|
5
|
-
|
|
6
|
-
<br/>
|
|
7
|
-
|
|
8
|
-
<strong>
|
|
9
|
-
CopilotKit is the open-source framework for integrating powerful AI Copilots into any application. Easily implement custom AI Chatbots, AI Agents, AI Textareas, and more.
|
|
10
|
-
</strong>
|
|
11
|
-
</div>
|
|
1
|
+
# CopilotKit - React Textarea
|
|
12
2
|
|
|
13
|
-
<
|
|
3
|
+
<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />
|
|
14
4
|
|
|
15
|
-
<
|
|
5
|
+
<br>
|
|
6
|
+
<div align="center" style="display:flex;justify-content:center;gap:16px;height:20px;margin: 0;">
|
|
16
7
|
<a href="https://www.npmjs.com/package/@copilotkit/react-core" target="_blank">
|
|
17
|
-
<img src="https://img.shields.io/npm/v/%40copilotkit%2Freact-
|
|
8
|
+
<img src="https://img.shields.io/npm/v/%40copilotkit%2Freact-textarea?logo=npm&logoColor=%23FFFFFF&label=Version&color=%236963ff" alt="NPM">
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://github.com/copilotkit/copilotkit/blob/main/LICENSE" target="_blank">
|
|
11
|
+
<img src="https://img.shields.io/github/license/copilotkit/copilotkit?color=%236963ff&label=License" alt="MIT">
|
|
18
12
|
</a>
|
|
19
|
-
<img src="https://img.shields.io/github/license/copilotkit/copilotkit?color=%236963ff&label=License" alt="MIT">
|
|
20
13
|
<a href="https://discord.gg/6dffbvGU3D" target="_blank">
|
|
21
14
|
<img src="https://img.shields.io/discord/1122926057641742418?logo=discord&logoColor=%23FFFFFF&label=Discord&color=%236963ff" alt="Discord">
|
|
22
15
|
</a>
|
|
23
16
|
</div>
|
|
24
17
|
<br/>
|
|
25
|
-
|
|
26
18
|
<div align="center">
|
|
27
|
-
<a href="https://
|
|
28
|
-
<img src="https://
|
|
29
|
-
</a>
|
|
30
|
-
<a href="https://docs.copilotkit.ai?ref=github_readme" target="_blank">
|
|
31
|
-
<img src="https://github.com/copilotkit/copilotkit/raw/main/assets/btn_docs.png" alt="CopilotKit GitHub" height="40px">
|
|
32
|
-
</a>
|
|
33
|
-
<a href="https://cloud.copilotkit.ai?ref=github_readme" target="_blank">
|
|
34
|
-
<img src="https://github.com/copilotkit/copilotkit/raw/main/assets/btn_cloud.png" alt="CopilotKit GitHub" height="40px">
|
|
19
|
+
<a href="https://www.producthunt.com/posts/copilotkit" target="_blank">
|
|
20
|
+
<img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-badge.svg?post_id=428778&theme=light&period=daily">
|
|
35
21
|
</a>
|
|
36
22
|
</div>
|
|
37
23
|
|
|
38
|
-
|
|
24
|
+
## ✨ Why CopilotKit?
|
|
39
25
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
- Minutes to integrate - Get started quickly with our CLI
|
|
27
|
+
- Framework agnostic - Works with React, Next.js, AGUI and more
|
|
28
|
+
- Production-ready UI - Use customizable components or build with headless UI
|
|
29
|
+
- Built-in security - Prompt injection protection
|
|
30
|
+
- Open source - Full transparency and community-driven
|
|
31
|
+
|
|
32
|
+
<img src="https://github.com/user-attachments/assets/6cb425f8-ffcb-49d2-9bbb-87cab5995b78" alt="class-support-ecosystem" style="border-radius: 12px; border: 2px solid #d6d4fa;">
|
|
33
|
+
|
|
34
|
+
## 🧑💻 Real life use cases
|
|
35
|
+
|
|
36
|
+
<span>Deploy deeply-integrated AI assistants & agents that work alongside your users inside your applications.</span>
|
|
37
|
+
|
|
38
|
+
<img src="https://github.com/user-attachments/assets/3b810240-e9f8-43ae-acec-31a58095e223" alt="headless-ui" style="border-radius: 12px; border: 2px solid #d6d4fa;">
|
|
39
|
+
|
|
40
|
+
## 🖥️ Code Samples
|
|
41
|
+
|
|
42
|
+
<span>Drop in these building blocks and tailor them to your needs.</span>
|
|
43
|
+
|
|
44
|
+
<h3>Build with Headless APIs and Pre-Built Components</h3>
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
// Headless UI with full control
|
|
48
|
+
const { visibleMessages, appendMessage, setMessages, ... } = useCopilotChat();
|
|
49
|
+
|
|
50
|
+
// Pre-built components with deep customization options (CSS + pass custom sub-components)
|
|
51
|
+
<CopilotPopup
|
|
52
|
+
instructions={"You are assisting the user as best as you can. Answer in the best way possible given the data you have."}
|
|
53
|
+
labels={{ title: "Popup Assistant", initial: "Need any help?" }}
|
|
54
|
+
/>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
// Frontend actions + generative UI, with full streaming support
|
|
59
|
+
useCopilotAction({
|
|
60
|
+
name: "appendToSpreadsheet",
|
|
61
|
+
description: "Append rows to the current spreadsheet",
|
|
62
|
+
parameters: [
|
|
63
|
+
{ name: "rows", type: "object[]", attributes: [{ name: "cells", type: "object[]", attributes: [{ name: "value", type: "string" }] }] }
|
|
64
|
+
],
|
|
65
|
+
render: ({ status, args }) => <Spreadsheet data={canonicalSpreadsheetData(args.rows)} />,
|
|
66
|
+
handler: ({ rows }) => setSpreadsheet({ ...spreadsheet, rows: [...spreadsheet.rows, ...canonicalSpreadsheetData(rows)] }),
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
<h3>Integrate In-App CoAgents with LangGraph</h3>
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
// Share state between app and agent
|
|
74
|
+
const { agentState } = useCoAgent({
|
|
75
|
+
name: "basic_agent",
|
|
76
|
+
initialState: { input: "NYC" }
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// agentic generative UI
|
|
80
|
+
useCoAgentStateRender({
|
|
81
|
+
name: "basic_agent",
|
|
82
|
+
render: ({ state }) => <WeatherDisplay {...state.final_response} />,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Human in the Loop (Approval)
|
|
86
|
+
useCopilotAction({
|
|
87
|
+
name: "email_tool",
|
|
88
|
+
parameters: [
|
|
89
|
+
{
|
|
90
|
+
name: "email_draft",
|
|
91
|
+
type: "string",
|
|
92
|
+
description: "The email content",
|
|
93
|
+
required: true,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
renderAndWaitForResponse: ({ args, status, respond }) => {
|
|
97
|
+
return (
|
|
98
|
+
<EmailConfirmation
|
|
99
|
+
emailContent={args.email_draft || ""}
|
|
100
|
+
isExecuting={status === "executing"}
|
|
101
|
+
onCancel={() => respond?.({ approved: false })}
|
|
102
|
+
onSend={() =>
|
|
103
|
+
respond?.({
|
|
104
|
+
approved: true,
|
|
105
|
+
metadata: { sentAt: new Date().toISOString() },
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
/>
|
|
109
|
+
);
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
// intermediate agent state streaming (supports both LangGraph.js + LangGraph python)
|
|
116
|
+
const modifiedConfig = copilotKitCustomizeConfig(config, {
|
|
117
|
+
emitIntermediateState: [{
|
|
118
|
+
stateKey: "outline",
|
|
119
|
+
tool: "set_outline",
|
|
120
|
+
toolArgument: "outline"
|
|
121
|
+
}],
|
|
122
|
+
});
|
|
123
|
+
const response = await ChatOpenAI({ model: "gpt-4o" }).invoke(messages, modifiedConfig);
|
|
124
|
+
```
|
|
125
|
+
## 🏆 Featured Examples
|
|
126
|
+
|
|
127
|
+
<p align="center">
|
|
128
|
+
<a href="https://www.copilotkit.ai/examples/form-filling-copilot">
|
|
129
|
+
<img src="https://github.com/user-attachments/assets/874da84a-67ff-47fa-a6b4-cbc3c65eb704" width="300" style="border-radius: 16px;" />
|
|
130
|
+
</a>
|
|
131
|
+
<a href="https://www.copilotkit.ai/examples/state-machine-copilot">
|
|
132
|
+
<img src="https://github.com/user-attachments/assets/0b5e45b3-2704-4678-82dc-2f3e1c58e2dd" width="300" style="border-radius: 16px;" />
|
|
133
|
+
</a>
|
|
134
|
+
<a href="https://www.copilotkit.ai/examples/chat-with-your-data">
|
|
135
|
+
<img src="https://github.com/user-attachments/assets/0fed66be-a4c2-4093-8eab-75c0b27a62f6" width="300" style="border-radius: 16px;" />
|
|
136
|
+
</a>
|
|
137
|
+
</p>
|
|
43
138
|
|
|
44
|
-
|
|
139
|
+
## Documentation
|
|
45
140
|
|
|
46
141
|
To get started with CopilotKit, please check out the [documentation](https://docs.copilotkit.ai).
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defaultEditingApiConfig
|
|
3
|
-
} from "./chunk-EJGGLWWR.mjs";
|
|
4
1
|
import {
|
|
5
2
|
defaultInsertionsApiConfig
|
|
6
3
|
} from "./chunk-MCNXIA4Q.mjs";
|
|
7
4
|
import {
|
|
8
5
|
defaultSuggestionsApiConfig
|
|
9
6
|
} from "./chunk-QFXR6DOA.mjs";
|
|
7
|
+
import {
|
|
8
|
+
defaultEditingApiConfig
|
|
9
|
+
} from "./chunk-EJGGLWWR.mjs";
|
|
10
10
|
import {
|
|
11
11
|
defaultBaseAutosuggestionsConfig
|
|
12
12
|
} from "./chunk-F6RLSVG3.mjs";
|
|
@@ -29,4 +29,4 @@ var defaultAutosuggestionsConfig = __spreadProps(__spreadValues({}, defaultBaseA
|
|
|
29
29
|
export {
|
|
30
30
|
defaultAutosuggestionsConfig
|
|
31
31
|
};
|
|
32
|
-
//# sourceMappingURL=chunk-
|
|
32
|
+
//# sourceMappingURL=chunk-6SGWO63I.mjs.map
|
|
@@ -17,8 +17,8 @@ import {
|
|
|
17
17
|
replaceEditorText
|
|
18
18
|
} from "./chunk-5UNJXFUO.mjs";
|
|
19
19
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./chunk-
|
|
20
|
+
defaultBaseAutosuggestionsConfig
|
|
21
|
+
} from "./chunk-F6RLSVG3.mjs";
|
|
22
22
|
import {
|
|
23
23
|
HoveringToolbar
|
|
24
24
|
} from "./chunk-C3PMJNQA.mjs";
|
|
@@ -26,10 +26,6 @@ import {
|
|
|
26
26
|
HoveringEditorProvider,
|
|
27
27
|
useHoveringEditorContext
|
|
28
28
|
} from "./chunk-LYB4B6MK.mjs";
|
|
29
|
-
import {
|
|
30
|
-
getFullEditorTextWithNewlines,
|
|
31
|
-
getTextAroundCollapsedCursor
|
|
32
|
-
} from "./chunk-ECR45NSD.mjs";
|
|
33
29
|
import {
|
|
34
30
|
makeRenderElementFunction
|
|
35
31
|
} from "./chunk-7L6GIHDM.mjs";
|
|
@@ -40,8 +36,12 @@ import {
|
|
|
40
36
|
TrackerTextEditedSinceLastCursorMovement
|
|
41
37
|
} from "./chunk-LQ2OWQU7.mjs";
|
|
42
38
|
import {
|
|
43
|
-
|
|
44
|
-
} from "./chunk-
|
|
39
|
+
useAddBrandingCss
|
|
40
|
+
} from "./chunk-7LSRNPNI.mjs";
|
|
41
|
+
import {
|
|
42
|
+
getFullEditorTextWithNewlines,
|
|
43
|
+
getTextAroundCollapsedCursor
|
|
44
|
+
} from "./chunk-ECR45NSD.mjs";
|
|
45
45
|
import {
|
|
46
46
|
__objRest,
|
|
47
47
|
__spreadProps,
|
|
@@ -266,4 +266,4 @@ function makeSemiFakeReactTextAreaEvent(currentText) {
|
|
|
266
266
|
export {
|
|
267
267
|
BaseCopilotTextarea
|
|
268
268
|
};
|
|
269
|
-
//# sourceMappingURL=chunk-
|
|
269
|
+
//# sourceMappingURL=chunk-F44ZOUO7.mjs.map
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
useMakeStandardInsertionOrEditingFunction
|
|
6
6
|
} from "./chunk-RXV67GJN.mjs";
|
|
7
|
-
import {
|
|
8
|
-
BaseCopilotTextarea
|
|
9
|
-
} from "./chunk-YDHTZ3EW.mjs";
|
|
10
7
|
import {
|
|
11
8
|
defaultAutosuggestionsConfig
|
|
12
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6SGWO63I.mjs";
|
|
10
|
+
import {
|
|
11
|
+
BaseCopilotTextarea
|
|
12
|
+
} from "./chunk-F44ZOUO7.mjs";
|
|
13
13
|
import {
|
|
14
14
|
__objRest,
|
|
15
15
|
__spreadProps,
|
|
@@ -57,4 +57,4 @@ var CopilotTextarea = React.forwardRef(
|
|
|
57
57
|
export {
|
|
58
58
|
CopilotTextarea
|
|
59
59
|
};
|
|
60
|
-
//# sourceMappingURL=chunk-
|
|
60
|
+
//# sourceMappingURL=chunk-WQA62MUP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/copilot-textarea/copilot-textarea.tsx"],"sourcesContent":["/**\n * <br/>\n * <img src=\"https://cdn.copilotkit.ai/docs/copilotkit/images/CopilotTextarea.gif\" width=\"500\" />\n *\n * `<CopilotTextarea>` is a React component that acts as a drop-in replacement for the standard `<textarea>`,\n * offering enhanced autocomplete features powered by AI. It is context-aware, integrating seamlessly with the\n * [`useCopilotReadable`](/reference/hooks/useCopilotReadable) hook to provide intelligent suggestions based on the application context.\n *\n * In addition, it provides a hovering editor window (available by default via `Cmd + K` on Mac and `Ctrl + K` on Windows) that allows the user to\n * suggest changes to the text, for example providing a summary or rephrasing the text.\n *\n * ## Example\n *\n * ```tsx\n * import { CopilotTextarea } from '@copilotkit/react-textarea';\n * import \"@copilotkit/react-textarea/styles.css\";\n *\n * <CopilotTextarea\n * autosuggestionsConfig={{\n * textareaPurpose:\n * \"the body of an email message\",\n * chatApiConfigs: {},\n * }}\n * />\n * ```\n *\n * ## Usage\n *\n * ### Install Dependencies\n *\n * This component is part of the [@copilotkit/react-textarea](https://npmjs.com/package/@copilotkit/react-textarea) package.\n *\n * ```shell npm2yarn \\\"@copilotkit/react-textarea\"\\\n * npm install @copilotkit/react-core @copilotkit/react-textarea\n * ```\n *\n * ### Usage\n *\n * Use the CopilotTextarea component in your React application similarly to a standard `<textarea />`,\n * with additional configurations for AI-powered features.\n *\n * For example:\n *\n * ```tsx\n * import { useState } from \"react\";\n * import { CopilotTextarea } from \"@copilotkit/react-textarea\";\n * import \"@copilotkit/react-textarea/styles.css\";\n *\n * export function ExampleComponent() {\n * const [text, setText] = useState(\"\");\n *\n * return (\n * <CopilotTextarea\n * className=\"custom-textarea-class\"\n * value={text}\n * onValueChange={(value: string) => setText(value)}\n * placeholder=\"Enter your text here...\"\n * autosuggestionsConfig={{\n * textareaPurpose: \"Provide context or purpose of the textarea.\",\n * chatApiConfigs: {\n * suggestionsApiConfig: {\n * maxTokens: 20,\n * stop: [\".\", \"?\", \"!\"],\n * },\n * },\n * }}\n * />\n * );\n * }\n * ```\n *\n * ### Look & Feel\n *\n * By default, CopilotKit components do not have any styles. You can import CopilotKit's stylesheet at the root of your project:\n * ```tsx title=\"YourRootComponent.tsx\"\n * ...\n * import \"@copilotkit/react-textarea/styles.css\"; // [!code highlight]\n *\n * export function YourRootComponent() {\n * return (\n * <CopilotKit>\n * ...\n * </CopilotKit>\n * );\n * }\n * ```\n * For more information about how to customize the styles, check out the [Customize Look & Feel](/guides/custom-look-and-feel/customize-built-in-ui-components) guide.\n * */\nimport React from \"react\";\nimport { useMakeStandardAutosuggestionFunction } from \"../../hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function\";\nimport { HTMLCopilotTextAreaElement } from \"../../types\";\nimport { BaseCopilotTextareaProps } from \"../../types/base/base-copilot-textarea-props\";\nimport {\n AutosuggestionsConfig,\n defaultAutosuggestionsConfig,\n} from \"../../types/autosuggestions-config\";\nimport { BaseCopilotTextarea } from \"../base-copilot-textarea/base-copilot-textarea\";\nimport { useMakeStandardInsertionOrEditingFunction } from \"../../hooks/make-autosuggestions-function/use-make-standard-insertion-function\";\nimport merge from \"lodash.merge\";\nimport { AutosuggestionsConfigUserSpecified } from \"../../types/autosuggestions-config/autosuggestions-config-user-specified\";\n\n// Like the base copilot textarea props,\n// but with baseAutosuggestionsConfig replaced with autosuggestionsConfig.\nexport interface CopilotTextareaProps\n extends Omit<BaseCopilotTextareaProps, \"baseAutosuggestionsConfig\"> {\n /**\n * Configuration settings for the autosuggestions feature.\n * For full reference, [check the interface on GitHub](https://github.com/CopilotKit/CopilotKit/blob/main/CopilotKit/packages/react-textarea/src/types/base/base-copilot-textarea-props.tsx#L8).\n *\n * <PropertyReference name=\"textareaPurpose\" type=\"string\" required={true} >\n * The purpose of the text area in plain text.\n *\n * Example: *\"The body of the email response\"*\n * </PropertyReference>\n *\n * <PropertyReference name=\"chatApiConfigs\" type=\"ChatApiConfigs\" >\n * The chat API configurations.\n *\n * <strong>NOTE:</strong> You must provide specify at least one of `suggestionsApiConfig` or `insertionApiConfig`.\n *\n * <PropertyReference name=\"suggestionsApiConfig\" type=\"SuggestionsApiConfig\">\n * For full reference, please [click here](https://github.com/CopilotKit/CopilotKit/blob/main/CopilotKit/packages/react-textarea/src/types/autosuggestions-config/suggestions-api-config.tsx#L4).\n * </PropertyReference>\n * <PropertyReference name=\"insertionApiConfig\" type=\"InsertionApiConfig\">\n * For full reference, please [click here](https://github.com/CopilotKit/CopilotKit/blob/main/CopilotKit/packages/react-textarea/src/types/autosuggestions-config/insertions-api-config.tsx#L4).\n * </PropertyReference>\n * </PropertyReference>\n *\n * <PropertyReference name=\"disabled\" type=\"boolean\" >\n * Whether the textarea is disabled.\n * </PropertyReference>\n *\n * <PropertyReference name=\"disableBranding\" type=\"boolean\" >\n * Whether to disable the CopilotKit branding.\n * </PropertyReference>\n *\n * <PropertyReference name=\"placeholderStyle\" type=\"React.CSSProperties\" >\n * Specifies the CSS styles to apply to the placeholder text.\n * </PropertyReference>\n *\n * <PropertyReference name=\"suggestionsStyle\" type=\"React.CSSProperties\" >\n * Specifies the CSS styles to apply to the suggestions list.\n * </PropertyReference>\n *\n * <PropertyReference name=\"hoverMenuClassname\" type=\"string\" >\n * A class name to apply to the editor popover window.\n * </PropertyReference>\n *\n * <PropertyReference name=\"value\" type=\"string\" >\n * The initial value of the textarea. Can be controlled via `onValueChange`.\n * </PropertyReference>\n *\n * <PropertyReference name=\"onValueChange\" type=\"(value: string) => void\" >\n * Callback invoked when the value of the textarea changes.\n * </PropertyReference>\n *\n * <PropertyReference name=\"onChange\" type=\"(event: React.ChangeEvent<HTMLTextAreaElement>) => void\" >\n * Callback invoked when a `change` event is triggered on the textarea element.\n * </PropertyReference>\n *\n * <PropertyReference name=\"shortcut\" type=\"string\" >\n * The shortcut to use to open the editor popover window. Default is `\"Cmd-k\"`.\n * </PropertyReference>\n */\n autosuggestionsConfig: AutosuggestionsConfigUserSpecified;\n}\n\n/**\n * A copilot textarea that uses the standard autosuggestions function.\n */\nexport const CopilotTextarea = React.forwardRef(\n (props: CopilotTextareaProps, ref: React.Ref<HTMLCopilotTextAreaElement>) => {\n // separate the AutosuggestionsConfigUserSpecified from the rest of the props\n const { autosuggestionsConfig: autosuggestionsConfigUserSpecified, ...forwardedProps } = props;\n\n const autosuggestionsConfig: AutosuggestionsConfig = merge(\n defaultAutosuggestionsConfig,\n autosuggestionsConfigUserSpecified,\n );\n\n const autosuggestionsFunction = useMakeStandardAutosuggestionFunction(\n autosuggestionsConfig.textareaPurpose,\n autosuggestionsConfig.contextCategories,\n autosuggestionsConfig.chatApiConfigs.suggestionsApiConfig,\n );\n\n const insertionOrEditingFunction = useMakeStandardInsertionOrEditingFunction(\n autosuggestionsConfig.textareaPurpose,\n autosuggestionsConfig.contextCategories,\n autosuggestionsConfig.chatApiConfigs.insertionApiConfig,\n autosuggestionsConfig.chatApiConfigs.editingApiConfig,\n );\n\n return (\n <>\n <BaseCopilotTextarea\n ref={ref}\n {...forwardedProps}\n baseAutosuggestionsConfig={{\n ...autosuggestionsConfig,\n apiConfig: {\n insertionOrEditingFunction: insertionOrEditingFunction,\n autosuggestionsFunction: autosuggestionsFunction,\n },\n }}\n />\n </>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwFA,OAAO,WAAW;AAUlB,OAAO,WAAW;AAgGZ,mBACE,WADF;AAxBC,IAAM,kBAAkB,MAAM;AAAA,EACnC,CAAC,OAA6B,QAA+C;AAE3E,UAAyF,YAAjF,yBAAuB,mCA7KnC,IA6K6F,IAAnB,2BAAmB,IAAnB,CAA9D;AAER,UAAM,wBAA+C;AAAA,MACnD;AAAA,MACA;AAAA,IACF;AAEA,UAAM,0BAA0B;AAAA,MAC9B,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB,eAAe;AAAA,IACvC;AAEA,UAAM,6BAA6B;AAAA,MACjC,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB,eAAe;AAAA,MACrC,sBAAsB,eAAe;AAAA,IACvC;AAEA,WACE,gCACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,SACI,iBAFL;AAAA,QAGC,2BAA2B,iCACtB,wBADsB;AAAA,UAEzB,WAAW;AAAA,YACT;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA;AAAA,IACF,GACF;AAAA,EAEJ;AACF;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseCopilotTextarea
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-F44ZOUO7.mjs";
|
|
4
4
|
import "../../chunk-2C7O2EVM.mjs";
|
|
5
5
|
import "../../chunk-GQN2HYFJ.mjs";
|
|
6
6
|
import "../../chunk-23Q6A46J.mjs";
|
|
@@ -9,7 +9,8 @@ import "../../chunk-DRV2FOHZ.mjs";
|
|
|
9
9
|
import "../../chunk-4NHVQZ67.mjs";
|
|
10
10
|
import "../../chunk-QJNFNPWH.mjs";
|
|
11
11
|
import "../../chunk-5UNJXFUO.mjs";
|
|
12
|
-
import "../../chunk-
|
|
12
|
+
import "../../chunk-WJHSY5T6.mjs";
|
|
13
|
+
import "../../chunk-F6RLSVG3.mjs";
|
|
13
14
|
import "../../chunk-C3PMJNQA.mjs";
|
|
14
15
|
import "../../chunk-L7VVZH4Q.mjs";
|
|
15
16
|
import "../../chunk-2DF2AVDU.mjs";
|
|
@@ -23,16 +24,15 @@ import "../../chunk-WGWQRALG.mjs";
|
|
|
23
24
|
import "../../chunk-VSVQZUPW.mjs";
|
|
24
25
|
import "../../chunk-I72DKFHD.mjs";
|
|
25
26
|
import "../../chunk-4PDYALMP.mjs";
|
|
26
|
-
import "../../chunk-ECR45NSD.mjs";
|
|
27
27
|
import "../../chunk-2QDCE7PD.mjs";
|
|
28
28
|
import "../../chunk-YLFAIYRY.mjs";
|
|
29
29
|
import "../../chunk-7L6GIHDM.mjs";
|
|
30
30
|
import "../../chunk-XW3ICO4S.mjs";
|
|
31
31
|
import "../../chunk-LQ2OWQU7.mjs";
|
|
32
|
-
import "../../chunk-
|
|
33
|
-
import "../../chunk-F6RLSVG3.mjs";
|
|
32
|
+
import "../../chunk-7LSRNPNI.mjs";
|
|
34
33
|
import "../../chunk-DFTV4TST.mjs";
|
|
35
34
|
import "../../chunk-T6MTDQZ7.mjs";
|
|
35
|
+
import "../../chunk-ECR45NSD.mjs";
|
|
36
36
|
import "../../chunk-MRXNTQOX.mjs";
|
|
37
37
|
export {
|
|
38
38
|
BaseCopilotTextarea
|
|
@@ -14,7 +14,7 @@ import '../../types/autosuggestions-config/editing-api-config.js';
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* <br/>
|
|
17
|
-
* <img src="/images/CopilotTextarea.gif" width="500" />
|
|
17
|
+
* <img src="https://cdn.copilotkit.ai/docs/copilotkit/images/CopilotTextarea.gif" width="500" />
|
|
18
18
|
*
|
|
19
19
|
* `<CopilotTextarea>` is a React component that acts as a drop-in replacement for the standard `<textarea>`,
|
|
20
20
|
* offering enhanced autocomplete features powered by AI. It is context-aware, integrating seamlessly with the
|