@copilotkit/react-textarea 0.37.0 → 0.38.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +216 -224
- package/CHANGELOG.md +13 -0
- package/dist/chunk-3SVQJA5A.mjs +169 -0
- package/dist/chunk-3SVQJA5A.mjs.map +1 -0
- package/dist/chunk-5KLAWLCD.mjs +88 -0
- package/dist/chunk-5KLAWLCD.mjs.map +1 -0
- package/dist/{chunk-QKS2IOUH.mjs → chunk-7QFH4E7C.mjs} +7 -5
- package/dist/chunk-7QFH4E7C.mjs.map +1 -0
- package/dist/chunk-CVO5T3PA.mjs +82 -0
- package/dist/chunk-CVO5T3PA.mjs.map +1 -0
- package/dist/{chunk-DKE57EAC.mjs → chunk-H3PGQHLG.mjs} +5 -5
- package/dist/{chunk-RKQ6RTZM.mjs → chunk-I6DJQ7D7.mjs} +33 -38
- package/dist/chunk-I6DJQ7D7.mjs.map +1 -0
- package/dist/{chunk-VAJHETSN.mjs → chunk-IF7CDWEH.mjs} +5 -5
- package/dist/{chunk-VAJHETSN.mjs.map → chunk-IF7CDWEH.mjs.map} +1 -1
- package/dist/{chunk-LCDTIJSD.mjs → chunk-OJXLHIYQ.mjs} +4 -2
- package/dist/chunk-OJXLHIYQ.mjs.map +1 -0
- package/dist/{chunk-ZRKQLLC7.mjs → chunk-R77MK6QS.mjs} +10 -5
- package/dist/{chunk-ZRKQLLC7.mjs.map → chunk-R77MK6QS.mjs.map} +1 -1
- package/dist/{chunk-O4LDWYJB.mjs → chunk-TNGDQV3I.mjs} +1 -2
- package/dist/{chunk-O4LDWYJB.mjs.map → chunk-TNGDQV3I.mjs.map} +1 -1
- package/dist/{chunk-KDVMG3XF.mjs → chunk-WMHVBGPR.mjs} +23 -25
- package/dist/chunk-WMHVBGPR.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js +15 -7
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +4 -4
- package/dist/components/copilot-textarea/copilot-textarea.d.ts +2 -2
- package/dist/components/copilot-textarea/copilot-textarea.js +255 -207
- package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +11 -11
- package/dist/components/hovering-toolbar/hovering-toolbar.js +0 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +251 -203
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +11 -11
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.ts +2 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js +6 -4
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +39 -31
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.d.ts +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js +100 -60
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +251 -203
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -11
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.ts +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.js +96 -108
- package/dist/types/autosuggestions-config/autosuggestions-config.js.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +5 -5
- package/dist/types/autosuggestions-config/editing-api-config.d.ts +3 -3
- package/dist/types/autosuggestions-config/editing-api-config.js +39 -46
- package/dist/types/autosuggestions-config/editing-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.mjs +1 -1
- package/dist/types/autosuggestions-config/index.d.ts +1 -1
- package/dist/types/autosuggestions-config/index.js +96 -108
- package/dist/types/autosuggestions-config/index.js.map +1 -1
- package/dist/types/autosuggestions-config/index.mjs +5 -5
- package/dist/types/autosuggestions-config/insertions-api-config.d.ts +3 -3
- package/dist/types/autosuggestions-config/insertions-api-config.js +32 -37
- package/dist/types/autosuggestions-config/insertions-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.mjs +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.d.ts +3 -3
- package/dist/types/autosuggestions-config/suggestions-api-config.js +22 -24
- package/dist/types/autosuggestions-config/suggestions-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs +1 -1
- package/dist/types/base/base-autosuggestions-config.d.ts +14 -0
- package/dist/types/base/base-autosuggestions-config.js +3 -1
- package/dist/types/base/base-autosuggestions-config.js.map +1 -1
- package/dist/types/base/base-autosuggestions-config.mjs +1 -1
- package/dist/types/base/index.js +3 -1
- package/dist/types/base/index.js.map +1 -1
- package/dist/types/base/index.mjs +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +96 -108
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +5 -5
- package/package.json +7 -6
- package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +5 -0
- package/src/components/copilot-textarea/copilot-textarea.tsx +1 -1
- package/src/components/hovering-toolbar/hovering-toolbar.tsx +0 -1
- package/src/hooks/base-copilot-textarea-implementation/use-autosuggestions.ts +11 -4
- package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +51 -31
- package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +116 -62
- package/src/types/autosuggestions-config/editing-api-config.tsx +48 -49
- package/src/types/autosuggestions-config/index.ts +0 -1
- package/src/types/autosuggestions-config/insertions-api-config.tsx +38 -40
- package/src/types/autosuggestions-config/suggestions-api-config.tsx +26 -27
- package/src/types/base/base-autosuggestions-config.tsx +17 -0
- package/dist/chunk-4OJ3H65F.mjs +0 -89
- package/dist/chunk-4OJ3H65F.mjs.map +0 -1
- package/dist/chunk-HE4GMS2P.mjs +0 -121
- package/dist/chunk-HE4GMS2P.mjs.map +0 -1
- package/dist/chunk-KDVMG3XF.mjs.map +0 -1
- package/dist/chunk-LCDTIJSD.mjs.map +0 -1
- package/dist/chunk-QKS2IOUH.mjs.map +0 -1
- package/dist/chunk-RKQ6RTZM.mjs.map +0 -1
- package/dist/chunk-SJ2TM5GA.mjs +0 -72
- package/dist/chunk-SJ2TM5GA.mjs.map +0 -1
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.d.ts +0 -7
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js +0 -19
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js.map +0 -1
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs +0 -1
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs.map +0 -1
- package/src/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.tsx +0 -5
- /package/dist/{chunk-DKE57EAC.mjs.map → chunk-H3PGQHLG.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -4,22 +4,22 @@ import "./chunk-WADHCMPK.mjs";
|
|
|
4
4
|
import "./chunk-MMVDU6DF.mjs";
|
|
5
5
|
import {
|
|
6
6
|
CopilotTextarea
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-IF7CDWEH.mjs";
|
|
8
|
+
import "./chunk-3SVQJA5A.mjs";
|
|
9
|
+
import "./chunk-5KLAWLCD.mjs";
|
|
10
10
|
import "./chunk-RUV6NBIF.mjs";
|
|
11
11
|
import {
|
|
12
12
|
defaultAutosuggestionsConfig
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-H3PGQHLG.mjs";
|
|
14
|
+
import "./chunk-CVO5T3PA.mjs";
|
|
15
|
+
import "./chunk-I6DJQ7D7.mjs";
|
|
16
|
+
import "./chunk-WMHVBGPR.mjs";
|
|
17
17
|
import {
|
|
18
18
|
BaseCopilotTextarea
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-R77MK6QS.mjs";
|
|
20
20
|
import "./chunk-2C7O2EVM.mjs";
|
|
21
21
|
import "./chunk-GQN2HYFJ.mjs";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-7QFH4E7C.mjs";
|
|
23
23
|
import "./chunk-JJLQVT7S.mjs";
|
|
24
24
|
import "./chunk-DRV2FOHZ.mjs";
|
|
25
25
|
import "./chunk-4NHVQZ67.mjs";
|
|
@@ -27,7 +27,7 @@ import "./chunk-FMQG2ZM3.mjs";
|
|
|
27
27
|
import "./chunk-5UNJXFUO.mjs";
|
|
28
28
|
import "./chunk-LQ2OWQU7.mjs";
|
|
29
29
|
import "./chunk-7LSRNPNI.mjs";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-TNGDQV3I.mjs";
|
|
31
31
|
import "./chunk-L7VVZH4Q.mjs";
|
|
32
32
|
import "./chunk-COQISBP2.mjs";
|
|
33
33
|
import "./chunk-OGLVRSCO.mjs";
|
|
@@ -45,7 +45,7 @@ import "./chunk-7SUZ6CXM.mjs";
|
|
|
45
45
|
import "./chunk-WJHSY5T6.mjs";
|
|
46
46
|
import {
|
|
47
47
|
defaultBaseAutosuggestionsConfig
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-OJXLHIYQ.mjs";
|
|
49
49
|
import "./chunk-224UKA7C.mjs";
|
|
50
50
|
import "./chunk-XW3ICO4S.mjs";
|
|
51
51
|
import "./chunk-IU3WTXLQ.mjs";
|
|
@@ -5,8 +5,8 @@ import '../base/base-autosuggestions-config.js';
|
|
|
5
5
|
import '../base/autosuggestions-bare-function.js';
|
|
6
6
|
import '@copilotkit/react-core';
|
|
7
7
|
import './editing-api-config.js';
|
|
8
|
+
import '@copilotkit/runtime-client-gql';
|
|
8
9
|
import './subtypes/make-system-prompt.js';
|
|
9
|
-
import './subtypes/minimal-chat-gpt-message.js';
|
|
10
10
|
|
|
11
11
|
interface SuggestionsApiConfigUserSpecified extends Partial<SuggestionsApiConfig> {
|
|
12
12
|
}
|
|
@@ -4,7 +4,7 @@ import { InsertionsApiConfig } from './insertions-api-config.js';
|
|
|
4
4
|
import { EditingApiConfig } from './editing-api-config.js';
|
|
5
5
|
import '../base/autosuggestions-bare-function.js';
|
|
6
6
|
import '@copilotkit/react-core';
|
|
7
|
-
import '
|
|
7
|
+
import '@copilotkit/runtime-client-gql';
|
|
8
8
|
import './subtypes/make-system-prompt.js';
|
|
9
9
|
|
|
10
10
|
interface AutosuggestionsConfig extends Omit<BaseAutosuggestionsConfig, "apiConfig"> {
|
|
@@ -55,6 +55,7 @@ var defaultShouldAcceptAutosuggestionOnKeyPress = (event) => {
|
|
|
55
55
|
}
|
|
56
56
|
return false;
|
|
57
57
|
};
|
|
58
|
+
var defaultShouldAcceptAutosuggestionOnTouch = () => true;
|
|
58
59
|
var defaultBaseAutosuggestionsConfig = {
|
|
59
60
|
debounceTime: 250,
|
|
60
61
|
contextCategories: import_react_core.defaultCopilotContextCategories,
|
|
@@ -62,10 +63,12 @@ var defaultBaseAutosuggestionsConfig = {
|
|
|
62
63
|
disabled: false,
|
|
63
64
|
temporarilyDisableWhenMovingCursorWithoutChangingText: true,
|
|
64
65
|
shouldToggleHoveringEditorOnKeyPress: defaultShouldToggleHoveringEditorOnKeyPress,
|
|
65
|
-
shouldAcceptAutosuggestionOnKeyPress: defaultShouldAcceptAutosuggestionOnKeyPress
|
|
66
|
+
shouldAcceptAutosuggestionOnKeyPress: defaultShouldAcceptAutosuggestionOnKeyPress,
|
|
67
|
+
shouldAcceptAutosuggestionOnTouch: defaultShouldAcceptAutosuggestionOnTouch
|
|
66
68
|
};
|
|
67
69
|
|
|
68
70
|
// src/types/autosuggestions-config/suggestions-api-config.tsx
|
|
71
|
+
var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
69
72
|
var defaultSuggestionsMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
70
73
|
return `You are a versatile writing assistant.
|
|
71
74
|
|
|
@@ -91,33 +94,30 @@ ${contextString}
|
|
|
91
94
|
`;
|
|
92
95
|
};
|
|
93
96
|
var defaultSuggestionsFewShotMessages = [
|
|
94
|
-
{
|
|
95
|
-
role:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
role: "user",
|
|
97
|
+
new import_runtime_client_gql.TextMessage({
|
|
98
|
+
role: import_runtime_client_gql.Role.User,
|
|
99
|
+
content: "<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>"
|
|
100
|
+
}),
|
|
101
|
+
new import_runtime_client_gql.TextMessage({
|
|
102
|
+
role: import_runtime_client_gql.Role.User,
|
|
101
103
|
content: "This morning I woke up and went straight to the grocery store."
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
role:
|
|
104
|
+
}),
|
|
105
|
+
new import_runtime_client_gql.TextMessage({
|
|
106
|
+
role: import_runtime_client_gql.Role.Assistant,
|
|
105
107
|
content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
role:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
{
|
|
118
|
-
role: "assistant",
|
|
108
|
+
}),
|
|
109
|
+
new import_runtime_client_gql.TextMessage({
|
|
110
|
+
role: import_runtime_client_gql.Role.User,
|
|
111
|
+
content: "<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>"
|
|
112
|
+
}),
|
|
113
|
+
new import_runtime_client_gql.TextMessage({
|
|
114
|
+
role: import_runtime_client_gql.Role.User,
|
|
115
|
+
content: `<TextBeforeCursor>The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;</TextBeforeCursor>`
|
|
116
|
+
}),
|
|
117
|
+
new import_runtime_client_gql.TextMessage({
|
|
118
|
+
role: import_runtime_client_gql.Role.Assistant,
|
|
119
119
|
content: ` (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder's "Pro Rata Share"; `
|
|
120
|
-
}
|
|
120
|
+
})
|
|
121
121
|
];
|
|
122
122
|
var defaultSuggestionsApiConfig = {
|
|
123
123
|
makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,
|
|
@@ -126,6 +126,7 @@ var defaultSuggestionsApiConfig = {
|
|
|
126
126
|
};
|
|
127
127
|
|
|
128
128
|
// src/types/autosuggestions-config/insertions-api-config.tsx
|
|
129
|
+
var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
129
130
|
var defaultInsertionsMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
130
131
|
return `You are a versatile writing assistant helping the user insert new text into their existing work.
|
|
131
132
|
|
|
@@ -154,44 +155,38 @@ The conversation will be structured as follows:
|
|
|
154
155
|
`;
|
|
155
156
|
};
|
|
156
157
|
var defaultInsertionsFewShotMessages = [
|
|
157
|
-
{
|
|
158
|
-
role:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
content:
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
role:
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
role: "user",
|
|
188
|
-
name: "InsertionPrompt",
|
|
189
|
-
content: "add section about the optionholder's pro rata share"
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
role: "assistant",
|
|
158
|
+
new import_runtime_client_gql2.TextMessage({
|
|
159
|
+
role: import_runtime_client_gql2.Role.User,
|
|
160
|
+
content: "<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>"
|
|
161
|
+
}),
|
|
162
|
+
new import_runtime_client_gql2.TextMessage({
|
|
163
|
+
role: import_runtime_client_gql2.Role.User,
|
|
164
|
+
content: "<TextBeforeCursor>This morning I woke up and went straight to the grocery store.</TextBeforeCursor>"
|
|
165
|
+
}),
|
|
166
|
+
new import_runtime_client_gql2.TextMessage({
|
|
167
|
+
role: import_runtime_client_gql2.Role.User,
|
|
168
|
+
content: "<InsertionPrompt>I bought a big watermelon</InsertionPrompt>"
|
|
169
|
+
}),
|
|
170
|
+
new import_runtime_client_gql2.TextMessage({
|
|
171
|
+
role: import_runtime_client_gql2.Role.Assistant,
|
|
172
|
+
content: "When I arrived I went straight to the produce section and picked out a big watermelon."
|
|
173
|
+
}),
|
|
174
|
+
new import_runtime_client_gql2.TextMessage({
|
|
175
|
+
role: import_runtime_client_gql2.Role.User,
|
|
176
|
+
content: "<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>"
|
|
177
|
+
}),
|
|
178
|
+
new import_runtime_client_gql2.TextMessage({
|
|
179
|
+
role: import_runtime_client_gql2.Role.User,
|
|
180
|
+
content: `<TextBeforeCursor>The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;</TextBeforeCursor>`
|
|
181
|
+
}),
|
|
182
|
+
new import_runtime_client_gql2.TextMessage({
|
|
183
|
+
role: import_runtime_client_gql2.Role.User,
|
|
184
|
+
content: "<InsertionPrompt>add section about the optionholder's pro rata share</InsertionPrompt>"
|
|
185
|
+
}),
|
|
186
|
+
new import_runtime_client_gql2.TextMessage({
|
|
187
|
+
role: import_runtime_client_gql2.Role.Assistant,
|
|
193
188
|
content: ` (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder's "Pro Rata Share"; `
|
|
194
|
-
}
|
|
189
|
+
})
|
|
195
190
|
];
|
|
196
191
|
var defaultInsertionsApiConfig = {
|
|
197
192
|
makeSystemPrompt: defaultInsertionsMakeSystemPrompt,
|
|
@@ -200,6 +195,7 @@ var defaultInsertionsApiConfig = {
|
|
|
200
195
|
};
|
|
201
196
|
|
|
202
197
|
// src/types/autosuggestions-config/editing-api-config.tsx
|
|
198
|
+
var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
|
|
203
199
|
var defaultEditingMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
204
200
|
return `You are a versatile writing assistant helping the user edit a portion of their text.
|
|
205
201
|
|
|
@@ -227,54 +223,46 @@ The conversation will be structured as follows:
|
|
|
227
223
|
`;
|
|
228
224
|
};
|
|
229
225
|
var defaultEditingFewShotMessages = [
|
|
230
|
-
{
|
|
231
|
-
role:
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
content: "I also bought a big watermelon"
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
role: "assistant",
|
|
226
|
+
new import_runtime_client_gql3.TextMessage({
|
|
227
|
+
role: import_runtime_client_gql3.Role.User,
|
|
228
|
+
content: "<TextBeforeCursor>This morning I woke up and went straight to the grocery store. </TextBeforeCursor>"
|
|
229
|
+
}),
|
|
230
|
+
new import_runtime_client_gql3.TextMessage({
|
|
231
|
+
role: import_runtime_client_gql3.Role.User,
|
|
232
|
+
content: "<TextToEdit>While I was there I picked up some apples, oranges, and bananas. </TextToEdit>"
|
|
233
|
+
}),
|
|
234
|
+
new import_runtime_client_gql3.TextMessage({
|
|
235
|
+
role: import_runtime_client_gql3.Role.User,
|
|
236
|
+
content: "<TextAfterCursor>The grocery store was having a sale on fruit, so I decided to stock up.</TextAfterCursor>"
|
|
237
|
+
}),
|
|
238
|
+
new import_runtime_client_gql3.TextMessage({
|
|
239
|
+
role: import_runtime_client_gql3.Role.User,
|
|
240
|
+
content: "<EditingPrompt>I also bought a big watermelon</EditingPrompt>"
|
|
241
|
+
}),
|
|
242
|
+
new import_runtime_client_gql3.TextMessage({
|
|
243
|
+
role: import_runtime_client_gql3.Role.Assistant,
|
|
252
244
|
content: "While I was there I picked up some apples, oranges, and bananas, and a big watermelon."
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
role:
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
content: "emphasize the complexity and my enthusiasm for the project"
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
role: "assistant",
|
|
245
|
+
}),
|
|
246
|
+
new import_runtime_client_gql3.TextMessage({
|
|
247
|
+
role: import_runtime_client_gql3.Role.User,
|
|
248
|
+
content: "<TextBeforeCursor>Yesterday, I spent the afternoon working on my new project.</TextBeforeCursor>"
|
|
249
|
+
}),
|
|
250
|
+
new import_runtime_client_gql3.TextMessage({
|
|
251
|
+
role: import_runtime_client_gql3.Role.User,
|
|
252
|
+
content: "<TextToEdit>It's quite challenging and requires a lot of focus.</TextToEdit>"
|
|
253
|
+
}),
|
|
254
|
+
new import_runtime_client_gql3.TextMessage({
|
|
255
|
+
role: import_runtime_client_gql3.Role.User,
|
|
256
|
+
content: "<TextAfterCursor>I'm really excited about the potential outcomes of this project.</TextAfterCursor>"
|
|
257
|
+
}),
|
|
258
|
+
new import_runtime_client_gql3.TextMessage({
|
|
259
|
+
role: import_runtime_client_gql3.Role.User,
|
|
260
|
+
content: "<EditingPrompt>emphasize the complexity and my enthusiasm for the project</EditingPrompt>"
|
|
261
|
+
}),
|
|
262
|
+
new import_runtime_client_gql3.TextMessage({
|
|
263
|
+
role: import_runtime_client_gql3.Role.Assistant,
|
|
276
264
|
content: "It's a highly complex task that demands intense concentration, but I'm incredibly enthusiastic about the promising prospects of this project."
|
|
277
|
-
}
|
|
265
|
+
})
|
|
278
266
|
];
|
|
279
267
|
var defaultEditingApiConfig = {
|
|
280
268
|
makeSystemPrompt: defaultEditingMakeSystemPrompt,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/types/autosuggestions-config/autosuggestions-config.tsx","../../../src/types/base/base-autosuggestions-config.tsx","../../../src/types/autosuggestions-config/suggestions-api-config.tsx","../../../src/types/autosuggestions-config/insertions-api-config.tsx","../../../src/types/autosuggestions-config/editing-api-config.tsx"],"sourcesContent":["import { BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig } from \"../base\";\nimport { SuggestionsApiConfig, defaultSuggestionsApiConfig } from \"./suggestions-api-config\";\nimport { InsertionsApiConfig, defaultInsertionsApiConfig } from \"./insertions-api-config\";\nimport { EditingApiConfig, defaultEditingApiConfig } from \"./editing-api-config\";\nimport { defaultCopilotContextCategories } from \"@copilotkit/react-core\";\n\n// Like the base autosuggestions config, with 2 additional fields:\n// 1. contextCategories: string[] | undefined;\n// 2. instead of apiConfigs, we have chatApiConfigs: a higher-level abstraction that uses a ChatGPT-like API endpoint.\nexport interface AutosuggestionsConfig extends Omit<BaseAutosuggestionsConfig, \"apiConfig\"> {\n contextCategories: string[];\n chatApiConfigs: {\n suggestionsApiConfig: SuggestionsApiConfig;\n insertionApiConfig: InsertionsApiConfig;\n editingApiConfig: EditingApiConfig;\n };\n}\n\nexport const defaultAutosuggestionsConfig: Omit<\n AutosuggestionsConfig,\n \"textareaPurpose\" | \"apiEndpoint\"\n> = {\n ...defaultBaseAutosuggestionsConfig,\n contextCategories: defaultCopilotContextCategories,\n chatApiConfigs: {\n suggestionsApiConfig: defaultSuggestionsApiConfig,\n insertionApiConfig: defaultInsertionsApiConfig,\n editingApiConfig: defaultEditingApiConfig,\n },\n};\n","import { BaseCopilotTextareaApiConfig } from \"./autosuggestions-bare-function\";\nimport { defaultCopilotContextCategories } from \"@copilotkit/react-core\";\n\n/**\n * @interface BaseAutosuggestionsConfig\n *\n * @property {string} textareaPurpose - The purpose of the textarea. This is used to guide the autosuggestions.\n *\n * @property {string[]} contextCategories - The categories of context to consider when providing autosuggestions.\n *\n * @property {number} debounceTime - The amount of time (in milliseconds) to wait before triggering autosuggestions after the user has stopped typing.\n *\n * @property {BaseCopilotTextareaApiConfig} apiConfig - The configuration for the API that provides the autosuggestions.\n *\n * @property {boolean} disableWhenEmpty - Whether to disable autosuggestions when the textarea is empty.\n *\n * @property {boolean} disabled - Whether to disable autosuggestions entirely.\n *\n * @property {boolean} temporarilyDisableWhenMovingCursorWithoutChangingText - Whether to temporarily disable autosuggestions when the user moves the cursor without changing the text.\n *\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnKeyPress - A function that determines whether to accept the current autosuggestion based on a key press event. By default, the Tab key is used to accept the autosuggestion. Example code:\n *\n * ```typescript\n * const defaultShouldAcceptAutosuggestionOnKeyPress = (event: React.KeyboardEvent<HTMLDivElement>) => {\n * // if tab, accept the autosuggestion\n * if (event.key === \"Tab\") {\n * return true;\n * }\n * return false;\n * }\n * ```\n *\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldToggleHoveringEditorOnKeyPress - A function that determines whether to toggle the hovering editor based on a key press event. By default, the Command + K key combination is used to toggle the hovering editor. Example code:\n *\n * ```typescript\n * const defaultShouldToggleHoveringEditorOnKeyPress = (event: React.KeyboardEvent<HTMLDivElement>) => {\n * // if command-k, toggle the hovering editor\n * if (event.key === \"k\" && event.metaKey) {\n * return true;\n * }\n * return false;\n * }\n * ```\n */\nexport interface BaseAutosuggestionsConfig {\n textareaPurpose: string;\n contextCategories: string[];\n debounceTime: number;\n apiConfig: BaseCopilotTextareaApiConfig;\n\n disableWhenEmpty: boolean;\n disabled: boolean;\n temporarilyDisableWhenMovingCursorWithoutChangingText: boolean;\n shouldAcceptAutosuggestionOnKeyPress: (event: React.KeyboardEvent<HTMLDivElement>) => boolean;\n shouldToggleHoveringEditorOnKeyPress: (\n event: React.KeyboardEvent<HTMLDivElement>,\n shortcut: string,\n ) => boolean;\n}\n\n// by default, command-k toggles the hovering editor\nconst defaultShouldToggleHoveringEditorOnKeyPress = (\n event: React.KeyboardEvent<HTMLDivElement>,\n shortcut: string,\n) => {\n // if command-k, toggle the hovering editor\n if (event.key === shortcut && event.metaKey) {\n return true;\n }\n return false;\n};\n\nconst defaultShouldAcceptAutosuggestionOnKeyPress = (\n event: React.KeyboardEvent<HTMLDivElement>,\n) => {\n // if tab, accept the autosuggestion\n if (event.key === \"Tab\") {\n return true;\n }\n return false;\n};\n\n/**\n * Default configuration for the BaseAutosuggestions.\n *\n * @property {number} debounceTime - The amount of time to wait before triggering the autosuggestions API call.\n * @property {string[]} contextCategories - The categories to use for context when making the autosuggestions API call.\n * @property {boolean} disableWhenEmpty - Whether to disable the autosuggestions when the textarea is empty.\n * @property {boolean} disabled - Whether to disable the autosuggestions feature entirely.\n * @property {boolean} temporarilyDisableWhenMovingCursorWithoutChangingText - Whether to temporarily disable the autosuggestions when the cursor is moved without changing the text.\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldToggleHoveringEditorOnKeyPress - A function that determines whether to toggle the hovering editor based on a key press event.\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnKeyPress - A function that determines whether to accept the autosuggestion based on a key press event.\n */\n\nexport const defaultBaseAutosuggestionsConfig: Omit<\n BaseAutosuggestionsConfig,\n \"textareaPurpose\" | \"apiConfig\"\n> = {\n debounceTime: 250,\n contextCategories: defaultCopilotContextCategories,\n disableWhenEmpty: true,\n disabled: false,\n temporarilyDisableWhenMovingCursorWithoutChangingText: true,\n shouldToggleHoveringEditorOnKeyPress: defaultShouldToggleHoveringEditorOnKeyPress,\n shouldAcceptAutosuggestionOnKeyPress: defaultShouldAcceptAutosuggestionOnKeyPress,\n};\n","import { MinimalChatGPTMessage } from \"./subtypes/minimal-chat-gpt-message\";\nimport { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\n\nexport interface SuggestionsApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: MinimalChatGPTMessage[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultSuggestionsMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString,\n) => {\n return `You are a versatile writing assistant.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nYour job is to guess what the user will write next AS BEST YOU CAN.\nOnly guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.\n\nAdjust yourself to the user's style and implied intent.\n\nThe user will provide both the text before and after the cursor. You should use this to infer what the user is likely to write next.\n<TextAfterCursor>\n<TextBeforeCursor>\n<YourSuggestion>\n\nIf we need to add a whitespace character to the suggested text, make sure to explicitly add it in.\n\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n`;\n};\n\nexport const defaultSuggestionsFewShotMessages: MinimalChatGPTMessage[] = [\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: \"While I was there I also picked up some apples, oranges, and bananas.\",\n },\n {\n role: \"user\",\n content: \"This morning I woke up and went straight to the grocery store.\",\n },\n {\n role: \"assistant\",\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content:\n 'The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;',\n },\n {\n role: \"assistant\",\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n },\n];\n\nexport const defaultSuggestionsApiConfig: SuggestionsApiConfig = {\n makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,\n fewShotMessages: defaultSuggestionsFewShotMessages,\n forwardedParams: undefined,\n};\n","import { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\nimport { MinimalChatGPTMessage } from \"./subtypes/minimal-chat-gpt-message\";\n\nexport interface InsertionsApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: MinimalChatGPTMessage[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultInsertionsMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString,\n) => {\n return `You are a versatile writing assistant helping the user insert new text into their existing work.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe following external context is also provided. Use it to inform your suggestions when relevant!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user will provide you with a prompt for an INSERTION into the text they are writing. \nYour job is to come up with an INSERTION into the text that the user would like to use, AS BEST YOU CAN.\nOnly insert a SHORT segment. Usually 1 sentence, or at most 1 paragraph.\n\nAdjust yourself to the user's style and implied intent.\n\n\nThe user will provide the text before and after the cursor, as well as the INSERTION prompt. You should use this to infer the best relevant insertion.\nThe conversation will be structured as follows:\n<TextAfterCursor>\n<TextBeforeCursor>\n<InsertionPrompt>\n\n<YourInsertionSuggestion>\n`;\n};\n\nexport const defaultInsertionsFewShotMessages: MinimalChatGPTMessage[] = [\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: \"While I was there I also picked up some apples, oranges, and bananas.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: \"This morning I woke up and went straight to the grocery store.\",\n },\n {\n role: \"user\",\n name: \"InsertionPrompt\",\n content: \"I bought a big watermelon\",\n },\n {\n role: \"assistant\",\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content:\n 'The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;',\n },\n {\n role: \"user\",\n name: \"InsertionPrompt\",\n content: \"add section about the optionholder's pro rata share\",\n },\n {\n role: \"assistant\",\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n },\n];\n\nexport const defaultInsertionsApiConfig: InsertionsApiConfig = {\n makeSystemPrompt: defaultInsertionsMakeSystemPrompt,\n fewShotMessages: defaultInsertionsFewShotMessages,\n forwardedParams: undefined,\n};\n","import { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\nimport { MinimalChatGPTMessage } from \"./subtypes/minimal-chat-gpt-message\";\n\nexport interface EditingApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: MinimalChatGPTMessage[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultEditingMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString,\n) => {\n return `You are a versatile writing assistant helping the user edit a portion of their text.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe following external context is also provided. Use it when relevant.\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user has provided you with a PROMPT for EDITING a PORTION of the text. \nYour job is to come up with a new EDITED version OF THE SEGMENT IN QUESTION - AS BEST YOU CAN.\nOnly rewrite the portion of the text that the user has marked as \"TextToEdit\"!!!\n\nAdjust yourself to the user's style and implied intent.\n\nThe conversation will be structured as follows:\n<TextBeforeCursor>\n<TextToEdit>\n<TextAfterCursor>\n<EditingPrompt>\n\n<YourEditSuggestion>\n`;\n};\n\nexport const defaultEditingFewShotMessages: MinimalChatGPTMessage[] = [\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: \"This morning I woke up and went straight to the grocery store. \",\n },\n {\n role: \"user\",\n name: \"TextToEdit\",\n content: \"While I was there I picked up some apples, oranges, and bananas. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: \"The grocery store was having a sale on fruit, so I decided to stock up.\",\n },\n {\n role: \"user\",\n name: \"EditingPrompt\",\n content: \"I also bought a big watermelon\",\n },\n {\n role: \"assistant\",\n content:\n \"While I was there I picked up some apples, oranges, and bananas, and a big watermelon.\",\n },\n\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: \"Yesterday, I spent the afternoon working on my new project. \",\n },\n {\n role: \"user\",\n name: \"TextToEdit\",\n content: \"It's quite challenging and requires a lot of focus. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: \"I'm really excited about the potential outcomes of this project.\",\n },\n {\n role: \"user\",\n name: \"EditingPrompt\",\n content: \"emphasize the complexity and my enthusiasm for the project\",\n },\n {\n role: \"assistant\",\n content:\n \"It's a highly complex task that demands intense concentration, but I'm incredibly enthusiastic about the promising prospects of this project.\",\n },\n];\n\nexport const defaultEditingApiConfig: EditingApiConfig = {\n makeSystemPrompt: defaultEditingMakeSystemPrompt,\n fewShotMessages: defaultEditingFewShotMessages,\n forwardedParams: undefined,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,wBAAgD;AA4DhD,IAAM,8CAA8C,CAClD,OACA,aACG;AAEH,MAAI,MAAM,QAAQ,YAAY,MAAM,SAAS;AAC3C,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,IAAM,8CAA8C,CAClD,UACG;AAEH,MAAI,MAAM,QAAQ,OAAO;AACvB,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAcO,IAAM,mCAGT;AAAA,EACF,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,uDAAuD;AAAA,EACvD,sCAAsC;AAAA,EACtC,sCAAsC;AACxC;;;AChGO,IAAM,qCAAuD,CAClE,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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A,qBAAgD;AAczC,IAAM,+BAGT,iCACC,mCADD;AAAA,EAEF,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,IACd,sBAAsB;AAAA,IACtB,oBAAoB;AAAA,IACpB,kBAAkB;AAAA,EACpB;AACF;","names":["import_react_core"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/types/autosuggestions-config/autosuggestions-config.tsx","../../../src/types/base/base-autosuggestions-config.tsx","../../../src/types/autosuggestions-config/suggestions-api-config.tsx","../../../src/types/autosuggestions-config/insertions-api-config.tsx","../../../src/types/autosuggestions-config/editing-api-config.tsx"],"sourcesContent":["import { BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig } from \"../base\";\nimport { SuggestionsApiConfig, defaultSuggestionsApiConfig } from \"./suggestions-api-config\";\nimport { InsertionsApiConfig, defaultInsertionsApiConfig } from \"./insertions-api-config\";\nimport { EditingApiConfig, defaultEditingApiConfig } from \"./editing-api-config\";\nimport { defaultCopilotContextCategories } from \"@copilotkit/react-core\";\n\n// Like the base autosuggestions config, with 2 additional fields:\n// 1. contextCategories: string[] | undefined;\n// 2. instead of apiConfigs, we have chatApiConfigs: a higher-level abstraction that uses a ChatGPT-like API endpoint.\nexport interface AutosuggestionsConfig extends Omit<BaseAutosuggestionsConfig, \"apiConfig\"> {\n contextCategories: string[];\n chatApiConfigs: {\n suggestionsApiConfig: SuggestionsApiConfig;\n insertionApiConfig: InsertionsApiConfig;\n editingApiConfig: EditingApiConfig;\n };\n}\n\nexport const defaultAutosuggestionsConfig: Omit<\n AutosuggestionsConfig,\n \"textareaPurpose\" | \"apiEndpoint\"\n> = {\n ...defaultBaseAutosuggestionsConfig,\n contextCategories: defaultCopilotContextCategories,\n chatApiConfigs: {\n suggestionsApiConfig: defaultSuggestionsApiConfig,\n insertionApiConfig: defaultInsertionsApiConfig,\n editingApiConfig: defaultEditingApiConfig,\n },\n};\n","import { BaseCopilotTextareaApiConfig } from \"./autosuggestions-bare-function\";\nimport { defaultCopilotContextCategories } from \"@copilotkit/react-core\";\n\n/**\n * @interface BaseAutosuggestionsConfig\n *\n * @property {string} textareaPurpose - The purpose of the textarea. This is used to guide the autosuggestions.\n *\n * @property {string[]} contextCategories - The categories of context to consider when providing autosuggestions.\n *\n * @property {number} debounceTime - The amount of time (in milliseconds) to wait before triggering autosuggestions after the user has stopped typing.\n *\n * @property {BaseCopilotTextareaApiConfig} apiConfig - The configuration for the API that provides the autosuggestions.\n *\n * @property {boolean} disableWhenEmpty - Whether to disable autosuggestions when the textarea is empty.\n *\n * @property {boolean} disabled - Whether to disable autosuggestions entirely.\n *\n * @property {boolean} temporarilyDisableWhenMovingCursorWithoutChangingText - Whether to temporarily disable autosuggestions when the user moves the cursor without changing the text.\n *\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnKeyPress - A function that determines whether to accept the current autosuggestion based on a key press event. By default, the Tab key is used to accept the autosuggestion. Example code:\n *\n * ```typescript\n * const defaultShouldAcceptAutosuggestionOnKeyPress = (event: React.KeyboardEvent<HTMLDivElement>) => {\n * // if tab, accept the autosuggestion\n * if (event.key === \"Tab\") {\n * return true;\n * }\n * return false;\n * }\n * ```\n *\n * @property {(event: React.TouchEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnTouch - A function that determines whether to accept the current autosuggestion based on a mobile touch event. By default, the touching the end of a suggestion will accept it. Example code:\n *\n * ```typescript\n * const shouldAcceptAutosuggestionOnTouch = (event: React.TouchEvent<HTMLDivElement>) => {\n * // if tab, accept the autosuggestion\n * if (event.type === \"touchstart\") {\n * return true;\n * }\n * return false;\n * }\n * ```\n *\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldToggleHoveringEditorOnKeyPress - A function that determines whether to toggle the hovering editor based on a key press event. By default, the Command + K key combination is used to toggle the hovering editor. Example code:\n *\n * ```typescript\n * const defaultShouldToggleHoveringEditorOnKeyPress = (event: React.KeyboardEvent<HTMLDivElement>) => {\n * // if command-k, toggle the hovering editor\n * if (event.key === \"k\" && event.metaKey) {\n * return true;\n * }\n * return false;\n * }\n * ```\n */\nexport interface BaseAutosuggestionsConfig {\n textareaPurpose: string;\n contextCategories: string[];\n debounceTime: number;\n apiConfig: BaseCopilotTextareaApiConfig;\n\n disableWhenEmpty: boolean;\n disabled: boolean;\n temporarilyDisableWhenMovingCursorWithoutChangingText: boolean;\n shouldAcceptAutosuggestionOnKeyPress: (event: React.KeyboardEvent<HTMLDivElement>) => boolean;\n shouldAcceptAutosuggestionOnTouch: (event: React.TouchEvent<HTMLDivElement>) => boolean;\n shouldToggleHoveringEditorOnKeyPress: (\n event: React.KeyboardEvent<HTMLDivElement>,\n shortcut: string,\n ) => boolean;\n}\n\n// by default, command-k toggles the hovering editor\nconst defaultShouldToggleHoveringEditorOnKeyPress = (\n event: React.KeyboardEvent<HTMLDivElement>,\n shortcut: string,\n) => {\n // if command-k, toggle the hovering editor\n if (event.key === shortcut && event.metaKey) {\n return true;\n }\n return false;\n};\n\nconst defaultShouldAcceptAutosuggestionOnKeyPress = (\n event: React.KeyboardEvent<HTMLDivElement>,\n) => {\n // if tab, accept the autosuggestion\n if (event.key === \"Tab\") {\n return true;\n }\n return false;\n};\n\nconst defaultShouldAcceptAutosuggestionOnTouch = () => true;\n\n/**\n * Default configuration for the BaseAutosuggestions.\n *\n * @property {number} debounceTime - The amount of time to wait before triggering the autosuggestions API call.\n * @property {string[]} contextCategories - The categories to use for context when making the autosuggestions API call.\n * @property {boolean} disableWhenEmpty - Whether to disable the autosuggestions when the textarea is empty.\n * @property {boolean} disabled - Whether to disable the autosuggestions feature entirely.\n * @property {boolean} temporarilyDisableWhenMovingCursorWithoutChangingText - Whether to temporarily disable the autosuggestions when the cursor is moved without changing the text.\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldToggleHoveringEditorOnKeyPress - A function that determines whether to toggle the hovering editor based on a key press event.\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnKeyPress - A function that determines whether to accept the autosuggestion based on a key press event.\n * @property {() => boolean} defaultShouldAcceptAutosuggestionOnTouch - A function that determines whether to accept the autosuggestion based on a mobile touch event.\n */\n\nexport const defaultBaseAutosuggestionsConfig: Omit<\n BaseAutosuggestionsConfig,\n \"textareaPurpose\" | \"apiConfig\"\n> = {\n debounceTime: 250,\n contextCategories: defaultCopilotContextCategories,\n disableWhenEmpty: true,\n disabled: false,\n temporarilyDisableWhenMovingCursorWithoutChangingText: true,\n shouldToggleHoveringEditorOnKeyPress: defaultShouldToggleHoveringEditorOnKeyPress,\n shouldAcceptAutosuggestionOnKeyPress: defaultShouldAcceptAutosuggestionOnKeyPress,\n shouldAcceptAutosuggestionOnTouch: defaultShouldAcceptAutosuggestionOnTouch,\n};\n","import { Message, Role, TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\nimport { nanoid } from \"nanoid\";\n\nexport interface SuggestionsApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: Message[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultSuggestionsMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString,\n) => {\n return `You are a versatile writing assistant.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nYour job is to guess what the user will write next AS BEST YOU CAN.\nOnly guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.\n\nAdjust yourself to the user's style and implied intent.\n\nThe user will provide both the text before and after the cursor. You should use this to infer what the user is likely to write next.\n<TextAfterCursor>\n<TextBeforeCursor>\n<YourSuggestion>\n\nIf we need to add a whitespace character to the suggested text, make sure to explicitly add it in.\n\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n`;\n};\n\nexport const defaultSuggestionsFewShotMessages: Message[] = [\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content: \"This morning I woke up and went straight to the grocery store.\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n '<TextBeforeCursor>The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;</TextBeforeCursor>',\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n }),\n];\n\nexport const defaultSuggestionsApiConfig: SuggestionsApiConfig = {\n makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,\n fewShotMessages: defaultSuggestionsFewShotMessages,\n forwardedParams: undefined,\n};\n","import { Message, Role, TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\nimport { nanoid } from \"nanoid\";\n\nexport interface InsertionsApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: Message[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultInsertionsMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString,\n) => {\n return `You are a versatile writing assistant helping the user insert new text into their existing work.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe following external context is also provided. Use it to inform your suggestions when relevant!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user will provide you with a prompt for an INSERTION into the text they are writing. \nYour job is to come up with an INSERTION into the text that the user would like to use, AS BEST YOU CAN.\nOnly insert a SHORT segment. Usually 1 sentence, or at most 1 paragraph.\n\nAdjust yourself to the user's style and implied intent.\n\n\nThe user will provide the text before and after the cursor, as well as the INSERTION prompt. You should use this to infer the best relevant insertion.\nThe conversation will be structured as follows:\n<TextAfterCursor>\n<TextBeforeCursor>\n<InsertionPrompt>\n\n<YourInsertionSuggestion>\n`;\n};\n\nexport const defaultInsertionsFewShotMessages: Message[] = [\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextBeforeCursor>This morning I woke up and went straight to the grocery store.</TextBeforeCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content: \"<InsertionPrompt>I bought a big watermelon</InsertionPrompt>\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n \"When I arrived I went straight to the produce section and picked out a big watermelon.\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n '<TextBeforeCursor>The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;</TextBeforeCursor>',\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<InsertionPrompt>add section about the optionholder's pro rata share</InsertionPrompt>\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n }),\n];\n\nexport const defaultInsertionsApiConfig: InsertionsApiConfig = {\n makeSystemPrompt: defaultInsertionsMakeSystemPrompt,\n fewShotMessages: defaultInsertionsFewShotMessages,\n forwardedParams: undefined,\n};\n","import { Message, Role, TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\nimport { nanoid } from \"nanoid\";\n\nexport interface EditingApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: Message[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultEditingMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString,\n) => {\n return `You are a versatile writing assistant helping the user edit a portion of their text.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe following external context is also provided. Use it when relevant.\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user has provided you with a PROMPT for EDITING a PORTION of the text. \nYour job is to come up with a new EDITED version OF THE SEGMENT IN QUESTION - AS BEST YOU CAN.\nOnly rewrite the portion of the text that the user has marked as \"TextToEdit\"!!!\n\nAdjust yourself to the user's style and implied intent.\n\nThe conversation will be structured as follows:\n<TextBeforeCursor>\n<TextToEdit>\n<TextAfterCursor>\n<EditingPrompt>\n\n<YourEditSuggestion>\n`;\n};\n\nexport const defaultEditingFewShotMessages: Message[] = [\n new TextMessage({\n role: Role.User,\n content:\n \"<TextBeforeCursor>This morning I woke up and went straight to the grocery store. </TextBeforeCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextToEdit>While I was there I picked up some apples, oranges, and bananas. </TextToEdit>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>The grocery store was having a sale on fruit, so I decided to stock up.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content: \"<EditingPrompt>I also bought a big watermelon</EditingPrompt>\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n \"While I was there I picked up some apples, oranges, and bananas, and a big watermelon.\",\n }),\n\n new TextMessage({\n role: Role.User,\n content:\n \"<TextBeforeCursor>Yesterday, I spent the afternoon working on my new project.</TextBeforeCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content: \"<TextToEdit>It's quite challenging and requires a lot of focus.</TextToEdit>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>I'm really excited about the potential outcomes of this project.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<EditingPrompt>emphasize the complexity and my enthusiasm for the project</EditingPrompt>\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n \"It's a highly complex task that demands intense concentration, but I'm incredibly enthusiastic about the promising prospects of this project.\",\n }),\n];\n\nexport const defaultEditingApiConfig: EditingApiConfig = {\n makeSystemPrompt: defaultEditingMakeSystemPrompt,\n fewShotMessages: defaultEditingFewShotMessages,\n forwardedParams: undefined,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,wBAAgD;AAyEhD,IAAM,8CAA8C,CAClD,OACA,aACG;AAEH,MAAI,MAAM,QAAQ,YAAY,MAAM,SAAS;AAC3C,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,IAAM,8CAA8C,CAClD,UACG;AAEH,MAAI,MAAM,QAAQ,OAAO;AACvB,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,IAAM,2CAA2C,MAAM;AAehD,IAAM,mCAGT;AAAA,EACF,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,uDAAuD;AAAA,EACvD,sCAAsC;AAAA,EACtC,sCAAsC;AAAA,EACtC,mCAAmC;AACrC;;;AC1HA,gCAA2C;AAUpC,IAAM,qCAAuD,CAClE,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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MAAM,gCAAK;AAAA,IACX,SAAS;AAAA,EACX,CAAC;AAAA,EACD,IAAI,uCAAY;AAAA,IACd,MAAM,gCAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,uCAAY;AAAA,IACd,MAAM,gCAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,uCAAY;AAAA,IACd,MAAM,gCAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AACH;AAEO,IAAM,0BAA4C;AAAA,EACvD,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB;;;AJ5FA,IAAAC,qBAAgD;AAczC,IAAM,+BAGT,iCACC,mCADD;AAAA,EAEF,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,IACd,sBAAsB;AAAA,IACtB,oBAAoB;AAAA,IACpB,kBAAkB;AAAA,EACpB;AACF;","names":["import_runtime_client_gql","import_runtime_client_gql","import_react_core"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defaultAutosuggestionsConfig
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-H3PGQHLG.mjs";
|
|
4
|
+
import "../../chunk-CVO5T3PA.mjs";
|
|
5
|
+
import "../../chunk-I6DJQ7D7.mjs";
|
|
6
|
+
import "../../chunk-WMHVBGPR.mjs";
|
|
7
7
|
import "../../chunk-WJHSY5T6.mjs";
|
|
8
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-OJXLHIYQ.mjs";
|
|
9
9
|
import "../../chunk-MRXNTQOX.mjs";
|
|
10
10
|
export {
|
|
11
11
|
defaultAutosuggestionsConfig
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { Message } from '@copilotkit/runtime-client-gql';
|
|
1
2
|
import { MakeSystemPrompt } from './subtypes/make-system-prompt.js';
|
|
2
|
-
import { MinimalChatGPTMessage } from './subtypes/minimal-chat-gpt-message.js';
|
|
3
3
|
|
|
4
4
|
interface EditingApiConfig {
|
|
5
5
|
makeSystemPrompt: MakeSystemPrompt;
|
|
6
|
-
fewShotMessages:
|
|
6
|
+
fewShotMessages: Message[];
|
|
7
7
|
forwardedParams: {
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
} | undefined;
|
|
10
10
|
}
|
|
11
11
|
declare const defaultEditingMakeSystemPrompt: MakeSystemPrompt;
|
|
12
|
-
declare const defaultEditingFewShotMessages:
|
|
12
|
+
declare const defaultEditingFewShotMessages: Message[];
|
|
13
13
|
declare const defaultEditingApiConfig: EditingApiConfig;
|
|
14
14
|
|
|
15
15
|
export { EditingApiConfig, defaultEditingApiConfig, defaultEditingFewShotMessages, defaultEditingMakeSystemPrompt };
|
|
@@ -25,6 +25,7 @@ __export(editing_api_config_exports, {
|
|
|
25
25
|
defaultEditingMakeSystemPrompt: () => defaultEditingMakeSystemPrompt
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(editing_api_config_exports);
|
|
28
|
+
var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
28
29
|
var defaultEditingMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
29
30
|
return `You are a versatile writing assistant helping the user edit a portion of their text.
|
|
30
31
|
|
|
@@ -52,54 +53,46 @@ The conversation will be structured as follows:
|
|
|
52
53
|
`;
|
|
53
54
|
};
|
|
54
55
|
var defaultEditingFewShotMessages = [
|
|
55
|
-
{
|
|
56
|
-
role:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
content: "I also bought a big watermelon"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
role: "assistant",
|
|
56
|
+
new import_runtime_client_gql.TextMessage({
|
|
57
|
+
role: import_runtime_client_gql.Role.User,
|
|
58
|
+
content: "<TextBeforeCursor>This morning I woke up and went straight to the grocery store. </TextBeforeCursor>"
|
|
59
|
+
}),
|
|
60
|
+
new import_runtime_client_gql.TextMessage({
|
|
61
|
+
role: import_runtime_client_gql.Role.User,
|
|
62
|
+
content: "<TextToEdit>While I was there I picked up some apples, oranges, and bananas. </TextToEdit>"
|
|
63
|
+
}),
|
|
64
|
+
new import_runtime_client_gql.TextMessage({
|
|
65
|
+
role: import_runtime_client_gql.Role.User,
|
|
66
|
+
content: "<TextAfterCursor>The grocery store was having a sale on fruit, so I decided to stock up.</TextAfterCursor>"
|
|
67
|
+
}),
|
|
68
|
+
new import_runtime_client_gql.TextMessage({
|
|
69
|
+
role: import_runtime_client_gql.Role.User,
|
|
70
|
+
content: "<EditingPrompt>I also bought a big watermelon</EditingPrompt>"
|
|
71
|
+
}),
|
|
72
|
+
new import_runtime_client_gql.TextMessage({
|
|
73
|
+
role: import_runtime_client_gql.Role.Assistant,
|
|
77
74
|
content: "While I was there I picked up some apples, oranges, and bananas, and a big watermelon."
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
role:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
content: "emphasize the complexity and my enthusiasm for the project"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
role: "assistant",
|
|
75
|
+
}),
|
|
76
|
+
new import_runtime_client_gql.TextMessage({
|
|
77
|
+
role: import_runtime_client_gql.Role.User,
|
|
78
|
+
content: "<TextBeforeCursor>Yesterday, I spent the afternoon working on my new project.</TextBeforeCursor>"
|
|
79
|
+
}),
|
|
80
|
+
new import_runtime_client_gql.TextMessage({
|
|
81
|
+
role: import_runtime_client_gql.Role.User,
|
|
82
|
+
content: "<TextToEdit>It's quite challenging and requires a lot of focus.</TextToEdit>"
|
|
83
|
+
}),
|
|
84
|
+
new import_runtime_client_gql.TextMessage({
|
|
85
|
+
role: import_runtime_client_gql.Role.User,
|
|
86
|
+
content: "<TextAfterCursor>I'm really excited about the potential outcomes of this project.</TextAfterCursor>"
|
|
87
|
+
}),
|
|
88
|
+
new import_runtime_client_gql.TextMessage({
|
|
89
|
+
role: import_runtime_client_gql.Role.User,
|
|
90
|
+
content: "<EditingPrompt>emphasize the complexity and my enthusiasm for the project</EditingPrompt>"
|
|
91
|
+
}),
|
|
92
|
+
new import_runtime_client_gql.TextMessage({
|
|
93
|
+
role: import_runtime_client_gql.Role.Assistant,
|
|
101
94
|
content: "It's a highly complex task that demands intense concentration, but I'm incredibly enthusiastic about the promising prospects of this project."
|
|
102
|
-
}
|
|
95
|
+
})
|
|
103
96
|
];
|
|
104
97
|
var defaultEditingApiConfig = {
|
|
105
98
|
makeSystemPrompt: defaultEditingMakeSystemPrompt,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/types/autosuggestions-config/editing-api-config.tsx"],"sourcesContent":["import { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/types/autosuggestions-config/editing-api-config.tsx"],"sourcesContent":["import { Message, Role, TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\nimport { nanoid } from \"nanoid\";\n\nexport interface EditingApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: Message[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultEditingMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString,\n) => {\n return `You are a versatile writing assistant helping the user edit a portion of their text.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe following external context is also provided. Use it when relevant.\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user has provided you with a PROMPT for EDITING a PORTION of the text. \nYour job is to come up with a new EDITED version OF THE SEGMENT IN QUESTION - AS BEST YOU CAN.\nOnly rewrite the portion of the text that the user has marked as \"TextToEdit\"!!!\n\nAdjust yourself to the user's style and implied intent.\n\nThe conversation will be structured as follows:\n<TextBeforeCursor>\n<TextToEdit>\n<TextAfterCursor>\n<EditingPrompt>\n\n<YourEditSuggestion>\n`;\n};\n\nexport const defaultEditingFewShotMessages: Message[] = [\n new TextMessage({\n role: Role.User,\n content:\n \"<TextBeforeCursor>This morning I woke up and went straight to the grocery store. </TextBeforeCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextToEdit>While I was there I picked up some apples, oranges, and bananas. </TextToEdit>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>The grocery store was having a sale on fruit, so I decided to stock up.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content: \"<EditingPrompt>I also bought a big watermelon</EditingPrompt>\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n \"While I was there I picked up some apples, oranges, and bananas, and a big watermelon.\",\n }),\n\n new TextMessage({\n role: Role.User,\n content:\n \"<TextBeforeCursor>Yesterday, I spent the afternoon working on my new project.</TextBeforeCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content: \"<TextToEdit>It's quite challenging and requires a lot of focus.</TextToEdit>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>I'm really excited about the potential outcomes of this project.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<EditingPrompt>emphasize the complexity and my enthusiasm for the project</EditingPrompt>\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n \"It's a highly complex task that demands intense concentration, but I'm incredibly enthusiastic about the promising prospects of this project.\",\n }),\n];\n\nexport const defaultEditingApiConfig: EditingApiConfig = {\n makeSystemPrompt: defaultEditingMakeSystemPrompt,\n fewShotMessages: defaultEditingFewShotMessages,\n forwardedParams: undefined,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAA2C;AAUpC,IAAM,iCAAmD,CAC9D,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA,EAIlB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBF;AAEO,IAAM,gCAA2C;AAAA,EACtD,IAAI,sCAAY;AAAA,IACd,MAAM,+BAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,sCAAY;AAAA,IACd,MAAM,+BAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,sCAAY;AAAA,IACd,MAAM,+BAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,sCAAY;AAAA,IACd,MAAM,+BAAK;AAAA,IACX,SAAS;AAAA,EACX,CAAC;AAAA,EACD,IAAI,sCAAY;AAAA,IACd,MAAM,+BAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EAED,IAAI,sCAAY;AAAA,IACd,MAAM,+BAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,sCAAY;AAAA,IACd,MAAM,+BAAK;AAAA,IACX,SAAS;AAAA,EACX,CAAC;AAAA,EACD,IAAI,sCAAY;AAAA,IACd,MAAM,+BAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,sCAAY;AAAA,IACd,MAAM,+BAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,sCAAY;AAAA,IACd,MAAM,+BAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AACH;AAEO,IAAM,0BAA4C;AAAA,EACvD,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB;","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { AutosuggestionsConfig, defaultAutosuggestionsConfig } from './autosuggestions-config.js';
|
|
2
|
-
export { MinimalChatGPTMessage } from './subtypes/minimal-chat-gpt-message.js';
|
|
3
2
|
export { MakeSystemPrompt } from './subtypes/make-system-prompt.js';
|
|
4
3
|
export { AutosuggestionsConfigUserSpecified, InsertionsApiConfigUserSpecified, SuggestionsApiConfigUserSpecified } from './autosuggestions-config-user-specified.js';
|
|
5
4
|
import '../base/base-autosuggestions-config.js';
|
|
6
5
|
import '../base/autosuggestions-bare-function.js';
|
|
7
6
|
import '@copilotkit/react-core';
|
|
8
7
|
import './suggestions-api-config.js';
|
|
8
|
+
import '@copilotkit/runtime-client-gql';
|
|
9
9
|
import './insertions-api-config.js';
|
|
10
10
|
import './editing-api-config.js';
|