@copilotkit/react-textarea 0.21.0-alpha.1 → 0.21.0-alpha.3
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 +314 -182
- package/CHANGELOG.md +22 -0
- package/dist/{chunk-F4WZCQG6.mjs → chunk-7D5DUGLT.mjs} +4 -4
- package/dist/{chunk-7JO276KU.mjs → chunk-G4U3POLM.mjs} +2 -2
- package/dist/{chunk-IPM5WWPW.mjs → chunk-NHYCKIK7.mjs} +4 -4
- package/dist/{chunk-LRXRD5KU.mjs → chunk-QQ3KP25O.mjs} +2 -2
- package/dist/{chunk-34D4UIYX.mjs → chunk-YF4T3ZZF.mjs} +18 -18
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js +1772 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +16 -16
- package/dist/components/base-copilot-textarea/render-element.js +75 -0
- package/dist/components/base-copilot-textarea/render-element.js.map +1 -0
- package/dist/components/base-copilot-textarea/render-placeholder.js +69 -0
- package/dist/components/base-copilot-textarea/render-placeholder.js.map +1 -0
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js +112 -0
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js.map +1 -0
- package/dist/components/base-copilot-textarea/use-add-branding-css.js +83 -0
- package/dist/components/base-copilot-textarea/use-add-branding-css.js.map +1 -0
- package/dist/components/copilot-textarea/copilot-textarea.js +2246 -0
- package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -0
- package/dist/components/copilot-textarea/copilot-textarea.mjs +25 -25
- package/dist/components/hovering-toolbar/hovering-editor-provider.js +49 -0
- package/dist/components/hovering-toolbar/hovering-editor-provider.js.map +1 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js +158 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +1 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.js +915 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +7 -7
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +622 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +3 -3
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +639 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +4 -4
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js +140 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +639 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +4 -4
- package/dist/components/index.js +2250 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +25 -25
- package/dist/components/manual-ui/chip-with-icon.js +53 -0
- package/dist/components/manual-ui/chip-with-icon.js.map +1 -0
- package/dist/components/source-search-box/source-search-box.js +243 -0
- package/dist/components/source-search-box/source-search-box.js.map +1 -0
- package/dist/components/ui/button.js +118 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/card.js +142 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/command.js +306 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/dialog.js +199 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/label.js +92 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/separator.js +96 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/textarea.js +91 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/context/index.js +19 -0
- package/dist/context/index.js.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js +193 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js +194 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js +180 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js.map +1 -0
- package/dist/hooks/index.js +19 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +167 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js.map +1 -0
- 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.js +227 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js.map +1 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +1 -1
- package/dist/hooks/misc/use-autosize-textarea.js +39 -0
- package/dist/hooks/misc/use-autosize-textarea.js.map +1 -0
- package/dist/index.js +2256 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +31 -31
- package/dist/lib/debouncer.js +76 -0
- package/dist/lib/debouncer.js.map +1 -0
- package/dist/lib/editor-to-text.js +69 -0
- package/dist/lib/editor-to-text.js.map +1 -0
- package/dist/lib/get-text-around-cursor.js +131 -0
- package/dist/lib/get-text-around-cursor.js.map +1 -0
- package/dist/lib/retry.js +43 -0
- package/dist/lib/retry.js.map +1 -0
- package/dist/lib/slatejs-edits/add-autocompletions.js +51 -0
- package/dist/lib/slatejs-edits/add-autocompletions.js.map +1 -0
- package/dist/lib/slatejs-edits/clear-autocompletions.js +49 -0
- package/dist/lib/slatejs-edits/clear-autocompletions.js.map +1 -0
- package/dist/lib/slatejs-edits/replace-text.js +53 -0
- package/dist/lib/slatejs-edits/replace-text.js.map +1 -0
- package/dist/lib/slatejs-edits/with-partial-history.js +133 -0
- package/dist/lib/slatejs-edits/with-partial-history.js.map +1 -0
- package/dist/lib/stream-promise-flatten.js +72 -0
- package/dist/lib/stream-promise-flatten.js.map +1 -0
- package/dist/lib/utils.js +101 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/utils.test.js +9 -0
- package/dist/lib/utils.test.js.map +1 -0
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js +19 -0
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js.map +1 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.js +275 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.js.map +1 -0
- package/dist/types/autosuggestions-config/editing-api-config.js +109 -0
- package/dist/types/autosuggestions-config/editing-api-config.js.map +1 -0
- package/dist/types/autosuggestions-config/index.js +331 -0
- package/dist/types/autosuggestions-config/index.js.map +1 -0
- package/dist/types/autosuggestions-config/insertions-api-config.js +103 -0
- package/dist/types/autosuggestions-config/insertions-api-config.js.map +1 -0
- package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.js +99 -0
- package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.js.map +1 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js +19 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js.map +1 -0
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js +19 -0
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js.map +1 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.js +92 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.js.map +1 -0
- package/dist/types/base/autosuggestion-state.js +19 -0
- package/dist/types/base/autosuggestion-state.js.map +1 -0
- package/dist/types/base/autosuggestions-bare-function.js +19 -0
- package/dist/types/base/autosuggestions-bare-function.js.map +1 -0
- package/dist/types/base/base-autosuggestions-config.js +38 -0
- package/dist/types/base/base-autosuggestions-config.js.map +1 -0
- package/dist/types/base/base-copilot-textarea-props.js +19 -0
- package/dist/types/base/base-copilot-textarea-props.js.map +1 -0
- package/dist/types/base/custom-editor.js +19 -0
- package/dist/types/base/custom-editor.js.map +1 -0
- package/dist/types/base/editor-autocomplete-state.js +45 -0
- package/dist/types/base/editor-autocomplete-state.js.map +1 -0
- package/dist/types/base/index.js +40 -0
- package/dist/types/base/index.js.map +1 -0
- package/dist/types/html-copilot-textarea-element.js +19 -0
- package/dist/types/html-copilot-textarea-element.js.map +1 -0
- package/dist/types/index.js +333 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +1 -1
- package/package.json +9 -6
- package/tsup.config.ts +1 -1
- /package/dist/{chunk-F4WZCQG6.mjs.map → chunk-7D5DUGLT.mjs.map} +0 -0
- /package/dist/{chunk-7JO276KU.mjs.map → chunk-G4U3POLM.mjs.map} +0 -0
- /package/dist/{chunk-IPM5WWPW.mjs.map → chunk-NHYCKIK7.mjs.map} +0 -0
- /package/dist/{chunk-LRXRD5KU.mjs.map → chunk-QQ3KP25O.mjs.map} +0 -0
- /package/dist/{chunk-34D4UIYX.mjs.map → chunk-YF4T3ZZF.mjs.map} +0 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __export = (target, all) => {
|
|
24
|
+
for (var name in all)
|
|
25
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
26
|
+
};
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
+
for (let key of __getOwnPropNames(from))
|
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
31
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
32
|
+
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
+
var __async = (__this, __arguments, generator) => {
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
var fulfilled = (value) => {
|
|
39
|
+
try {
|
|
40
|
+
step(generator.next(value));
|
|
41
|
+
} catch (e) {
|
|
42
|
+
reject(e);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var rejected = (value) => {
|
|
46
|
+
try {
|
|
47
|
+
step(generator.throw(value));
|
|
48
|
+
} catch (e) {
|
|
49
|
+
reject(e);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
53
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// src/types/autosuggestions-config/index.ts
|
|
58
|
+
var autosuggestions_config_exports = {};
|
|
59
|
+
__export(autosuggestions_config_exports, {
|
|
60
|
+
ChatlikeApiEndpoint: () => ChatlikeApiEndpoint,
|
|
61
|
+
defaultAutosuggestionsConfig: () => defaultAutosuggestionsConfig
|
|
62
|
+
});
|
|
63
|
+
module.exports = __toCommonJS(autosuggestions_config_exports);
|
|
64
|
+
|
|
65
|
+
// src/types/base/base-autosuggestions-config.tsx
|
|
66
|
+
var defaultBaseAutosuggestionsConfig = {
|
|
67
|
+
debounceTime: 250,
|
|
68
|
+
contextCategories: ["global"],
|
|
69
|
+
acceptAutosuggestionKey: "Tab",
|
|
70
|
+
disableWhenEmpty: true,
|
|
71
|
+
disabled: false,
|
|
72
|
+
temporarilyDisableWhenMovingCursorWithoutChangingText: true
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// src/types/autosuggestions-config/suggestions-api-config.tsx
|
|
76
|
+
var defaultSuggestionsMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
77
|
+
return `You are a versatile writing assistant.
|
|
78
|
+
|
|
79
|
+
The user is writing some text.
|
|
80
|
+
The purpose is: "${textareaPurpose}"
|
|
81
|
+
|
|
82
|
+
Your job is to guess what the user will write next AS BEST YOU CAN.
|
|
83
|
+
Only guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.
|
|
84
|
+
|
|
85
|
+
Adjust yourself to the user's style and implied intent.
|
|
86
|
+
|
|
87
|
+
The 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.
|
|
88
|
+
<TextAfterCursor>
|
|
89
|
+
<TextBeforeCursor>
|
|
90
|
+
<YourSuggestion>
|
|
91
|
+
|
|
92
|
+
If we need to add a whitespace character to the suggested text, make sure to explicitly add it in.
|
|
93
|
+
|
|
94
|
+
The following external context is also provided. Use it to help you make better suggestions!!!
|
|
95
|
+
\`\`\`
|
|
96
|
+
${contextString}
|
|
97
|
+
\`\`\`
|
|
98
|
+
`;
|
|
99
|
+
};
|
|
100
|
+
var defaultSuggestionsFewShotMessages = [
|
|
101
|
+
{
|
|
102
|
+
role: "user",
|
|
103
|
+
name: "TextAfterCursor",
|
|
104
|
+
content: "While I was there I also picked up some apples, oranges, and bananas."
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
role: "user",
|
|
108
|
+
content: "This morning I woke up and went straight to the grocery store."
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
role: "assistant",
|
|
112
|
+
content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
role: "user",
|
|
116
|
+
name: "TextAfterCursor",
|
|
117
|
+
content: "and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof."
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
role: "user",
|
|
121
|
+
name: "TextBeforeCursor",
|
|
122
|
+
content: `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;`
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
role: "assistant",
|
|
126
|
+
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"; `
|
|
127
|
+
}
|
|
128
|
+
];
|
|
129
|
+
var defaultSuggestionsApiConfig = {
|
|
130
|
+
makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,
|
|
131
|
+
fewShotMessages: defaultSuggestionsFewShotMessages,
|
|
132
|
+
forwardedParams: void 0
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// src/types/autosuggestions-config/insertions-api-config.tsx
|
|
136
|
+
var defaultInsertionsMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
137
|
+
return `You are a versatile writing assistant.
|
|
138
|
+
|
|
139
|
+
The user is writing some text.
|
|
140
|
+
The purpose is: "${textareaPurpose}"
|
|
141
|
+
|
|
142
|
+
The following external context is also provided. Use it to help you make better suggestions!!!
|
|
143
|
+
\`\`\`
|
|
144
|
+
${contextString}
|
|
145
|
+
\`\`\`
|
|
146
|
+
|
|
147
|
+
The user also provides you with a prompt for INSERTIONS into the text they are writing.
|
|
148
|
+
Your job is to come up with an INSERTION into the text that the user would like AS BEST YOU CAN.
|
|
149
|
+
Only insert a SHORT segment. Usually 1 sentence, or at most 1 paragraph.
|
|
150
|
+
|
|
151
|
+
Adjust yourself to the user's style and implied intent.
|
|
152
|
+
|
|
153
|
+
The 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.
|
|
154
|
+
<TextAfterCursor>
|
|
155
|
+
<TextBeforeCursor>
|
|
156
|
+
<InsertionPrompt>
|
|
157
|
+
<YourSuggestion>
|
|
158
|
+
`;
|
|
159
|
+
};
|
|
160
|
+
var defaultInsertionsFewShotMessages = [
|
|
161
|
+
{
|
|
162
|
+
role: "user",
|
|
163
|
+
name: "TextAfterCursor",
|
|
164
|
+
content: "While I was there I also picked up some apples, oranges, and bananas."
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
role: "user",
|
|
168
|
+
name: "TextBeforeCursor",
|
|
169
|
+
content: "This morning I woke up and went straight to the grocery store."
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
role: "user",
|
|
173
|
+
name: "InsertionPrompt",
|
|
174
|
+
content: "I bought a big watermelon"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
role: "assistant",
|
|
178
|
+
content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
role: "user",
|
|
182
|
+
name: "TextAfterCursor",
|
|
183
|
+
content: "and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof."
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
role: "user",
|
|
187
|
+
name: "TextBeforeCursor",
|
|
188
|
+
content: `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;`
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
role: "user",
|
|
192
|
+
name: "InsertionPrompt",
|
|
193
|
+
content: "add section about the optionholder's pro rata share"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
role: "assistant",
|
|
197
|
+
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"; `
|
|
198
|
+
}
|
|
199
|
+
];
|
|
200
|
+
var defaultInsertionsApiConfig = {
|
|
201
|
+
makeSystemPrompt: defaultInsertionsMakeSystemPrompt,
|
|
202
|
+
fewShotMessages: defaultInsertionsFewShotMessages,
|
|
203
|
+
forwardedParams: void 0
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
// src/types/autosuggestions-config/editing-api-config.tsx
|
|
207
|
+
var defaultEditingMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
208
|
+
return `You are a versatile writing assistant.
|
|
209
|
+
|
|
210
|
+
The user is writing some text.
|
|
211
|
+
The purpose is: "${textareaPurpose}"
|
|
212
|
+
|
|
213
|
+
The following external context is also provided. Use it to help you make better suggestions!!!
|
|
214
|
+
\`\`\`
|
|
215
|
+
${contextString}
|
|
216
|
+
\`\`\`
|
|
217
|
+
|
|
218
|
+
The user also provides you with a prompt for EDITING some text they are writing.
|
|
219
|
+
Your job is to come up with an EDIT of the text that the user would like to use - AS BEST YOU CAN.
|
|
220
|
+
|
|
221
|
+
Adjust yourself to the user's style and implied intent.
|
|
222
|
+
|
|
223
|
+
The user will provide the following information; use this to infer the best relevant EDIT:
|
|
224
|
+
<TextBeforeCursor>
|
|
225
|
+
<TextToEdit>
|
|
226
|
+
<TextAfterCursor>
|
|
227
|
+
<EditingPrompt>
|
|
228
|
+
|
|
229
|
+
<YourEditSuggestion>
|
|
230
|
+
`;
|
|
231
|
+
};
|
|
232
|
+
var defaultEditingFewShotMessages = [
|
|
233
|
+
{
|
|
234
|
+
role: "user",
|
|
235
|
+
name: "TextBeforeCursor",
|
|
236
|
+
content: "This morning I woke up and went straight to the grocery store. "
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
role: "user",
|
|
240
|
+
name: "TextToEdit",
|
|
241
|
+
content: "While I was there I also picked up some apples, oranges, and bananas. "
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
role: "user",
|
|
245
|
+
name: "TextAfterCursor",
|
|
246
|
+
content: "The grocery store was having a sale on fruit, so I decided to stock up."
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
role: "user",
|
|
250
|
+
name: "EditingPrompt",
|
|
251
|
+
content: "I bought a big watermelon"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
role: "assistant",
|
|
255
|
+
content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
role: "user",
|
|
259
|
+
name: "TextAfterCursor",
|
|
260
|
+
content: "and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof."
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
role: "user",
|
|
264
|
+
name: "TextBeforeCursor",
|
|
265
|
+
content: `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;`
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
role: "user",
|
|
269
|
+
name: "InsertionPrompt",
|
|
270
|
+
content: "add section about the optionholder's pro rata share"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
role: "assistant",
|
|
274
|
+
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"; `
|
|
275
|
+
}
|
|
276
|
+
];
|
|
277
|
+
var defaultEditingApiConfig = {
|
|
278
|
+
makeSystemPrompt: defaultEditingMakeSystemPrompt,
|
|
279
|
+
fewShotMessages: defaultEditingFewShotMessages,
|
|
280
|
+
forwardedParams: void 0
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
// src/types/autosuggestions-config/autosuggestions-config.tsx
|
|
284
|
+
var defaultAutosuggestionsConfig = __spreadProps(__spreadValues({}, defaultBaseAutosuggestionsConfig), {
|
|
285
|
+
externalContextCategories: void 0,
|
|
286
|
+
chatApiConfigs: {
|
|
287
|
+
suggestionsApiConfig: defaultSuggestionsApiConfig,
|
|
288
|
+
insertionApiConfig: defaultInsertionsApiConfig,
|
|
289
|
+
editingApiConfig: defaultEditingApiConfig
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
// src/types/autosuggestions-config/subtypes/chatlike-api-endpoint.tsx
|
|
294
|
+
var import_react_core = require("@copilotkit/react-core");
|
|
295
|
+
var ChatlikeApiEndpoint = class {
|
|
296
|
+
constructor(run) {
|
|
297
|
+
this.run = run;
|
|
298
|
+
}
|
|
299
|
+
static fromCopilotApiConfig(copilotApiConfig) {
|
|
300
|
+
return new ChatlikeApiEndpoint(
|
|
301
|
+
(abortSignal, messages, forwardedProps) => __async(this, null, function* () {
|
|
302
|
+
const res = yield fetch(
|
|
303
|
+
(0, import_react_core.copilotApiConfigExtrapolator)(copilotApiConfig).chatApiEndpoint,
|
|
304
|
+
{
|
|
305
|
+
method: "POST",
|
|
306
|
+
headers: __spreadValues({}, copilotApiConfig.headers),
|
|
307
|
+
body: JSON.stringify(__spreadProps(__spreadValues(__spreadValues({}, forwardedProps), copilotApiConfig.body), {
|
|
308
|
+
messages
|
|
309
|
+
})),
|
|
310
|
+
signal: abortSignal
|
|
311
|
+
}
|
|
312
|
+
);
|
|
313
|
+
const bodySteram = res.body;
|
|
314
|
+
if (!bodySteram) {
|
|
315
|
+
throw new Error("The response body is empty.");
|
|
316
|
+
}
|
|
317
|
+
const stringStream = bodySteram.pipeThrough(new TextDecoderStream());
|
|
318
|
+
return stringStream;
|
|
319
|
+
})
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
static custom(run) {
|
|
323
|
+
return new ChatlikeApiEndpoint(run);
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
327
|
+
0 && (module.exports = {
|
|
328
|
+
ChatlikeApiEndpoint,
|
|
329
|
+
defaultAutosuggestionsConfig
|
|
330
|
+
});
|
|
331
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/types/autosuggestions-config/index.ts","../../../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","../../../src/types/autosuggestions-config/autosuggestions-config.tsx","../../../src/types/autosuggestions-config/subtypes/chatlike-api-endpoint.tsx"],"sourcesContent":["export { defaultAutosuggestionsConfig } from \"./autosuggestions-config\";\nexport type { AutosuggestionsConfig } from \"./autosuggestions-config\";\n\nexport type { MinimalChatGPTMessage } from \"./subtypes/minimal-chat-gpt-message\";\nexport type { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\nexport { ChatlikeApiEndpoint } from \"./subtypes/chatlike-api-endpoint\";\nexport type { ChatlikeApiEndpointImpl } from \"./subtypes/chatlike-api-endpoint\";\n\nexport type { AutosuggestionsConfigUserSpecified } from \"./autosuggestions-config-user-specified\";\nexport type { SuggestionsApiConfigUserSpecified } from \"./autosuggestions-config-user-specified\";\nexport type { InsertionsApiConfigUserSpecified } from \"./autosuggestions-config-user-specified\";\n","import { BaseCopilotTextareaApiConfig } from \"./autosuggestions-bare-function\";\n\nexport interface BaseAutosuggestionsConfig {\n textareaPurpose: string;\n contextCategories: string[];\n debounceTime: number;\n acceptAutosuggestionKey: string;\n disableWhenEmpty: boolean;\n disabled: boolean;\n temporarilyDisableWhenMovingCursorWithoutChangingText: boolean;\n apiConfig: BaseCopilotTextareaApiConfig;\n}\n\nexport const defaultBaseAutosuggestionsConfig: Omit<\n BaseAutosuggestionsConfig,\n \"textareaPurpose\" | \"apiConfig\"\n> = {\n debounceTime: 250,\n contextCategories: [\"global\"],\n acceptAutosuggestionKey: \"Tab\",\n disableWhenEmpty: true,\n disabled: false,\n temporarilyDisableWhenMovingCursorWithoutChangingText: true,\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:\n \"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.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user also provides you with a prompt for INSERTIONS into the text they are writing. \nYour job is to come up with an INSERTION into the text that the user would like 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\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.\n<TextAfterCursor>\n<TextBeforeCursor>\n<InsertionPrompt>\n<YourSuggestion>\n`;\n};\n\nexport const defaultInsertionsFewShotMessages: MinimalChatGPTMessage[] = [\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"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.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user also provides you with a prompt for EDITING some text they are writing. \nYour job is to come up with an EDIT of the text that the user would like to use - AS BEST YOU CAN.\n\nAdjust yourself to the user's style and implied intent.\n\nThe user will provide the following information; use this to infer the best relevant EDIT:\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:\n \"While I was there I also picked up some apples, oranges, and bananas. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"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 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 defaultEditingApiConfig: EditingApiConfig = {\n makeSystemPrompt: defaultEditingMakeSystemPrompt,\n fewShotMessages: defaultEditingFewShotMessages,\n forwardedParams: undefined,\n};\n","import {\n BaseAutosuggestionsConfig,\n defaultBaseAutosuggestionsConfig,\n} from \"../base\";\nimport {\n SuggestionsApiConfig,\n defaultSuggestionsApiConfig,\n} from \"./suggestions-api-config\";\nimport {\n InsertionsApiConfig,\n defaultInsertionsApiConfig,\n} from \"./insertions-api-config\";\nimport { ChatlikeApiEndpoint } from \".\";\nimport {\n EditingApiConfig,\n defaultEditingApiConfig,\n} from \"./editing-api-config\";\n\n// Like the base autosuggestions config, with 2 additional fields:\n// 1. externalContextCategories: string[] | undefined;\n// 2. instead of apiConfigs, we have chatApiConfigs: a higher-level abstraction that uses a ChatGPT-like API endpoint.\nexport interface AutosuggestionsConfig\n extends Omit<BaseAutosuggestionsConfig, \"apiConfig\"> {\n externalContextCategories: string[] | undefined;\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 externalContextCategories: undefined,\n chatApiConfigs: {\n suggestionsApiConfig: defaultSuggestionsApiConfig,\n insertionApiConfig: defaultInsertionsApiConfig,\n editingApiConfig: defaultEditingApiConfig,\n },\n};\n","import {\n CopilotApiConfig,\n copilotApiConfigExtrapolator,\n} from \"@copilotkit/react-core\";\nimport { MinimalChatGPTMessage } from \"./minimal-chat-gpt-message\";\n\nexport type ChatlikeApiEndpointImpl = (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n) => Promise<string>;\n\nexport type StreamingChatlikeApiEndpointImpl = (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n) => Promise<ReadableStream<string>>;\n\nexport class ChatlikeApiEndpoint {\n public run: StreamingChatlikeApiEndpointImpl;\n\n constructor(run: StreamingChatlikeApiEndpointImpl) {\n this.run = run;\n }\n\n /**\n * Creates a new instance of ChatlikeApiEndpoint with the provided API endpoint.\n * @param apiEndpoint The URL of the OpenAI-compatible API endpoint.\n * @returns A new instance of ChatlikeApiEndpoint.\n */\n static fromCopilotApiConfig(\n copilotApiConfig: CopilotApiConfig\n ): ChatlikeApiEndpoint {\n return new ChatlikeApiEndpoint(\n async (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n ) => {\n const res = await fetch(\n copilotApiConfigExtrapolator(copilotApiConfig).chatApiEndpoint,\n {\n method: \"POST\",\n headers: {\n ...copilotApiConfig.headers,\n },\n body: JSON.stringify({\n ...forwardedProps,\n ...copilotApiConfig.body,\n messages: messages,\n }),\n signal: abortSignal,\n }\n );\n\n const bodySteram: ReadableStream<Uint8Array> | null = res.body;\n if (!bodySteram) {\n throw new Error(\"The response body is empty.\");\n }\n\n // map the stream to a stream of strings\n const stringStream = bodySteram.pipeThrough(new TextDecoderStream());\n\n return stringStream;\n }\n );\n }\n\n /**\n * Creates a fully customized instance of ChatlikeApiEndpoint.\n * @param run - The implementation of the ChatlikeApiEndpointImpl interface.\n * @returns A new instance of ChatlikeApiEndpoint .\n */\n static custom(run: StreamingChatlikeApiEndpointImpl): ChatlikeApiEndpoint {\n return new ChatlikeApiEndpoint(run);\n }\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/types/autosuggestions-config/insertions-api-config.tsx
|
|
21
|
+
var insertions_api_config_exports = {};
|
|
22
|
+
__export(insertions_api_config_exports, {
|
|
23
|
+
defaultInsertionsApiConfig: () => defaultInsertionsApiConfig,
|
|
24
|
+
defaultInsertionsFewShotMessages: () => defaultInsertionsFewShotMessages,
|
|
25
|
+
defaultInsertionsMakeSystemPrompt: () => defaultInsertionsMakeSystemPrompt
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(insertions_api_config_exports);
|
|
28
|
+
var defaultInsertionsMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
29
|
+
return `You are a versatile writing assistant.
|
|
30
|
+
|
|
31
|
+
The user is writing some text.
|
|
32
|
+
The purpose is: "${textareaPurpose}"
|
|
33
|
+
|
|
34
|
+
The following external context is also provided. Use it to help you make better suggestions!!!
|
|
35
|
+
\`\`\`
|
|
36
|
+
${contextString}
|
|
37
|
+
\`\`\`
|
|
38
|
+
|
|
39
|
+
The user also provides you with a prompt for INSERTIONS into the text they are writing.
|
|
40
|
+
Your job is to come up with an INSERTION into the text that the user would like AS BEST YOU CAN.
|
|
41
|
+
Only insert a SHORT segment. Usually 1 sentence, or at most 1 paragraph.
|
|
42
|
+
|
|
43
|
+
Adjust yourself to the user's style and implied intent.
|
|
44
|
+
|
|
45
|
+
The 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.
|
|
46
|
+
<TextAfterCursor>
|
|
47
|
+
<TextBeforeCursor>
|
|
48
|
+
<InsertionPrompt>
|
|
49
|
+
<YourSuggestion>
|
|
50
|
+
`;
|
|
51
|
+
};
|
|
52
|
+
var defaultInsertionsFewShotMessages = [
|
|
53
|
+
{
|
|
54
|
+
role: "user",
|
|
55
|
+
name: "TextAfterCursor",
|
|
56
|
+
content: "While I was there I also picked up some apples, oranges, and bananas."
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
role: "user",
|
|
60
|
+
name: "TextBeforeCursor",
|
|
61
|
+
content: "This morning I woke up and went straight to the grocery store."
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
role: "user",
|
|
65
|
+
name: "InsertionPrompt",
|
|
66
|
+
content: "I bought a big watermelon"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
role: "assistant",
|
|
70
|
+
content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
role: "user",
|
|
74
|
+
name: "TextAfterCursor",
|
|
75
|
+
content: "and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof."
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
role: "user",
|
|
79
|
+
name: "TextBeforeCursor",
|
|
80
|
+
content: `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;`
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
role: "user",
|
|
84
|
+
name: "InsertionPrompt",
|
|
85
|
+
content: "add section about the optionholder's pro rata share"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
role: "assistant",
|
|
89
|
+
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"; `
|
|
90
|
+
}
|
|
91
|
+
];
|
|
92
|
+
var defaultInsertionsApiConfig = {
|
|
93
|
+
makeSystemPrompt: defaultInsertionsMakeSystemPrompt,
|
|
94
|
+
fewShotMessages: defaultInsertionsFewShotMessages,
|
|
95
|
+
forwardedParams: void 0
|
|
96
|
+
};
|
|
97
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
98
|
+
0 && (module.exports = {
|
|
99
|
+
defaultInsertionsApiConfig,
|
|
100
|
+
defaultInsertionsFewShotMessages,
|
|
101
|
+
defaultInsertionsMakeSystemPrompt
|
|
102
|
+
});
|
|
103
|
+
//# sourceMappingURL=insertions-api-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/types/autosuggestions-config/insertions-api-config.tsx"],"sourcesContent":["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.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user also provides you with a prompt for INSERTIONS into the text they are writing. \nYour job is to come up with an INSERTION into the text that the user would like 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\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.\n<TextAfterCursor>\n<TextBeforeCursor>\n<InsertionPrompt>\n<YourSuggestion>\n`;\n};\n\nexport const defaultInsertionsFewShotMessages: MinimalChatGPTMessage[] = [\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,oCAAsD,CACjE,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;AAeF;AAEO,IAAM,mCAA4D;AAAA,EACvE;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AACF;AAEO,IAAM,6BAAkD;AAAA,EAC7D,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB;","names":[]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __export = (target, all) => {
|
|
24
|
+
for (var name in all)
|
|
25
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
26
|
+
};
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
+
for (let key of __getOwnPropNames(from))
|
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
31
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
32
|
+
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
+
var __async = (__this, __arguments, generator) => {
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
var fulfilled = (value) => {
|
|
39
|
+
try {
|
|
40
|
+
step(generator.next(value));
|
|
41
|
+
} catch (e) {
|
|
42
|
+
reject(e);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var rejected = (value) => {
|
|
46
|
+
try {
|
|
47
|
+
step(generator.throw(value));
|
|
48
|
+
} catch (e) {
|
|
49
|
+
reject(e);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
53
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// src/types/autosuggestions-config/subtypes/chatlike-api-endpoint.tsx
|
|
58
|
+
var chatlike_api_endpoint_exports = {};
|
|
59
|
+
__export(chatlike_api_endpoint_exports, {
|
|
60
|
+
ChatlikeApiEndpoint: () => ChatlikeApiEndpoint
|
|
61
|
+
});
|
|
62
|
+
module.exports = __toCommonJS(chatlike_api_endpoint_exports);
|
|
63
|
+
var import_react_core = require("@copilotkit/react-core");
|
|
64
|
+
var ChatlikeApiEndpoint = class {
|
|
65
|
+
constructor(run) {
|
|
66
|
+
this.run = run;
|
|
67
|
+
}
|
|
68
|
+
static fromCopilotApiConfig(copilotApiConfig) {
|
|
69
|
+
return new ChatlikeApiEndpoint(
|
|
70
|
+
(abortSignal, messages, forwardedProps) => __async(this, null, function* () {
|
|
71
|
+
const res = yield fetch(
|
|
72
|
+
(0, import_react_core.copilotApiConfigExtrapolator)(copilotApiConfig).chatApiEndpoint,
|
|
73
|
+
{
|
|
74
|
+
method: "POST",
|
|
75
|
+
headers: __spreadValues({}, copilotApiConfig.headers),
|
|
76
|
+
body: JSON.stringify(__spreadProps(__spreadValues(__spreadValues({}, forwardedProps), copilotApiConfig.body), {
|
|
77
|
+
messages
|
|
78
|
+
})),
|
|
79
|
+
signal: abortSignal
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
const bodySteram = res.body;
|
|
83
|
+
if (!bodySteram) {
|
|
84
|
+
throw new Error("The response body is empty.");
|
|
85
|
+
}
|
|
86
|
+
const stringStream = bodySteram.pipeThrough(new TextDecoderStream());
|
|
87
|
+
return stringStream;
|
|
88
|
+
})
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
static custom(run) {
|
|
92
|
+
return new ChatlikeApiEndpoint(run);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
96
|
+
0 && (module.exports = {
|
|
97
|
+
ChatlikeApiEndpoint
|
|
98
|
+
});
|
|
99
|
+
//# sourceMappingURL=chatlike-api-endpoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/types/autosuggestions-config/subtypes/chatlike-api-endpoint.tsx"],"sourcesContent":["import {\n CopilotApiConfig,\n copilotApiConfigExtrapolator,\n} from \"@copilotkit/react-core\";\nimport { MinimalChatGPTMessage } from \"./minimal-chat-gpt-message\";\n\nexport type ChatlikeApiEndpointImpl = (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n) => Promise<string>;\n\nexport type StreamingChatlikeApiEndpointImpl = (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n) => Promise<ReadableStream<string>>;\n\nexport class ChatlikeApiEndpoint {\n public run: StreamingChatlikeApiEndpointImpl;\n\n constructor(run: StreamingChatlikeApiEndpointImpl) {\n this.run = run;\n }\n\n /**\n * Creates a new instance of ChatlikeApiEndpoint with the provided API endpoint.\n * @param apiEndpoint The URL of the OpenAI-compatible API endpoint.\n * @returns A new instance of ChatlikeApiEndpoint.\n */\n static fromCopilotApiConfig(\n copilotApiConfig: CopilotApiConfig\n ): ChatlikeApiEndpoint {\n return new ChatlikeApiEndpoint(\n async (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n ) => {\n const res = await fetch(\n copilotApiConfigExtrapolator(copilotApiConfig).chatApiEndpoint,\n {\n method: \"POST\",\n headers: {\n ...copilotApiConfig.headers,\n },\n body: JSON.stringify({\n ...forwardedProps,\n ...copilotApiConfig.body,\n messages: messages,\n }),\n signal: abortSignal,\n }\n );\n\n const bodySteram: ReadableStream<Uint8Array> | null = res.body;\n if (!bodySteram) {\n throw new Error(\"The response body is empty.\");\n }\n\n // map the stream to a stream of strings\n const stringStream = bodySteram.pipeThrough(new TextDecoderStream());\n\n return stringStream;\n }\n );\n }\n\n /**\n * Creates a fully customized instance of ChatlikeApiEndpoint.\n * @param run - The implementation of the ChatlikeApiEndpointImpl interface.\n * @returns A new instance of ChatlikeApiEndpoint .\n */\n static custom(run: StreamingChatlikeApiEndpointImpl): ChatlikeApiEndpoint {\n return new ChatlikeApiEndpoint(run);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAGO;AAeA,IAAM,sBAAN,MAA0B;AAAA,EAG/B,YAAY,KAAuC;AACjD,SAAK,MAAM;AAAA,EACb;AAAA,EAOA,OAAO,qBACL,kBACqB;AACrB,WAAO,IAAI;AAAA,MACT,CACE,aACA,UACA,mBACG;AACH,cAAM,MAAM,MAAM;AAAA,cAChB,gDAA6B,gBAAgB,EAAE;AAAA,UAC/C;AAAA,YACE,QAAQ;AAAA,YACR,SAAS,mBACJ,iBAAiB;AAAA,YAEtB,MAAM,KAAK,UAAU,gDAChB,iBACA,iBAAiB,OAFD;AAAA,cAGnB;AAAA,YACF,EAAC;AAAA,YACD,QAAQ;AAAA,UACV;AAAA,QACF;AAEA,cAAM,aAAgD,IAAI;AAC1D,YAAI,CAAC,YAAY;AACf,gBAAM,IAAI,MAAM,6BAA6B;AAAA,QAC/C;AAGA,cAAM,eAAe,WAAW,YAAY,IAAI,kBAAkB,CAAC;AAEnE,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAAA,EAOA,OAAO,OAAO,KAA4D;AACxE,WAAO,IAAI,oBAAoB,GAAG;AAAA,EACpC;AACF;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/types/autosuggestions-config/subtypes/make-system-prompt.ts
|
|
17
|
+
var make_system_prompt_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(make_system_prompt_exports);
|
|
19
|
+
//# sourceMappingURL=make-system-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/types/autosuggestions-config/subtypes/make-system-prompt.ts"],"sourcesContent":["export type MakeSystemPrompt = (\n textareaPurpose: string,\n contextString: string\n) => string;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.tsx
|
|
17
|
+
var minimal_chat_gpt_message_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(minimal_chat_gpt_message_exports);
|
|
19
|
+
//# sourceMappingURL=minimal-chat-gpt-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.tsx"],"sourcesContent":["export interface MinimalChatGPTMessage {\n role: string;\n content: string;\n name?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|