@copilotkit/react-textarea 0.16.0 → 0.18.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 +29 -27
- package/CHANGELOG.md +12 -0
- package/dist/{chunk-ZSQLGOES.mjs → chunk-5GGCWNTT.mjs} +5 -5
- package/dist/{chunk-ERPZ5XG5.mjs → chunk-BLRD23HM.mjs} +5 -5
- package/dist/chunk-BLRD23HM.mjs.map +1 -0
- package/dist/{chunk-4ES2IIB6.mjs → chunk-BTAUKCBN.mjs} +4 -4
- package/dist/chunk-BTAUKCBN.mjs.map +1 -0
- package/dist/{chunk-LGK56BTO.mjs → chunk-JWN2VEE3.mjs} +4 -8
- package/dist/chunk-JWN2VEE3.mjs.map +1 -0
- package/dist/{chunk-YFA7S5ER.mjs → chunk-LWVCQYWV.mjs} +2 -2
- package/dist/{chunk-7KWRVIYV.mjs → chunk-MFJNLKRC.mjs} +1 -1
- package/dist/chunk-MFJNLKRC.mjs.map +1 -0
- package/dist/{chunk-IGQI27NI.mjs → chunk-MPME5BW2.mjs} +2 -1
- package/dist/chunk-MPME5BW2.mjs.map +1 -0
- package/dist/chunk-RQHOUUXQ.mjs +29 -0
- package/dist/chunk-RQHOUUXQ.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +5 -5
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.d.ts +3 -2
- package/dist/components/copilot-textarea/copilot-textarea.mjs +8 -8
- package/dist/components/index.mjs +8 -8
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +2 -2
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +2 -2
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +1 -1
- package/dist/index.css +3 -0
- package/dist/index.css.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/lib/slatejs-edits/replace-text.mjs +1 -1
- package/dist/types/base/base-autosuggestions-config.d.ts +2 -2
- package/dist/types/base/base-autosuggestions-config.mjs +1 -1
- package/dist/types/base/base-copilot-textarea-props.d.ts +3 -3
- package/dist/types/base/index.mjs +1 -1
- package/dist/types/index.mjs +2 -2
- package/dist/types/standard-autosuggestions/autosuggestions-config.d.ts +2 -2
- package/dist/types/standard-autosuggestions/autosuggestions-config.mjs +2 -3
- package/dist/types/standard-autosuggestions/index.mjs +2 -2
- package/package.json +1 -1
- package/src/components/base-copilot-textarea/use-add-branding-css.tsx +1 -0
- package/src/components/copilot-textarea/copilot-textarea.tsx +4 -2
- package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +4 -4
- package/src/lib/slatejs-edits/replace-text.ts +21 -29
- package/src/types/base/base-autosuggestions-config.tsx +2 -2
- package/src/types/base/base-copilot-textarea-props.tsx +3 -3
- package/src/types/standard-autosuggestions/autosuggestions-config.tsx +4 -7
- package/dist/chunk-42QG2O6L.mjs +0 -34
- package/dist/chunk-42QG2O6L.mjs.map +0 -1
- package/dist/chunk-4ES2IIB6.mjs.map +0 -1
- package/dist/chunk-7KWRVIYV.mjs.map +0 -1
- package/dist/chunk-ERPZ5XG5.mjs.map +0 -1
- package/dist/chunk-IGQI27NI.mjs.map +0 -1
- package/dist/chunk-LGK56BTO.mjs.map +0 -1
- /package/dist/{chunk-ZSQLGOES.mjs.map → chunk-5GGCWNTT.mjs.map} +0 -0
- /package/dist/{chunk-YFA7S5ER.mjs.map → chunk-LWVCQYWV.mjs.map} +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @copilotkit/react-textarea@0.
|
|
2
|
+
> @copilotkit/react-textarea@0.18.0 build /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/react-textarea
|
|
3
3
|
> tsup --treeshake
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.tsx, src/components/index.ts, src/context/index.ts, src/hooks/index.ts, src/lib/debouncer.ts, src/lib/editor-to-text.ts, src/lib/get-text-around-cursor.ts, src/lib/utils.test.ts, src/lib/utils.ts, src/types/html-copilot-textarea-element.ts, src/types/index.ts, src/components/base-copilot-textarea/base-copilot-textarea.tsx, src/components/base-copilot-textarea/render-element.tsx, src/components/base-copilot-textarea/render-placeholder.tsx, src/components/base-copilot-textarea/use-add-branding-css.tsx, src/components/copilot-textarea/copilot-textarea.tsx, src/hooks/base-copilot-textarea-implementation/use-autosuggestions.ts, src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx, src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts, src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx, src/lib/slatejs-edits/add-autocompletions.ts, src/lib/slatejs-edits/clear-autocompletions.ts, src/lib/slatejs-edits/replace-text.ts, src/lib/slatejs-edits/with-partial-history.ts, src/types/base/autosuggestion-state.ts, src/types/base/autosuggestions-bare-function.ts, src/types/base/base-autosuggestions-config.tsx, src/types/base/base-copilot-textarea-props.tsx, src/types/base/custom-editor.tsx, src/types/base/editor-autocomplete-state.ts, src/types/base/index.ts, src/types/standard-autosuggestions/autosuggestions-config.tsx, src/types/standard-autosuggestions/chatlike-api-endpoint.tsx, src/types/standard-autosuggestions/index.ts, src/types/standard-autosuggestions/minimal-chat-gpt-message.tsx
|
|
@@ -25,12 +25,14 @@ Generated an empty chunk: "chunk-SL4J5HMW".
|
|
|
25
25
|
Generated an empty chunk: "chunk-WJHSY5T6".
|
|
26
26
|
Generated an empty chunk: "chunk-IU3WTXLQ".
|
|
27
27
|
Generated an empty chunk: "chunk-H4VKQGVU".
|
|
28
|
-
[32mESM[39m [1mdist/index.css [22m[
|
|
28
|
+
[32mESM[39m [1mdist/index.css [22m[32m6.03 KB[39m
|
|
29
29
|
[32mESM[39m [1mdist/components/index.css [22m[32m242.00 B[39m
|
|
30
30
|
[32mESM[39m [1mdist/components/base-copilot-textarea/base-copilot-textarea.css [22m[32m258.00 B[39m
|
|
31
31
|
[32mESM[39m [1mdist/components/copilot-textarea/copilot-textarea.css [22m[32m253.00 B[39m
|
|
32
|
-
[32mESM[39m [1mdist/index.css.map [22m[32m12.
|
|
32
|
+
[32mESM[39m [1mdist/index.css.map [22m[32m12.71 KB[39m
|
|
33
33
|
[32mESM[39m [1mdist/components/index.css.map [22m[32m429.00 B[39m
|
|
34
|
+
[32mESM[39m [1mdist/components/base-copilot-textarea/base-copilot-textarea.css.map [22m[32m432.00 B[39m
|
|
35
|
+
[32mESM[39m [1mdist/components/copilot-textarea/copilot-textarea.css.map [22m[32m432.00 B[39m
|
|
34
36
|
[32mESM[39m [1mdist/lib/utils.test.mjs [22m[32m200.00 B[39m
|
|
35
37
|
[32mESM[39m [1mdist/lib/slatejs-edits/add-autocompletions.mjs [22m[32m186.00 B[39m
|
|
36
38
|
[32mESM[39m [1mdist/types/html-copilot-textarea-element.mjs [22m[32m122.00 B[39m
|
|
@@ -41,7 +43,7 @@ Generated an empty chunk: "chunk-H4VKQGVU".
|
|
|
41
43
|
[32mESM[39m [1mdist/chunk-MMVDU6DF.mjs [22m[32m76.00 B[39m
|
|
42
44
|
[32mESM[39m [1mdist/chunk-SL4J5HMW.mjs [22m[32m76.00 B[39m
|
|
43
45
|
[32mESM[39m [1mdist/chunk-WJHSY5T6.mjs [22m[32m76.00 B[39m
|
|
44
|
-
[32mESM[39m [1mdist/chunk-
|
|
46
|
+
[32mESM[39m [1mdist/chunk-MFJNLKRC.mjs [22m[32m314.00 B[39m
|
|
45
47
|
[32mESM[39m [1mdist/chunk-IU3WTXLQ.mjs [22m[32m76.00 B[39m
|
|
46
48
|
[32mESM[39m [1mdist/chunk-H4VKQGVU.mjs [22m[32m76.00 B[39m
|
|
47
49
|
[32mESM[39m [1mdist/chunk-MRXNTQOX.mjs [22m[32m1.92 KB[39m
|
|
@@ -57,30 +59,28 @@ Generated an empty chunk: "chunk-H4VKQGVU".
|
|
|
57
59
|
[32mESM[39m [1mdist/components/copilot-textarea/copilot-textarea.mjs [22m[32m907.00 B[39m
|
|
58
60
|
[32mESM[39m [1mdist/index.mjs [22m[32m1.12 KB[39m
|
|
59
61
|
[32mESM[39m [1mdist/components/index.mjs [22m[32m888.00 B[39m
|
|
60
|
-
[32mESM[39m [1mdist/chunk-
|
|
61
|
-
[32mESM[39m [1mdist/chunk-
|
|
62
|
-
[32mESM[39m [1mdist/chunk-LGK56BTO.mjs [22m[32m2.86 KB[39m
|
|
62
|
+
[32mESM[39m [1mdist/chunk-BLRD23HM.mjs [22m[32m1.23 KB[39m
|
|
63
|
+
[32mESM[39m [1mdist/chunk-BTAUKCBN.mjs [22m[32m1.77 KB[39m
|
|
63
64
|
[32mESM[39m [1mdist/chunk-3A2CNIG5.mjs [22m[32m949.00 B[39m
|
|
64
|
-
[32mESM[39m [1mdist/chunk-
|
|
65
|
+
[32mESM[39m [1mdist/chunk-JWN2VEE3.mjs [22m[32m2.72 KB[39m
|
|
66
|
+
[32mESM[39m [1mdist/chunk-5GGCWNTT.mjs [22m[32m6.02 KB[39m
|
|
65
67
|
[32mESM[39m [1mdist/chunk-HZGSG7ST.mjs [22m[32m3.02 KB[39m
|
|
66
68
|
[32mESM[39m [1mdist/chunk-UW3ITU2Y.mjs [22m[32m496.00 B[39m
|
|
67
69
|
[32mESM[39m [1mdist/chunk-CSGFJU3L.mjs [22m[32m2.01 KB[39m
|
|
68
|
-
[32mESM[39m [1mdist/chunk-
|
|
70
|
+
[32mESM[39m [1mdist/chunk-LWVCQYWV.mjs [22m[32m2.57 KB[39m
|
|
69
71
|
[32mESM[39m [1mdist/chunk-WJYQWL4I.mjs [22m[32m595.00 B[39m
|
|
70
72
|
[32mESM[39m [1mdist/chunk-F3MHL6ZY.mjs [22m[32m680.00 B[39m
|
|
71
|
-
[32mESM[39m [1mdist/chunk-
|
|
73
|
+
[32mESM[39m [1mdist/chunk-RQHOUUXQ.mjs [22m[32m594.00 B[39m
|
|
72
74
|
[32mESM[39m [1mdist/chunk-KCHYD3EB.mjs [22m[32m3.08 KB[39m
|
|
73
75
|
[32mESM[39m [1mdist/chunk-KGKLUWKW.mjs [22m[32m1.37 KB[39m
|
|
74
76
|
[32mESM[39m [1mdist/chunk-LNAIMEB2.mjs [22m[32m1.09 KB[39m
|
|
75
77
|
[32mESM[39m [1mdist/chunk-OELUUJZY.mjs [22m[32m625.00 B[39m
|
|
76
|
-
[32mESM[39m [1mdist/chunk-
|
|
78
|
+
[32mESM[39m [1mdist/chunk-MPME5BW2.mjs [22m[32m2.16 KB[39m
|
|
77
79
|
[32mESM[39m [1mdist/lib/debouncer.mjs [22m[32m153.00 B[39m
|
|
78
80
|
[32mESM[39m [1mdist/chunk-NKW5OU2S.mjs [22m[32m959.00 B[39m
|
|
79
81
|
[32mESM[39m [1mdist/lib/editor-to-text.mjs [22m[32m1.34 KB[39m
|
|
80
82
|
[32mESM[39m [1mdist/lib/get-text-around-cursor.mjs [22m[32m232.00 B[39m
|
|
81
83
|
[32mESM[39m [1mdist/chunk-3UQM3NLM.mjs [22m[32m1.76 KB[39m
|
|
82
|
-
[32mESM[39m [1mdist/components/base-copilot-textarea/base-copilot-textarea.css.map [22m[32m432.00 B[39m
|
|
83
|
-
[32mESM[39m [1mdist/components/copilot-textarea/copilot-textarea.css.map [22m[32m432.00 B[39m
|
|
84
84
|
[32mESM[39m [1mdist/types/standard-autosuggestions/minimal-chat-gpt-message.mjs [22m[32m86.00 B[39m
|
|
85
85
|
[32mESM[39m [1mdist/types/base/autosuggestion-state.mjs [22m[32m82.00 B[39m
|
|
86
86
|
[32mESM[39m [1mdist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs [22m[32m283.00 B[39m
|
|
@@ -93,7 +93,7 @@ Generated an empty chunk: "chunk-H4VKQGVU".
|
|
|
93
93
|
[32mESM[39m [1mdist/types/base/base-autosuggestions-config.mjs [22m[32m200.00 B[39m
|
|
94
94
|
[32mESM[39m [1mdist/types/base/editor-autocomplete-state.mjs [22m[32m227.00 B[39m
|
|
95
95
|
[32mESM[39m [1mdist/types/base/index.mjs [22m[32m213.00 B[39m
|
|
96
|
-
[32mESM[39m [1mdist/types/standard-autosuggestions/autosuggestions-config.mjs [22m[
|
|
96
|
+
[32mESM[39m [1mdist/types/standard-autosuggestions/autosuggestions-config.mjs [22m[32m310.00 B[39m
|
|
97
97
|
[32mESM[39m [1mdist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs [22m[32m227.00 B[39m
|
|
98
98
|
[32mESM[39m [1mdist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs [22m[32m273.00 B[39m
|
|
99
99
|
[32mESM[39m [1mdist/lib/utils.test.mjs.map [22m[32m349.00 B[39m
|
|
@@ -106,7 +106,7 @@ Generated an empty chunk: "chunk-H4VKQGVU".
|
|
|
106
106
|
[32mESM[39m [1mdist/chunk-MMVDU6DF.mjs.map [22m[32m51.00 B[39m
|
|
107
107
|
[32mESM[39m [1mdist/chunk-SL4J5HMW.mjs.map [22m[32m51.00 B[39m
|
|
108
108
|
[32mESM[39m [1mdist/chunk-WJHSY5T6.mjs.map [22m[32m51.00 B[39m
|
|
109
|
-
[32mESM[39m [1mdist/chunk-
|
|
109
|
+
[32mESM[39m [1mdist/chunk-MFJNLKRC.mjs.map [22m[32m627.00 B[39m
|
|
110
110
|
[32mESM[39m [1mdist/chunk-IU3WTXLQ.mjs.map [22m[32m51.00 B[39m
|
|
111
111
|
[32mESM[39m [1mdist/chunk-H4VKQGVU.mjs.map [22m[32m51.00 B[39m
|
|
112
112
|
[32mESM[39m [1mdist/chunk-MRXNTQOX.mjs.map [22m[32m71.00 B[39m
|
|
@@ -122,23 +122,23 @@ Generated an empty chunk: "chunk-H4VKQGVU".
|
|
|
122
122
|
[32mESM[39m [1mdist/components/copilot-textarea/copilot-textarea.mjs.map [22m[32m51.00 B[39m
|
|
123
123
|
[32mESM[39m [1mdist/index.mjs.map [22m[32m51.00 B[39m
|
|
124
124
|
[32mESM[39m [1mdist/components/index.mjs.map [22m[32m51.00 B[39m
|
|
125
|
-
[32mESM[39m [1mdist/chunk-
|
|
126
|
-
[32mESM[39m [1mdist/chunk-
|
|
127
|
-
[32mESM[39m [1mdist/chunk-LGK56BTO.mjs.map [22m[32m4.17 KB[39m
|
|
125
|
+
[32mESM[39m [1mdist/chunk-BLRD23HM.mjs.map [22m[32m2.23 KB[39m
|
|
126
|
+
[32mESM[39m [1mdist/chunk-BTAUKCBN.mjs.map [22m[32m4.42 KB[39m
|
|
128
127
|
[32mESM[39m [1mdist/chunk-3A2CNIG5.mjs.map [22m[32m2.15 KB[39m
|
|
129
|
-
[32mESM[39m [1mdist/chunk-
|
|
128
|
+
[32mESM[39m [1mdist/chunk-JWN2VEE3.mjs.map [22m[32m4.06 KB[39m
|
|
129
|
+
[32mESM[39m [1mdist/chunk-5GGCWNTT.mjs.map [22m[32m10.79 KB[39m
|
|
130
130
|
[32mESM[39m [1mdist/chunk-HZGSG7ST.mjs.map [22m[32m5.83 KB[39m
|
|
131
131
|
[32mESM[39m [1mdist/chunk-UW3ITU2Y.mjs.map [22m[32m878.00 B[39m
|
|
132
132
|
[32mESM[39m [1mdist/chunk-CSGFJU3L.mjs.map [22m[32m3.82 KB[39m
|
|
133
|
-
[32mESM[39m [1mdist/chunk-
|
|
133
|
+
[32mESM[39m [1mdist/chunk-LWVCQYWV.mjs.map [22m[32m4.80 KB[39m
|
|
134
134
|
[32mESM[39m [1mdist/chunk-WJYQWL4I.mjs.map [22m[32m1.04 KB[39m
|
|
135
135
|
[32mESM[39m [1mdist/chunk-F3MHL6ZY.mjs.map [22m[32m1.14 KB[39m
|
|
136
|
-
[32mESM[39m [1mdist/chunk-
|
|
136
|
+
[32mESM[39m [1mdist/chunk-RQHOUUXQ.mjs.map [22m[32m1.12 KB[39m
|
|
137
137
|
[32mESM[39m [1mdist/chunk-KCHYD3EB.mjs.map [22m[32m6.12 KB[39m
|
|
138
138
|
[32mESM[39m [1mdist/chunk-KGKLUWKW.mjs.map [22m[32m2.45 KB[39m
|
|
139
139
|
[32mESM[39m [1mdist/chunk-LNAIMEB2.mjs.map [22m[32m1.73 KB[39m
|
|
140
140
|
[32mESM[39m [1mdist/chunk-OELUUJZY.mjs.map [22m[32m957.00 B[39m
|
|
141
|
-
[32mESM[39m [1mdist/chunk-
|
|
141
|
+
[32mESM[39m [1mdist/chunk-MPME5BW2.mjs.map [22m[32m3.48 KB[39m
|
|
142
142
|
[32mESM[39m [1mdist/lib/debouncer.mjs.map [22m[32m51.00 B[39m
|
|
143
143
|
[32mESM[39m [1mdist/chunk-NKW5OU2S.mjs.map [22m[32m1.60 KB[39m
|
|
144
144
|
[32mESM[39m [1mdist/lib/editor-to-text.mjs.map [22m[32m2.83 KB[39m
|
|
@@ -159,20 +159,22 @@ Generated an empty chunk: "chunk-H4VKQGVU".
|
|
|
159
159
|
[32mESM[39m [1mdist/types/standard-autosuggestions/autosuggestions-config.mjs.map [22m[32m51.00 B[39m
|
|
160
160
|
[32mESM[39m [1mdist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map [22m[32m51.00 B[39m
|
|
161
161
|
[32mESM[39m [1mdist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map [22m[32m51.00 B[39m
|
|
162
|
-
[32mESM[39m ⚡️ Build success in
|
|
162
|
+
[32mESM[39m ⚡️ Build success in 2581ms
|
|
163
163
|
Export "AutosuggestionsConfig" of module "src/types/standard-autosuggestions/autosuggestions-config.tsx" was reexported through module "src/types/standard-autosuggestions/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
|
|
164
164
|
Either change the import in "src/components/copilot-textarea/copilot-textarea.tsx" to point directly to the exporting module or do not use "preserveModules" to ensure these modules end up in the same chunk.
|
|
165
|
+
Export "ChatlikeApiEndpoint" of module "src/types/standard-autosuggestions/chatlike-api-endpoint.tsx" was reexported through module "src/types/standard-autosuggestions/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
|
|
166
|
+
Either change the import in "src/components/copilot-textarea/copilot-textarea.tsx" to point directly to the exporting module or do not use "preserveModules" to ensure these modules end up in the same chunk.
|
|
165
167
|
Export "MakeSystemPrompt" of module "src/types/standard-autosuggestions/autosuggestions-config.tsx" was reexported through module "src/types/standard-autosuggestions/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
|
|
166
168
|
Either change the import in "src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx" to point directly to the exporting module or do not use "preserveModules" to ensure these modules end up in the same chunk.
|
|
167
|
-
[32mDTS[39m ⚡️ Build success in
|
|
169
|
+
[32mDTS[39m ⚡️ Build success in 4989ms
|
|
168
170
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.01 KB[39m
|
|
169
171
|
[32mDTS[39m [1mdist/components/base-copilot-textarea/base-copilot-textarea.d.ts [22m[32m669.00 B[39m
|
|
170
|
-
[32mDTS[39m [1mdist/components/copilot-textarea/copilot-textarea.d.ts [22m[
|
|
171
|
-
[32mDTS[39m [1mdist/types/base/base-autosuggestions-config.d.ts [22m[
|
|
172
|
+
[32mDTS[39m [1mdist/components/copilot-textarea/copilot-textarea.d.ts [22m[32m948.00 B[39m
|
|
173
|
+
[32mDTS[39m [1mdist/types/base/base-autosuggestions-config.d.ts [22m[32m359.00 B[39m
|
|
172
174
|
[32mDTS[39m [1mdist/types/base/autosuggestions-bare-function.d.ts [22m[32m162.00 B[39m
|
|
173
175
|
[32mDTS[39m [1mdist/types/base/base-copilot-textarea-props.d.ts [22m[32m1.89 KB[39m
|
|
174
176
|
[32mDTS[39m [1mdist/types/html-copilot-textarea-element.d.ts [22m[32m165.00 B[39m
|
|
175
|
-
[32mDTS[39m [1mdist/types/standard-autosuggestions/autosuggestions-config.d.ts [22m[
|
|
177
|
+
[32mDTS[39m [1mdist/types/standard-autosuggestions/autosuggestions-config.d.ts [22m[32m983.00 B[39m
|
|
176
178
|
[32mDTS[39m [1mdist/types/standard-autosuggestions/minimal-chat-gpt-message.d.ts [22m[32m129.00 B[39m
|
|
177
179
|
[32mDTS[39m [1mdist/types/standard-autosuggestions/chatlike-api-endpoint.d.ts [22m[32m1004.00 B[39m
|
|
178
180
|
[32mDTS[39m [1mdist/components/index.d.ts [22m[32m630.00 B[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useAutosuggestions } from './chunk-HZGSG7ST.mjs';
|
|
2
2
|
import { useCopilotTextareaEditor } from './chunk-CSGFJU3L.mjs';
|
|
3
|
-
import { usePopulateCopilotTextareaRef } from './chunk-
|
|
3
|
+
import { usePopulateCopilotTextareaRef } from './chunk-LWVCQYWV.mjs';
|
|
4
4
|
import { addAutocompletionsToEditor } from './chunk-WJYQWL4I.mjs';
|
|
5
5
|
import { clearAutocompletionsFromEditor } from './chunk-F3MHL6ZY.mjs';
|
|
6
|
-
import { replaceEditorText } from './chunk-
|
|
7
|
-
import { defaultBaseAutosuggestionsConfig } from './chunk-
|
|
6
|
+
import { replaceEditorText } from './chunk-RQHOUUXQ.mjs';
|
|
7
|
+
import { defaultBaseAutosuggestionsConfig } from './chunk-MFJNLKRC.mjs';
|
|
8
8
|
import { makeRenderElementFunction } from './chunk-LNAIMEB2.mjs';
|
|
9
9
|
import { makeRenderPlaceholderFunction } from './chunk-OELUUJZY.mjs';
|
|
10
|
-
import { useAddBrandingCss } from './chunk-
|
|
10
|
+
import { useAddBrandingCss } from './chunk-MPME5BW2.mjs';
|
|
11
11
|
import { getTextAroundCursor, getFullEditorTextWithNewlines } from './chunk-3UQM3NLM.mjs';
|
|
12
12
|
import { __spreadValues, __objRest } from './chunk-MRXNTQOX.mjs';
|
|
13
13
|
import React, { useMemo, useState, useCallback, useEffect } from 'react';
|
|
@@ -160,4 +160,4 @@ function makeSemiFakeReactTextAreaEvent(currentText) {
|
|
|
160
160
|
|
|
161
161
|
export { BaseCopilotTextarea };
|
|
162
162
|
//# sourceMappingURL=out.js.map
|
|
163
|
-
//# sourceMappingURL=chunk-
|
|
163
|
+
//# sourceMappingURL=chunk-5GGCWNTT.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useMakeStandardAutosuggestionFunction } from './chunk-
|
|
2
|
-
import { defaultAutosuggestionsConfig } from './chunk-
|
|
3
|
-
import { BaseCopilotTextarea } from './chunk-
|
|
1
|
+
import { useMakeStandardAutosuggestionFunction } from './chunk-BTAUKCBN.mjs';
|
|
2
|
+
import { defaultAutosuggestionsConfig } from './chunk-JWN2VEE3.mjs';
|
|
3
|
+
import { BaseCopilotTextarea } from './chunk-5GGCWNTT.mjs';
|
|
4
4
|
import { __spreadValues, __spreadProps } from './chunk-MRXNTQOX.mjs';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -9,7 +9,7 @@ var CopilotTextarea = React.forwardRef(
|
|
|
9
9
|
(props, ref) => {
|
|
10
10
|
const autosuggestionsConfig = __spreadValues(__spreadValues({}, defaultAutosuggestionsConfig), props.autosuggestionsConfig);
|
|
11
11
|
const autosuggestionsFunction = useMakeStandardAutosuggestionFunction(
|
|
12
|
-
autosuggestionsConfig.
|
|
12
|
+
autosuggestionsConfig.textareaPurpose,
|
|
13
13
|
autosuggestionsConfig.apiEndpoint,
|
|
14
14
|
autosuggestionsConfig.makeSystemPrompt,
|
|
15
15
|
autosuggestionsConfig.fewShotMessages,
|
|
@@ -29,4 +29,4 @@ var CopilotTextarea = React.forwardRef(
|
|
|
29
29
|
|
|
30
30
|
export { CopilotTextarea };
|
|
31
31
|
//# sourceMappingURL=out.js.map
|
|
32
|
-
//# sourceMappingURL=chunk-
|
|
32
|
+
//# sourceMappingURL=chunk-BLRD23HM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/copilot-textarea/copilot-textarea.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,OAAO,WAAW;AAsCZ,mBACE,WADF;AApBC,IAAM,kBAAkB,MAAM;AAAA,EACnC,CACE,OACA,QACgB;AAChB,UAAM,wBAA+C,kCAChD,+BACA,MAAM;AAGX,UAAM,0BAA0B;AAAA,MAC9B,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,IACxB;AAEA,WACE;AAAA,MACE,8BAAC;AAAA,QACC;AAAA,SACI,QAFL;AAAA,QAGC;AAAA,QACA;AAAA,QACF;AAAA,KACF;AAAA,EAEJ;AACF","sourcesContent":["// This example is for an Editor with `ReactEditor` and `HistoryEditor`\nimport React from \"react\";\nimport { useMakeStandardAutosuggestionFunction } from \"../../hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function\";\nimport { HTMLCopilotTextAreaElement } from \"../../types\";\nimport { BaseCopilotTextareaProps } from \"../../types/base/base-copilot-textarea-props\";\nimport {\n AutosuggestionsConfig,\n ChatlikeApiEndpoint,\n defaultAutosuggestionsConfig,\n} from \"../../types/standard-autosuggestions\";\nimport { BaseCopilotTextarea } from \"../base-copilot-textarea/base-copilot-textarea\";\n\nexport interface CopilotTextareaProps extends BaseCopilotTextareaProps {\n autosuggestionsConfig: Partial<AutosuggestionsConfig> & {\n textareaPurpose: string;\n apiEndpoint: ChatlikeApiEndpoint;\n };\n}\n\nexport const CopilotTextarea = React.forwardRef(\n (\n props: CopilotTextareaProps,\n ref: React.Ref<HTMLCopilotTextAreaElement>\n ): JSX.Element => {\n const autosuggestionsConfig: AutosuggestionsConfig = {\n ...defaultAutosuggestionsConfig,\n ...props.autosuggestionsConfig,\n };\n\n const autosuggestionsFunction = useMakeStandardAutosuggestionFunction(\n autosuggestionsConfig.textareaPurpose,\n autosuggestionsConfig.apiEndpoint,\n autosuggestionsConfig.makeSystemPrompt,\n autosuggestionsConfig.fewShotMessages,\n autosuggestionsConfig.externalContextCategories,\n autosuggestionsConfig.forwardedParams\n );\n\n return (\n <>\n <BaseCopilotTextarea\n ref={ref}\n {...props}\n autosuggestionsConfig={autosuggestionsConfig}\n autosuggestionsFunction={autosuggestionsFunction}\n />\n </>\n );\n }\n);\n"]}
|
|
@@ -2,7 +2,7 @@ import { __async } from './chunk-MRXNTQOX.mjs';
|
|
|
2
2
|
import { CopilotContext } from '@copilotkit/react-core';
|
|
3
3
|
import { useContext, useCallback } from 'react';
|
|
4
4
|
|
|
5
|
-
function useMakeStandardAutosuggestionFunction(
|
|
5
|
+
function useMakeStandardAutosuggestionFunction(textareaPurpose, apiEndpoint, makeSystemPrompt, fewShotMessages, contextCategories, forwardedProps) {
|
|
6
6
|
const { getContextString } = useContext(CopilotContext);
|
|
7
7
|
return useCallback(
|
|
8
8
|
(beforeText, afterText, abortSignal) => __async(this, null, function* () {
|
|
@@ -11,7 +11,7 @@ function useMakeStandardAutosuggestionFunction(purposePrompt, apiEndpoint, makeS
|
|
|
11
11
|
{
|
|
12
12
|
role: "system",
|
|
13
13
|
content: makeSystemPrompt(
|
|
14
|
-
|
|
14
|
+
textareaPurpose,
|
|
15
15
|
getContextString(contextCategories)
|
|
16
16
|
)
|
|
17
17
|
},
|
|
@@ -37,7 +37,7 @@ function useMakeStandardAutosuggestionFunction(purposePrompt, apiEndpoint, makeS
|
|
|
37
37
|
fewShotMessages,
|
|
38
38
|
getContextString,
|
|
39
39
|
contextCategories,
|
|
40
|
-
|
|
40
|
+
textareaPurpose
|
|
41
41
|
]
|
|
42
42
|
);
|
|
43
43
|
}
|
|
@@ -57,4 +57,4 @@ function retry(fn, retriesLeft = 2, interval = 200, backoff = 1.5) {
|
|
|
57
57
|
|
|
58
58
|
export { useMakeStandardAutosuggestionFunction };
|
|
59
59
|
//# sourceMappingURL=out.js.map
|
|
60
|
-
//# sourceMappingURL=chunk-
|
|
60
|
+
//# sourceMappingURL=chunk-BTAUKCBN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx"],"names":[],"mappings":";;;;;AAAA,SAAS,sBAAsB;AAC/B,SAAS,aAAa,kBAAkB;AAoBjC,SAAS,sCACd,iBACA,aACA,kBACA,iBACA,mBACA,gBAC6B;AAC7B,QAAM,EAAE,iBAAiB,IAAI,WAAW,cAAc;AAEtD,SAAO;AAAA,IACL,CAAO,YAAoB,WAAmB,gBAA6B;AACzE,YAAM,MAAM,MAAM,MAAM,MAAY;AAClC,cAAM,WAAoC;AAAA,UACxC;AAAA,YACE,MAAM;AAAA,YACN,SAAS;AAAA,cACP;AAAA,cACA,iBAAiB,iBAAiB;AAAA,YACpC;AAAA,UACF;AAAA,UACA,GAAG;AAAA,UACH;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS;AAAA,UACX;AAAA,UACA;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS;AAAA,UACX;AAAA,QACF;AAEA,eAAO,MAAM,YAAY,IAAI,aAAa,UAAU,cAAc;AAAA,MACpE,EAAC;AAED,aAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,MACP,IACA,cAAsB,GACtB,WAAmB,KACnB,UAAkB,KACN;AACZ,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,OAAG,EACA,KAAK,OAAO,EACZ,MAAM,CAAC,UAAU;AAChB,UAAI,gBAAgB,GAAG;AACrB,eAAO,KAAK;AACZ;AAAA,MACF;AAEA,iBAAW,MAAM;AACf,cAAM,IAAI,cAAc,GAAG,WAAW,SAAS,OAAO,EACnD,KAAK,OAAO,EACZ,MAAM,MAAM;AAAA,MACjB,GAAG,QAAQ;AAAA,IACb,CAAC;AAAA,EACL,CAAC;AACH","sourcesContent":["import { CopilotContext } from \"@copilotkit/react-core\";\nimport { useCallback, useContext } from \"react\";\nimport {\n AutosuggestionsBareFunction,\n MakeSystemPrompt,\n MinimalChatGPTMessage,\n} from \"../../types\";\nimport { ChatlikeApiEndpoint } from \"../../types/standard-autosuggestions/chatlike-api-endpoint\";\n/**\n * Returns a memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.\n * The function takes in the text before and after the cursor, and an abort signal.\n * It sends a POST request to the API endpoint with the messages array containing the system message, few shot messages, and user messages.\n * The function returns the suggestion from the API response.\n *\n * @param textareaPurpose - The purpose of the textarea. This is included in the system message.\n * @param apiEndpoint - The API endpoint to send the autosuggestion request to.\n * @param makeSystemMessage - A function that takes in a context string and returns a system message to include in the autosuggestion request.\n * @param fewShotMessages - An array of few shot messages to include in the autosuggestion request.\n * @param contextCategories - The categories of context strings we want to include. By default, we include the (default) \"global\" context category.\n * @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.\n */\nexport function useMakeStandardAutosuggestionFunction(\n textareaPurpose: string,\n apiEndpoint: ChatlikeApiEndpoint,\n makeSystemPrompt: MakeSystemPrompt,\n fewShotMessages: MinimalChatGPTMessage[],\n contextCategories: string[] | undefined,\n forwardedProps?: { [key: string]: any }\n): AutosuggestionsBareFunction {\n const { getContextString } = useContext(CopilotContext);\n\n return useCallback(\n async (beforeText: string, afterText: string, abortSignal: AbortSignal) => {\n const res = await retry(async () => {\n const messages: MinimalChatGPTMessage[] = [\n {\n role: \"system\",\n content: makeSystemPrompt(\n textareaPurpose,\n getContextString(contextCategories)\n ),\n },\n ...fewShotMessages,\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: afterText,\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: beforeText,\n },\n ];\n\n return await apiEndpoint.run(abortSignal, messages, forwardedProps);\n });\n\n return res;\n },\n [\n apiEndpoint,\n makeSystemPrompt,\n fewShotMessages,\n getContextString,\n contextCategories,\n textareaPurpose,\n ]\n );\n}\n\nfunction retry<T>(\n fn: () => Promise<T>,\n retriesLeft: number = 2,\n interval: number = 200,\n backoff: number = 1.5\n): Promise<T> {\n return new Promise((resolve, reject) => {\n fn()\n .then(resolve)\n .catch((error) => {\n if (retriesLeft === 1) {\n reject(error);\n return;\n }\n\n setTimeout(() => {\n retry(fn, retriesLeft - 1, interval * backoff, backoff)\n .then(resolve)\n .catch(reject);\n }, interval);\n });\n });\n}\n"]}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { defaultBaseAutosuggestionsConfig } from './chunk-7KWRVIYV.mjs';
|
|
1
|
+
import { defaultBaseAutosuggestionsConfig } from './chunk-MFJNLKRC.mjs';
|
|
3
2
|
import { __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
4
3
|
|
|
5
4
|
// src/types/standard-autosuggestions/autosuggestions-config.tsx
|
|
6
|
-
var defaultMakeSystemPrompt = (
|
|
5
|
+
var defaultMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
7
6
|
return `You are a versatile writing assistant.
|
|
8
7
|
|
|
9
8
|
The user is writing some text.
|
|
10
|
-
The purpose is: "${
|
|
9
|
+
The purpose is: "${textareaPurpose}"
|
|
11
10
|
|
|
12
11
|
Your job is to guess what the user will write next AS BEST YOU CAN.
|
|
13
12
|
Only guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.
|
|
@@ -58,9 +57,6 @@ var defaultFewShotMessages = [
|
|
|
58
57
|
}
|
|
59
58
|
];
|
|
60
59
|
var defaultAutosuggestionsConfig = __spreadProps(__spreadValues({}, defaultBaseAutosuggestionsConfig), {
|
|
61
|
-
apiEndpoint: ChatlikeApiEndpoint.standardOpenAIEndpoint(
|
|
62
|
-
"api/autosuggestions"
|
|
63
|
-
),
|
|
64
60
|
makeSystemPrompt: defaultMakeSystemPrompt,
|
|
65
61
|
fewShotMessages: defaultFewShotMessages,
|
|
66
62
|
externalContextCategories: void 0,
|
|
@@ -69,4 +65,4 @@ var defaultAutosuggestionsConfig = __spreadProps(__spreadValues({}, defaultBaseA
|
|
|
69
65
|
|
|
70
66
|
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt };
|
|
71
67
|
//# sourceMappingURL=out.js.map
|
|
72
|
-
//# sourceMappingURL=chunk-
|
|
68
|
+
//# sourceMappingURL=chunk-JWN2VEE3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/standard-autosuggestions/autosuggestions-config.tsx"],"names":[],"mappings":";;;;;;;;;AAoBO,IAAM,0BAA4C,CACvD,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBlB;AAAA;AAAA;AAGF;AAEO,IAAM,yBAAkD;AAAA,EAC7D;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;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,SACE;AAAA,EACJ;AACF;AACO,IAAM,+BAGT,iCACC,mCADD;AAAA,EAGF,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,2BAA2B;AAAA,EAC3B,iBAAiB;AACnB","sourcesContent":["import {\n BaseAutosuggestionsConfig,\n defaultBaseAutosuggestionsConfig,\n} from \"../base\";\nimport { ChatlikeApiEndpoint } from \"./chatlike-api-endpoint\";\nimport { MinimalChatGPTMessage } from \"./minimal-chat-gpt-message\";\n\nexport type MakeSystemPrompt = (\n textareaPurpose: string,\n contextString: string\n) => string;\n\nexport interface AutosuggestionsConfig extends BaseAutosuggestionsConfig {\n apiEndpoint: ChatlikeApiEndpoint;\n externalContextCategories: string[] | undefined;\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: MinimalChatGPTMessage[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultMakeSystemPrompt: 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 defaultFewShotMessages: 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: \"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];\nexport const defaultAutosuggestionsConfig: Omit<\n AutosuggestionsConfig,\n \"textareaPurpose\" | \"apiEndpoint\"\n> = {\n ...defaultBaseAutosuggestionsConfig,\n\n makeSystemPrompt: defaultMakeSystemPrompt,\n fewShotMessages: defaultFewShotMessages,\n externalContextCategories: undefined,\n forwardedParams: undefined,\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { replaceEditorText } from './chunk-
|
|
1
|
+
import { replaceEditorText } from './chunk-RQHOUUXQ.mjs';
|
|
2
2
|
import { getFullEditorTextWithNewlines } from './chunk-3UQM3NLM.mjs';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { ReactEditor } from 'slate-react';
|
|
@@ -80,4 +80,4 @@ function usePopulateCopilotTextareaRef(editor, ref) {
|
|
|
80
80
|
|
|
81
81
|
export { usePopulateCopilotTextareaRef };
|
|
82
82
|
//# sourceMappingURL=out.js.map
|
|
83
|
-
//# sourceMappingURL=chunk-
|
|
83
|
+
//# sourceMappingURL=chunk-LWVCQYWV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/base/base-autosuggestions-config.tsx"],"names":[],"mappings":";AAQO,IAAM,mCAGT;AAAA,EACF,cAAc;AAAA,EACd,yBAAyB;AAAA,EACzB,kBAAkB;AAAA,EAClB,UAAU;AACZ","sourcesContent":["export interface BaseAutosuggestionsConfig {\n textareaPurpose: string;\n debounceTime: number;\n acceptAutosuggestionKey: string;\n disableWhenEmpty: boolean;\n disabled: boolean;\n}\n\nexport const defaultBaseAutosuggestionsConfig: Omit<\n BaseAutosuggestionsConfig,\n \"textareaPurpose\"\n> = {\n debounceTime: 500,\n acceptAutosuggestionKey: \"Tab\",\n disableWhenEmpty: true,\n disabled: false,\n};\n"]}
|
|
@@ -23,6 +23,7 @@ function useAddBrandingCss(suggestionStyleAugmented, disableBranding) {
|
|
|
23
23
|
dynamicStyles += `margin: 0;`;
|
|
24
24
|
dynamicStyles += `border: 0;`;
|
|
25
25
|
dynamicStyles += `line-height: 1;`;
|
|
26
|
+
dynamicStyles += `position: absolute;`;
|
|
26
27
|
styleEl.innerHTML = `
|
|
27
28
|
${cssSelector}::after {
|
|
28
29
|
${dynamicStyles}
|
|
@@ -55,4 +56,4 @@ function useAddBrandingCss(suggestionStyleAugmented, disableBranding) {
|
|
|
55
56
|
|
|
56
57
|
export { useAddBrandingCss };
|
|
57
58
|
//# sourceMappingURL=out.js.map
|
|
58
|
-
//# sourceMappingURL=chunk-
|
|
59
|
+
//# sourceMappingURL=chunk-MPME5BW2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/base-copilot-textarea/use-add-branding-css.tsx"],"names":["styleEl"],"mappings":";AAAA,SAAS,iBAAiB;AAEnB,SAAS,kBACd,0BACA,iBACA;AACA,QAAM,cAAc;AACpB,YAAU,MAAM;AACd,QAAI,iBAAiB;AACnB;AAAA,IACF;AAIA,UAAM,UAAU,SAAS,cAAc,OAAO;AAC9C,YAAQ,KAAK;AAGb,QAAI,gBAAgB,OAAO,QAAQ,wBAAwB,EACxD,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AACrB,YAAM,eAAe,IAClB,QAAQ,gCAAgC,OAAO,EAC/C,YAAY;AACf,aAAO,GAAG,iBAAiB;AAAA,IAC7B,CAAC,EACA,KAAK,GAAG;AAGX,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AAGjB,YAAQ,YAAY;AAAA,QAChB;AAAA,UACE;AAAA;AAAA;AAIN,aAAS,KAAK,YAAY,OAAO;AAIjC,UAAM,WAAW,SAAS,cAAc,WAAW;AACnD,UAAM,eAAe,MAAM;AACzB,YAAMA,WAAU,SAAS,eAAe,gBAAgB;AACxD,UAAIA,YAAW,UAAU;AACvB,cAAM,mBAAmB,CAAC,SAAS,YAAY;AAC/C,cAAM,kBAAkB,CAAC,SAAS,aAAa;AAC/C,QAAAA,SAAQ,YAAY;AAAA,YAChB;AAAA,cACE;AAAA,sBACQ;AAAA,qBACD;AAAA;AAAA;AAAA,MAGf;AAAA,IACF;AAEA,yCAAU,iBAAiB,UAAU;AAGrC,WAAO,MAAM;AAtEjB;AAuEM,qBAAS,eAAe,gBAAgB,MAAxC,mBAA2C;AAC3C,2CAAU,oBAAoB,UAAU;AAAA,IAC1C;AAAA,EACF,GAAG,CAAC,iBAAiB,wBAAwB,CAAC;AAChD","sourcesContent":["import { useEffect } from \"react\";\n\nexport function useAddBrandingCss(\n suggestionStyleAugmented: React.CSSProperties,\n disableBranding: boolean | undefined\n) {\n const cssSelector = \".copilot-textarea.with-branding\";\n useEffect(() => {\n if (disableBranding) {\n return;\n }\n\n // ---\n // 1: Add the CSS to the DOM\n const styleEl = document.createElement(\"style\");\n styleEl.id = \"dynamic-styles\";\n\n // Build the CSS string dynamically\n let dynamicStyles = Object.entries(suggestionStyleAugmented)\n .map(([key, value]) => {\n const kebabCaseKey = key\n .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, \"$1-$2\")\n .toLowerCase();\n return `${kebabCaseKey}: ${value};`;\n })\n .join(\" \");\n\n // Append overrides for italics and font-size\n dynamicStyles += `font-style: normal; font-size: x-small;`;\n dynamicStyles += `content: \"CopilotKit\";`;\n dynamicStyles += `bottom: 6px;`;\n dynamicStyles += `right: 6px;`;\n dynamicStyles += `pointer-events: none;`;\n dynamicStyles += `font-weight: 200;`;\n dynamicStyles += `padding: 0;`;\n dynamicStyles += `margin: 0;`;\n dynamicStyles += `border: 0;`;\n dynamicStyles += `line-height: 1;`;\n dynamicStyles += `position: absolute;`;\n\n // Append it to the ::after class\n styleEl.innerHTML = `\n ${cssSelector}::after {\n ${dynamicStyles}\n }\n `;\n\n document.head.appendChild(styleEl);\n\n // ---\n // 2: Add the scroll listener (to keep the branding in the bottom right as the textarea scrolls)\n const textarea = document.querySelector(cssSelector);\n const handleScroll = () => {\n const styleEl = document.getElementById(\"dynamic-styles\");\n if (styleEl && textarea) {\n const offsetFromBottom = -textarea.scrollTop + 6;\n const offsetFromRight = -textarea.scrollLeft + 6;\n styleEl.innerHTML = `\n ${cssSelector}::after {\n ${dynamicStyles}\n bottom: ${offsetFromBottom}px;\n right: ${offsetFromRight}px;\n }\n `;\n }\n };\n\n textarea?.addEventListener(\"scroll\", handleScroll);\n\n // Cleanup\n return () => {\n document.getElementById(\"dynamic-styles\")?.remove();\n textarea?.removeEventListener(\"scroll\", handleScroll);\n };\n }, [disableBranding, suggestionStyleAugmented]);\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Transforms, Editor } from 'slate';
|
|
2
|
+
|
|
3
|
+
// src/lib/slatejs-edits/replace-text.ts
|
|
4
|
+
function replaceEditorText(editor, newText) {
|
|
5
|
+
Transforms.delete(editor, {
|
|
6
|
+
at: {
|
|
7
|
+
anchor: Editor.start(editor, []),
|
|
8
|
+
focus: Editor.end(editor, [])
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
if (newText && newText !== "") {
|
|
12
|
+
Transforms.insertNodes(
|
|
13
|
+
editor,
|
|
14
|
+
[
|
|
15
|
+
{
|
|
16
|
+
type: "paragraph",
|
|
17
|
+
children: [{ text: newText }]
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
{
|
|
21
|
+
at: [0]
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { replaceEditorText };
|
|
28
|
+
//# sourceMappingURL=out.js.map
|
|
29
|
+
//# sourceMappingURL=chunk-RQHOUUXQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/slatejs-edits/replace-text.ts"],"names":[],"mappings":";AAAA,SAAS,QAAQ,kBAAkB;AAE5B,SAAS,kBAAkB,QAAgB,SAAiB;AAEjE,aAAW,OAAO,QAAQ;AAAA,IACxB,IAAI;AAAA,MACF,QAAQ,OAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,MAC/B,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,IAC9B;AAAA,EACF,CAAC;AAGD,MAAI,WAAW,YAAY,IAAI;AAE7B,eAAW;AAAA,MACT;AAAA,MACA;AAAA,QACE;AAAA,UACE,MAAM;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,QAAQ,CAAC;AAAA,QAC9B;AAAA,MACF;AAAA,MACA;AAAA,QACE,IAAI,CAAC,CAAC;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["import { Editor, Transforms } from \"slate\";\n\nexport function replaceEditorText(editor: Editor, newText: string) {\n // clear all previous text\n Transforms.delete(editor, {\n at: {\n anchor: Editor.start(editor, []),\n focus: Editor.end(editor, []),\n },\n });\n\n // insert new text\n if (newText && newText !== \"\") {\n // don't insert empty text - results in strange visual behavior\n Transforms.insertNodes(\n editor,\n [\n {\n type: \"paragraph\",\n children: [{ text: newText }],\n },\n ],\n {\n at: [0],\n }\n );\n }\n}\n"]}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export { BaseCopilotTextarea } from '../../chunk-
|
|
1
|
+
export { BaseCopilotTextarea } from '../../chunk-5GGCWNTT.mjs';
|
|
2
2
|
import '../../chunk-HZGSG7ST.mjs';
|
|
3
3
|
import '../../chunk-UW3ITU2Y.mjs';
|
|
4
4
|
import '../../chunk-CSGFJU3L.mjs';
|
|
5
|
-
import '../../chunk-
|
|
5
|
+
import '../../chunk-LWVCQYWV.mjs';
|
|
6
6
|
import '../../chunk-WJYQWL4I.mjs';
|
|
7
7
|
import '../../chunk-F3MHL6ZY.mjs';
|
|
8
|
-
import '../../chunk-
|
|
8
|
+
import '../../chunk-RQHOUUXQ.mjs';
|
|
9
9
|
import '../../chunk-KCHYD3EB.mjs';
|
|
10
10
|
import '../../chunk-KGKLUWKW.mjs';
|
|
11
11
|
import '../../chunk-WJHSY5T6.mjs';
|
|
12
|
-
import '../../chunk-
|
|
12
|
+
import '../../chunk-MFJNLKRC.mjs';
|
|
13
13
|
import '../../chunk-LNAIMEB2.mjs';
|
|
14
14
|
import '../../chunk-OELUUJZY.mjs';
|
|
15
|
-
import '../../chunk-
|
|
15
|
+
import '../../chunk-MPME5BW2.mjs';
|
|
16
16
|
import '../../chunk-NKW5OU2S.mjs';
|
|
17
17
|
import '../../chunk-3UQM3NLM.mjs';
|
|
18
18
|
import '../../chunk-MRXNTQOX.mjs';
|
|
@@ -2,13 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import { BaseCopilotTextareaProps } from '../../types/base/base-copilot-textarea-props.js';
|
|
3
3
|
import { HTMLCopilotTextAreaElement } from '../../types/html-copilot-textarea-element.js';
|
|
4
4
|
import { AutosuggestionsConfig } from '../../types/standard-autosuggestions/autosuggestions-config.js';
|
|
5
|
+
import { ChatlikeApiEndpoint } from '../../types/standard-autosuggestions/chatlike-api-endpoint.js';
|
|
5
6
|
import '../../types/base/base-autosuggestions-config.js';
|
|
6
|
-
import '../../types/standard-autosuggestions/chatlike-api-endpoint.js';
|
|
7
7
|
import '../../types/standard-autosuggestions/minimal-chat-gpt-message.js';
|
|
8
8
|
|
|
9
9
|
interface CopilotTextareaProps extends BaseCopilotTextareaProps {
|
|
10
10
|
autosuggestionsConfig: Partial<AutosuggestionsConfig> & {
|
|
11
|
-
|
|
11
|
+
textareaPurpose: string;
|
|
12
|
+
apiEndpoint: ChatlikeApiEndpoint;
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
15
|
declare const CopilotTextarea: React.ForwardRefExoticComponent<CopilotTextareaProps & React.RefAttributes<HTMLCopilotTextAreaElement>>;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export { CopilotTextarea } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { CopilotTextarea } from '../../chunk-BLRD23HM.mjs';
|
|
2
|
+
import '../../chunk-BTAUKCBN.mjs';
|
|
3
3
|
import '../../chunk-SL4J5HMW.mjs';
|
|
4
|
-
import '../../chunk-LGK56BTO.mjs';
|
|
5
4
|
import '../../chunk-3A2CNIG5.mjs';
|
|
6
|
-
import '../../chunk-
|
|
5
|
+
import '../../chunk-JWN2VEE3.mjs';
|
|
6
|
+
import '../../chunk-5GGCWNTT.mjs';
|
|
7
7
|
import '../../chunk-HZGSG7ST.mjs';
|
|
8
8
|
import '../../chunk-UW3ITU2Y.mjs';
|
|
9
9
|
import '../../chunk-CSGFJU3L.mjs';
|
|
10
|
-
import '../../chunk-
|
|
10
|
+
import '../../chunk-LWVCQYWV.mjs';
|
|
11
11
|
import '../../chunk-WJYQWL4I.mjs';
|
|
12
12
|
import '../../chunk-F3MHL6ZY.mjs';
|
|
13
|
-
import '../../chunk-
|
|
13
|
+
import '../../chunk-RQHOUUXQ.mjs';
|
|
14
14
|
import '../../chunk-KCHYD3EB.mjs';
|
|
15
15
|
import '../../chunk-KGKLUWKW.mjs';
|
|
16
16
|
import '../../chunk-WJHSY5T6.mjs';
|
|
17
|
-
import '../../chunk-
|
|
17
|
+
import '../../chunk-MFJNLKRC.mjs';
|
|
18
18
|
import '../../chunk-LNAIMEB2.mjs';
|
|
19
19
|
import '../../chunk-OELUUJZY.mjs';
|
|
20
|
-
import '../../chunk-
|
|
20
|
+
import '../../chunk-MPME5BW2.mjs';
|
|
21
21
|
import '../../chunk-NKW5OU2S.mjs';
|
|
22
22
|
import '../../chunk-3UQM3NLM.mjs';
|
|
23
23
|
import '../../chunk-MRXNTQOX.mjs';
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import '../chunk-MMVDU6DF.mjs';
|
|
2
|
-
export { CopilotTextarea } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
2
|
+
export { CopilotTextarea } from '../chunk-BLRD23HM.mjs';
|
|
3
|
+
import '../chunk-BTAUKCBN.mjs';
|
|
4
4
|
import '../chunk-SL4J5HMW.mjs';
|
|
5
|
-
import '../chunk-LGK56BTO.mjs';
|
|
6
5
|
import '../chunk-3A2CNIG5.mjs';
|
|
7
|
-
|
|
6
|
+
import '../chunk-JWN2VEE3.mjs';
|
|
7
|
+
export { BaseCopilotTextarea } from '../chunk-5GGCWNTT.mjs';
|
|
8
8
|
import '../chunk-HZGSG7ST.mjs';
|
|
9
9
|
import '../chunk-UW3ITU2Y.mjs';
|
|
10
10
|
import '../chunk-CSGFJU3L.mjs';
|
|
11
|
-
import '../chunk-
|
|
11
|
+
import '../chunk-LWVCQYWV.mjs';
|
|
12
12
|
import '../chunk-WJYQWL4I.mjs';
|
|
13
13
|
import '../chunk-F3MHL6ZY.mjs';
|
|
14
|
-
import '../chunk-
|
|
14
|
+
import '../chunk-RQHOUUXQ.mjs';
|
|
15
15
|
import '../chunk-KCHYD3EB.mjs';
|
|
16
16
|
import '../chunk-KGKLUWKW.mjs';
|
|
17
17
|
import '../chunk-WJHSY5T6.mjs';
|
|
18
|
-
import '../chunk-
|
|
18
|
+
import '../chunk-MFJNLKRC.mjs';
|
|
19
19
|
import '../chunk-LNAIMEB2.mjs';
|
|
20
20
|
import '../chunk-OELUUJZY.mjs';
|
|
21
|
-
import '../chunk-
|
|
21
|
+
import '../chunk-MPME5BW2.mjs';
|
|
22
22
|
import '../chunk-NKW5OU2S.mjs';
|
|
23
23
|
import '../chunk-3UQM3NLM.mjs';
|
|
24
24
|
import '../chunk-MRXNTQOX.mjs';
|
package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { usePopulateCopilotTextareaRef } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { usePopulateCopilotTextareaRef } from '../../chunk-LWVCQYWV.mjs';
|
|
2
|
+
import '../../chunk-RQHOUUXQ.mjs';
|
|
3
3
|
import '../../chunk-3UQM3NLM.mjs';
|
|
4
4
|
import '../../chunk-MRXNTQOX.mjs';
|
|
5
5
|
//# sourceMappingURL=out.js.map
|
package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts
CHANGED
|
@@ -10,14 +10,14 @@ import '../../types/base/base-autosuggestions-config.js';
|
|
|
10
10
|
* It sends a POST request to the API endpoint with the messages array containing the system message, few shot messages, and user messages.
|
|
11
11
|
* The function returns the suggestion from the API response.
|
|
12
12
|
*
|
|
13
|
-
* @param
|
|
13
|
+
* @param textareaPurpose - The purpose of the textarea. This is included in the system message.
|
|
14
14
|
* @param apiEndpoint - The API endpoint to send the autosuggestion request to.
|
|
15
15
|
* @param makeSystemMessage - A function that takes in a context string and returns a system message to include in the autosuggestion request.
|
|
16
16
|
* @param fewShotMessages - An array of few shot messages to include in the autosuggestion request.
|
|
17
17
|
* @param contextCategories - The categories of context strings we want to include. By default, we include the (default) "global" context category.
|
|
18
18
|
* @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.
|
|
19
19
|
*/
|
|
20
|
-
declare function useMakeStandardAutosuggestionFunction(
|
|
20
|
+
declare function useMakeStandardAutosuggestionFunction(textareaPurpose: string, apiEndpoint: ChatlikeApiEndpoint, makeSystemPrompt: MakeSystemPrompt, fewShotMessages: MinimalChatGPTMessage[], contextCategories: string[] | undefined, forwardedProps?: {
|
|
21
21
|
[key: string]: any;
|
|
22
22
|
}): AutosuggestionsBareFunction;
|
|
23
23
|
|
package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { useMakeStandardAutosuggestionFunction } from '../../chunk-
|
|
1
|
+
export { useMakeStandardAutosuggestionFunction } from '../../chunk-BTAUKCBN.mjs';
|
|
2
2
|
import '../../chunk-MRXNTQOX.mjs';
|
|
3
3
|
//# sourceMappingURL=out.js.map
|
|
4
4
|
//# sourceMappingURL=use-make-standard-autosuggestions-function.mjs.map
|
package/dist/index.css
CHANGED
package/dist/index.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/styles.css","../src/components/base-copilot-textarea/base-copilot-textarea.css"],"sourcesContent":["/*\n! tailwindcss v3.3.0 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n*/\n\nhtml {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font family by default.\n2. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\n[type='button'],\n[type='reset'],\n[type='submit'] {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n.static {\n position: static;\n}\n.block {\n display: block;\n}\n.inline {\n display: inline;\n}\n.resize-y {\n resize: vertical;\n}\n.overflow-y-auto {\n overflow-y: auto;\n}\n.border {\n border-width: 1px;\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity));\n}\n.italic {\n font-style: italic;\n}\n.blur {\n --tw-blur: blur(8px);\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n",".copilot-textarea.with-branding::after {\n content: ''; /* Initially empty because we overrdie this CSS dynamically and we want to avoid flashing */\n position: absolute;\n}\n \n \n.copilot-textarea.no-branding::after {\n content: '';\n}"],"mappings":";AAOA;AAAA;AAAA;AAGE;AACA;AACA;AACA;AAAA;AAGF;AAAA;AAEE;AAAA;AAYF;AACE;AACA;AACA;AACA;AACG;AACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAQF;AACE;AACA;AAAA;AASF;AACE;AACA;AACA;AAAA;AAOF;AACE;AACQ;AAAA;AAOV;AAAA;AAAA;AAAA;AAAA;AAAA;AAME;AACA;AAAA;AAOF;AACE;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AAAA;AAAA;AAAA;AAIE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAEE;AACA;AACA;AACA;AAAA;AAGF;AACE;AAAA;AAGF;AACE;AAAA;AASF;AACE;AACA;AACA;AAAA;AASF;AAAA;AAAA;AAAA;AAAA;AAKE;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AAAA;AAAA;AAAA;AAIE;AACA;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AACE;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AACE;AACA;AAAA;AAOF;AACE;AAAA;AAQF;AACE;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaE;AAAA;AAGF;AACE;AACA;AAAA;AAGF;AACE;AAAA;AAGF;AAAA;AAAA;AAGE;AACA;AACA;AAAA;AAOF;AACE;AAAA;AAQF;AAAA;AACE;AACA;AAAA;AAGF;AAAA;AAEE;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAMF;AACE;AAAA;AASF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQE;AACA;AAAA;AAOF;AAAA;AAEE;AACA;AAAA;AAIF;AACE;AAAA;AAGF;AAAA;AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAGF;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AACA;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AACA;AAAA;AAEF;AACE;AAAA;;;ACtfF;AACI;AACA;AAAA;AAIJ;AACI;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/styles.css","../src/components/base-copilot-textarea/base-copilot-textarea.css"],"sourcesContent":["/*\n! tailwindcss v3.3.0 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n*/\n\nhtml {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font family by default.\n2. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\n[type='button'],\n[type='reset'],\n[type='submit'] {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n.static {\n position: static;\n}\n.absolute {\n position: absolute;\n}\n.block {\n display: block;\n}\n.inline {\n display: inline;\n}\n.resize-y {\n resize: vertical;\n}\n.overflow-y-auto {\n overflow-y: auto;\n}\n.border {\n border-width: 1px;\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity));\n}\n.italic {\n font-style: italic;\n}\n.blur {\n --tw-blur: blur(8px);\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n",".copilot-textarea.with-branding::after {\n content: ''; /* Initially empty because we overrdie this CSS dynamically and we want to avoid flashing */\n position: absolute;\n}\n \n \n.copilot-textarea.no-branding::after {\n content: '';\n}"],"mappings":";AAOA;AAAA;AAAA;AAGE;AACA;AACA;AACA;AAAA;AAGF;AAAA;AAEE;AAAA;AAYF;AACE;AACA;AACA;AACA;AACG;AACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAQF;AACE;AACA;AAAA;AASF;AACE;AACA;AACA;AAAA;AAOF;AACE;AACQ;AAAA;AAOV;AAAA;AAAA;AAAA;AAAA;AAAA;AAME;AACA;AAAA;AAOF;AACE;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AAAA;AAAA;AAAA;AAIE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAEE;AACA;AACA;AACA;AAAA;AAGF;AACE;AAAA;AAGF;AACE;AAAA;AASF;AACE;AACA;AACA;AAAA;AASF;AAAA;AAAA;AAAA;AAAA;AAKE;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AAAA;AAAA;AAAA;AAIE;AACA;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AACE;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AACE;AACA;AAAA;AAOF;AACE;AAAA;AAQF;AACE;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaE;AAAA;AAGF;AACE;AACA;AAAA;AAGF;AACE;AAAA;AAGF;AAAA;AAAA;AAGE;AACA;AACA;AAAA;AAOF;AACE;AAAA;AAQF;AAAA;AACE;AACA;AAAA;AAGF;AAAA;AAEE;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAMF;AACE;AAAA;AASF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQE;AACA;AAAA;AAOF;AAAA;AAEE;AACA;AAAA;AAIF;AACE;AAAA;AAGF;AAAA;AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAGF;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AACA;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AACA;AAAA;AAEF;AACE;AAAA;;;ACzfF;AACI;AACA;AAAA;AAIJ;AACI;AAAA;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import './chunk-DE5K76I2.mjs';
|
|
2
2
|
import './chunk-WADHCMPK.mjs';
|
|
3
3
|
import './chunk-MMVDU6DF.mjs';
|
|
4
|
-
export { CopilotTextarea } from './chunk-
|
|
5
|
-
import './chunk-
|
|
4
|
+
export { CopilotTextarea } from './chunk-BLRD23HM.mjs';
|
|
5
|
+
import './chunk-BTAUKCBN.mjs';
|
|
6
6
|
import './chunk-SL4J5HMW.mjs';
|
|
7
|
-
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from './chunk-LGK56BTO.mjs';
|
|
8
7
|
export { ChatlikeApiEndpoint } from './chunk-3A2CNIG5.mjs';
|
|
9
|
-
export {
|
|
8
|
+
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from './chunk-JWN2VEE3.mjs';
|
|
9
|
+
export { BaseCopilotTextarea } from './chunk-5GGCWNTT.mjs';
|
|
10
10
|
import './chunk-HZGSG7ST.mjs';
|
|
11
11
|
import './chunk-UW3ITU2Y.mjs';
|
|
12
12
|
import './chunk-CSGFJU3L.mjs';
|
|
13
|
-
import './chunk-
|
|
13
|
+
import './chunk-LWVCQYWV.mjs';
|
|
14
14
|
import './chunk-WJYQWL4I.mjs';
|
|
15
15
|
import './chunk-F3MHL6ZY.mjs';
|
|
16
|
-
import './chunk-
|
|
16
|
+
import './chunk-RQHOUUXQ.mjs';
|
|
17
17
|
import './chunk-KCHYD3EB.mjs';
|
|
18
18
|
import './chunk-KGKLUWKW.mjs';
|
|
19
19
|
import './chunk-WJHSY5T6.mjs';
|
|
20
|
-
export { defaultBaseAutosuggestionsConfig } from './chunk-
|
|
20
|
+
export { defaultBaseAutosuggestionsConfig } from './chunk-MFJNLKRC.mjs';
|
|
21
21
|
import './chunk-LNAIMEB2.mjs';
|
|
22
22
|
import './chunk-OELUUJZY.mjs';
|
|
23
|
-
import './chunk-
|
|
23
|
+
import './chunk-MPME5BW2.mjs';
|
|
24
24
|
import './chunk-IU3WTXLQ.mjs';
|
|
25
25
|
import './chunk-H4VKQGVU.mjs';
|
|
26
26
|
import './chunk-NKW5OU2S.mjs';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
interface BaseAutosuggestionsConfig {
|
|
2
|
-
|
|
2
|
+
textareaPurpose: string;
|
|
3
3
|
debounceTime: number;
|
|
4
4
|
acceptAutosuggestionKey: string;
|
|
5
5
|
disableWhenEmpty: boolean;
|
|
6
6
|
disabled: boolean;
|
|
7
7
|
}
|
|
8
|
-
declare const defaultBaseAutosuggestionsConfig: Omit<BaseAutosuggestionsConfig, "
|
|
8
|
+
declare const defaultBaseAutosuggestionsConfig: Omit<BaseAutosuggestionsConfig, "textareaPurpose">;
|
|
9
9
|
|
|
10
10
|
export { BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defaultBaseAutosuggestionsConfig } from '../../chunk-
|
|
1
|
+
export { defaultBaseAutosuggestionsConfig } from '../../chunk-MFJNLKRC.mjs';
|
|
2
2
|
import '../../chunk-MRXNTQOX.mjs';
|
|
3
3
|
//# sourceMappingURL=out.js.map
|
|
4
4
|
//# sourceMappingURL=base-autosuggestions-config.mjs.map
|
|
@@ -19,9 +19,9 @@ import { BaseAutosuggestionsConfig } from './base-autosuggestions-config.js';
|
|
|
19
19
|
* @property {(event: React.ChangeEvent<HTMLTextAreaElement>) => void} [onChange] - Callback invoked when a `change` event is triggered on the textarea element. The event only actually includes the `event.target.value` and `event.currentTarget.value` properties (all that is required in 99% of cases).
|
|
20
20
|
*
|
|
21
21
|
* @property {Partial<BaseAutosuggestionsConfig> & {
|
|
22
|
-
*
|
|
22
|
+
* textareaPurpose: string;
|
|
23
23
|
* }} autosuggestionsConfig - Configuration settings for the autosuggestions feature.
|
|
24
|
-
* Includes a mandatory `
|
|
24
|
+
* Includes a mandatory `textareaPurpose` to guide the autosuggestions.
|
|
25
25
|
*/
|
|
26
26
|
interface BaseCopilotTextareaProps extends Omit<TextareaHTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
27
27
|
disableBranding?: boolean;
|
|
@@ -31,7 +31,7 @@ interface BaseCopilotTextareaProps extends Omit<TextareaHTMLAttributes<HTMLDivEl
|
|
|
31
31
|
onValueChange?: (value: string) => void;
|
|
32
32
|
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
33
33
|
autosuggestionsConfig: Partial<BaseAutosuggestionsConfig> & {
|
|
34
|
-
|
|
34
|
+
textareaPurpose: string;
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../../chunk-WJHSY5T6.mjs';
|
|
2
|
-
export { defaultBaseAutosuggestionsConfig } from '../../chunk-
|
|
2
|
+
export { defaultBaseAutosuggestionsConfig } from '../../chunk-MFJNLKRC.mjs';
|
|
3
3
|
import '../../chunk-MRXNTQOX.mjs';
|
|
4
4
|
//# sourceMappingURL=out.js.map
|
|
5
5
|
//# sourceMappingURL=index.mjs.map
|
package/dist/types/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import '../chunk-DE5K76I2.mjs';
|
|
2
2
|
import '../chunk-WADHCMPK.mjs';
|
|
3
3
|
import '../chunk-SL4J5HMW.mjs';
|
|
4
|
-
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../chunk-LGK56BTO.mjs';
|
|
5
4
|
export { ChatlikeApiEndpoint } from '../chunk-3A2CNIG5.mjs';
|
|
5
|
+
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../chunk-JWN2VEE3.mjs';
|
|
6
6
|
import '../chunk-WJHSY5T6.mjs';
|
|
7
|
-
export { defaultBaseAutosuggestionsConfig } from '../chunk-
|
|
7
|
+
export { defaultBaseAutosuggestionsConfig } from '../chunk-MFJNLKRC.mjs';
|
|
8
8
|
import '../chunk-MRXNTQOX.mjs';
|
|
9
9
|
//# sourceMappingURL=out.js.map
|
|
10
10
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -2,7 +2,7 @@ import { BaseAutosuggestionsConfig } from '../base/base-autosuggestions-config.j
|
|
|
2
2
|
import { ChatlikeApiEndpoint } from './chatlike-api-endpoint.js';
|
|
3
3
|
import { MinimalChatGPTMessage } from './minimal-chat-gpt-message.js';
|
|
4
4
|
|
|
5
|
-
type MakeSystemPrompt = (
|
|
5
|
+
type MakeSystemPrompt = (textareaPurpose: string, contextString: string) => string;
|
|
6
6
|
interface AutosuggestionsConfig extends BaseAutosuggestionsConfig {
|
|
7
7
|
apiEndpoint: ChatlikeApiEndpoint;
|
|
8
8
|
externalContextCategories: string[] | undefined;
|
|
@@ -14,6 +14,6 @@ interface AutosuggestionsConfig extends BaseAutosuggestionsConfig {
|
|
|
14
14
|
}
|
|
15
15
|
declare const defaultMakeSystemPrompt: MakeSystemPrompt;
|
|
16
16
|
declare const defaultFewShotMessages: MinimalChatGPTMessage[];
|
|
17
|
-
declare const defaultAutosuggestionsConfig: Omit<AutosuggestionsConfig, "
|
|
17
|
+
declare const defaultAutosuggestionsConfig: Omit<AutosuggestionsConfig, "textareaPurpose" | "apiEndpoint">;
|
|
18
18
|
|
|
19
19
|
export { AutosuggestionsConfig, MakeSystemPrompt, defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../../chunk-
|
|
2
|
-
import '../../chunk-3A2CNIG5.mjs';
|
|
1
|
+
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../../chunk-JWN2VEE3.mjs';
|
|
3
2
|
import '../../chunk-WJHSY5T6.mjs';
|
|
4
|
-
import '../../chunk-
|
|
3
|
+
import '../../chunk-MFJNLKRC.mjs';
|
|
5
4
|
import '../../chunk-MRXNTQOX.mjs';
|
|
6
5
|
//# sourceMappingURL=out.js.map
|
|
7
6
|
//# sourceMappingURL=autosuggestions-config.mjs.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import '../../chunk-SL4J5HMW.mjs';
|
|
2
|
-
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../../chunk-LGK56BTO.mjs';
|
|
3
2
|
export { ChatlikeApiEndpoint } from '../../chunk-3A2CNIG5.mjs';
|
|
3
|
+
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../../chunk-JWN2VEE3.mjs';
|
|
4
4
|
import '../../chunk-WJHSY5T6.mjs';
|
|
5
|
-
import '../../chunk-
|
|
5
|
+
import '../../chunk-MFJNLKRC.mjs';
|
|
6
6
|
import '../../chunk-MRXNTQOX.mjs';
|
|
7
7
|
//# sourceMappingURL=out.js.map
|
|
8
8
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -5,13 +5,15 @@ import { HTMLCopilotTextAreaElement } from "../../types";
|
|
|
5
5
|
import { BaseCopilotTextareaProps } from "../../types/base/base-copilot-textarea-props";
|
|
6
6
|
import {
|
|
7
7
|
AutosuggestionsConfig,
|
|
8
|
+
ChatlikeApiEndpoint,
|
|
8
9
|
defaultAutosuggestionsConfig,
|
|
9
10
|
} from "../../types/standard-autosuggestions";
|
|
10
11
|
import { BaseCopilotTextarea } from "../base-copilot-textarea/base-copilot-textarea";
|
|
11
12
|
|
|
12
13
|
export interface CopilotTextareaProps extends BaseCopilotTextareaProps {
|
|
13
14
|
autosuggestionsConfig: Partial<AutosuggestionsConfig> & {
|
|
14
|
-
|
|
15
|
+
textareaPurpose: string;
|
|
16
|
+
apiEndpoint: ChatlikeApiEndpoint;
|
|
15
17
|
};
|
|
16
18
|
}
|
|
17
19
|
|
|
@@ -26,7 +28,7 @@ export const CopilotTextarea = React.forwardRef(
|
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
const autosuggestionsFunction = useMakeStandardAutosuggestionFunction(
|
|
29
|
-
autosuggestionsConfig.
|
|
31
|
+
autosuggestionsConfig.textareaPurpose,
|
|
30
32
|
autosuggestionsConfig.apiEndpoint,
|
|
31
33
|
autosuggestionsConfig.makeSystemPrompt,
|
|
32
34
|
autosuggestionsConfig.fewShotMessages,
|
package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import { ChatlikeApiEndpoint } from "../../types/standard-autosuggestions/chatli
|
|
|
12
12
|
* It sends a POST request to the API endpoint with the messages array containing the system message, few shot messages, and user messages.
|
|
13
13
|
* The function returns the suggestion from the API response.
|
|
14
14
|
*
|
|
15
|
-
* @param
|
|
15
|
+
* @param textareaPurpose - The purpose of the textarea. This is included in the system message.
|
|
16
16
|
* @param apiEndpoint - The API endpoint to send the autosuggestion request to.
|
|
17
17
|
* @param makeSystemMessage - A function that takes in a context string and returns a system message to include in the autosuggestion request.
|
|
18
18
|
* @param fewShotMessages - An array of few shot messages to include in the autosuggestion request.
|
|
@@ -20,7 +20,7 @@ import { ChatlikeApiEndpoint } from "../../types/standard-autosuggestions/chatli
|
|
|
20
20
|
* @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.
|
|
21
21
|
*/
|
|
22
22
|
export function useMakeStandardAutosuggestionFunction(
|
|
23
|
-
|
|
23
|
+
textareaPurpose: string,
|
|
24
24
|
apiEndpoint: ChatlikeApiEndpoint,
|
|
25
25
|
makeSystemPrompt: MakeSystemPrompt,
|
|
26
26
|
fewShotMessages: MinimalChatGPTMessage[],
|
|
@@ -36,7 +36,7 @@ export function useMakeStandardAutosuggestionFunction(
|
|
|
36
36
|
{
|
|
37
37
|
role: "system",
|
|
38
38
|
content: makeSystemPrompt(
|
|
39
|
-
|
|
39
|
+
textareaPurpose,
|
|
40
40
|
getContextString(contextCategories)
|
|
41
41
|
),
|
|
42
42
|
},
|
|
@@ -64,7 +64,7 @@ export function useMakeStandardAutosuggestionFunction(
|
|
|
64
64
|
fewShotMessages,
|
|
65
65
|
getContextString,
|
|
66
66
|
contextCategories,
|
|
67
|
-
|
|
67
|
+
textareaPurpose,
|
|
68
68
|
]
|
|
69
69
|
);
|
|
70
70
|
}
|
|
@@ -1,36 +1,28 @@
|
|
|
1
|
-
import { Editor,
|
|
1
|
+
import { Editor, Transforms } from "slate";
|
|
2
2
|
|
|
3
3
|
export function replaceEditorText(editor: Editor, newText: string) {
|
|
4
4
|
// clear all previous text
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
) {
|
|
12
|
-
paths.push(path);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
for (const path of paths) {
|
|
16
|
-
try {
|
|
17
|
-
Transforms.removeNodes(editor, { at: path });
|
|
18
|
-
} catch (e) {
|
|
19
|
-
console.log("CopilotTextarea.replaceEditorText: error removing node", e);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
5
|
+
Transforms.delete(editor, {
|
|
6
|
+
at: {
|
|
7
|
+
anchor: Editor.start(editor, []),
|
|
8
|
+
focus: Editor.end(editor, []),
|
|
9
|
+
},
|
|
10
|
+
});
|
|
22
11
|
|
|
23
12
|
// insert new text
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
if (newText && newText !== "") {
|
|
14
|
+
// don't insert empty text - results in strange visual behavior
|
|
15
|
+
Transforms.insertNodes(
|
|
16
|
+
editor,
|
|
17
|
+
[
|
|
18
|
+
{
|
|
19
|
+
type: "paragraph",
|
|
20
|
+
children: [{ text: newText }],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
27
23
|
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
{
|
|
33
|
-
at: [0],
|
|
34
|
-
}
|
|
35
|
-
);
|
|
24
|
+
at: [0],
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
36
28
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface BaseAutosuggestionsConfig {
|
|
2
|
-
|
|
2
|
+
textareaPurpose: string;
|
|
3
3
|
debounceTime: number;
|
|
4
4
|
acceptAutosuggestionKey: string;
|
|
5
5
|
disableWhenEmpty: boolean;
|
|
@@ -8,7 +8,7 @@ export interface BaseAutosuggestionsConfig {
|
|
|
8
8
|
|
|
9
9
|
export const defaultBaseAutosuggestionsConfig: Omit<
|
|
10
10
|
BaseAutosuggestionsConfig,
|
|
11
|
-
"
|
|
11
|
+
"textareaPurpose"
|
|
12
12
|
> = {
|
|
13
13
|
debounceTime: 500,
|
|
14
14
|
acceptAutosuggestionKey: "Tab",
|
|
@@ -19,9 +19,9 @@ import { BaseAutosuggestionsConfig } from ".";
|
|
|
19
19
|
* @property {(event: React.ChangeEvent<HTMLTextAreaElement>) => void} [onChange] - Callback invoked when a `change` event is triggered on the textarea element. The event only actually includes the `event.target.value` and `event.currentTarget.value` properties (all that is required in 99% of cases).
|
|
20
20
|
*
|
|
21
21
|
* @property {Partial<BaseAutosuggestionsConfig> & {
|
|
22
|
-
*
|
|
22
|
+
* textareaPurpose: string;
|
|
23
23
|
* }} autosuggestionsConfig - Configuration settings for the autosuggestions feature.
|
|
24
|
-
* Includes a mandatory `
|
|
24
|
+
* Includes a mandatory `textareaPurpose` to guide the autosuggestions.
|
|
25
25
|
*/
|
|
26
26
|
export interface BaseCopilotTextareaProps
|
|
27
27
|
extends Omit<TextareaHTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
@@ -32,6 +32,6 @@ export interface BaseCopilotTextareaProps
|
|
|
32
32
|
onValueChange?: (value: string) => void;
|
|
33
33
|
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
34
34
|
autosuggestionsConfig: Partial<BaseAutosuggestionsConfig> & {
|
|
35
|
-
|
|
35
|
+
textareaPurpose: string;
|
|
36
36
|
};
|
|
37
37
|
}
|
|
@@ -6,7 +6,7 @@ import { ChatlikeApiEndpoint } from "./chatlike-api-endpoint";
|
|
|
6
6
|
import { MinimalChatGPTMessage } from "./minimal-chat-gpt-message";
|
|
7
7
|
|
|
8
8
|
export type MakeSystemPrompt = (
|
|
9
|
-
|
|
9
|
+
textareaPurpose: string,
|
|
10
10
|
contextString: string
|
|
11
11
|
) => string;
|
|
12
12
|
|
|
@@ -19,13 +19,13 @@ export interface AutosuggestionsConfig extends BaseAutosuggestionsConfig {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export const defaultMakeSystemPrompt: MakeSystemPrompt = (
|
|
22
|
-
|
|
22
|
+
textareaPurpose,
|
|
23
23
|
contextString
|
|
24
24
|
) => {
|
|
25
25
|
return `You are a versatile writing assistant.
|
|
26
26
|
|
|
27
27
|
The user is writing some text.
|
|
28
|
-
The purpose is: \"${
|
|
28
|
+
The purpose is: \"${textareaPurpose}\"
|
|
29
29
|
|
|
30
30
|
Your job is to guess what the user will write next AS BEST YOU CAN.
|
|
31
31
|
Only guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.
|
|
@@ -83,13 +83,10 @@ export const defaultFewShotMessages: MinimalChatGPTMessage[] = [
|
|
|
83
83
|
];
|
|
84
84
|
export const defaultAutosuggestionsConfig: Omit<
|
|
85
85
|
AutosuggestionsConfig,
|
|
86
|
-
"
|
|
86
|
+
"textareaPurpose" | "apiEndpoint"
|
|
87
87
|
> = {
|
|
88
88
|
...defaultBaseAutosuggestionsConfig,
|
|
89
89
|
|
|
90
|
-
apiEndpoint: ChatlikeApiEndpoint.standardOpenAIEndpoint(
|
|
91
|
-
"api/autosuggestions"
|
|
92
|
-
),
|
|
93
90
|
makeSystemPrompt: defaultMakeSystemPrompt,
|
|
94
91
|
fewShotMessages: defaultFewShotMessages,
|
|
95
92
|
externalContextCategories: undefined,
|
package/dist/chunk-42QG2O6L.mjs
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Node, Element, Transforms } from 'slate';
|
|
2
|
-
|
|
3
|
-
// src/lib/slatejs-edits/replace-text.ts
|
|
4
|
-
function replaceEditorText(editor, newText) {
|
|
5
|
-
const paths = [];
|
|
6
|
-
for (const [node, path] of Node.nodes(editor)) {
|
|
7
|
-
if (Element.isElement(node) && (node.type === "paragraph" || node.type === "suggestion") && path.length === 1) {
|
|
8
|
-
paths.push(path);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
for (const path of paths) {
|
|
12
|
-
try {
|
|
13
|
-
Transforms.removeNodes(editor, { at: path });
|
|
14
|
-
} catch (e) {
|
|
15
|
-
console.log("CopilotTextarea.replaceEditorText: error removing node", e);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
Transforms.insertNodes(
|
|
19
|
-
editor,
|
|
20
|
-
[
|
|
21
|
-
{
|
|
22
|
-
type: "paragraph",
|
|
23
|
-
children: [{ text: newText }]
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
{
|
|
27
|
-
at: [0]
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { replaceEditorText };
|
|
33
|
-
//# sourceMappingURL=out.js.map
|
|
34
|
-
//# sourceMappingURL=chunk-42QG2O6L.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/slatejs-edits/replace-text.ts"],"names":[],"mappings":";AAAA,SAAiB,SAAS,MAAY,kBAAkB;AAEjD,SAAS,kBAAkB,QAAgB,SAAiB;AAEjE,QAAM,QAAgB,CAAC;AACvB,aAAW,CAAC,MAAM,IAAI,KAAK,KAAK,MAAM,MAAM,GAAG;AAC7C,QACE,QAAQ,UAAU,IAAI,MACrB,KAAK,SAAS,eAAe,KAAK,SAAS,iBAC5C,KAAK,WAAW,GAChB;AACA,YAAM,KAAK,IAAI;AAAA,IACjB;AAAA,EACF;AACA,aAAW,QAAQ,OAAO;AACxB,QAAI;AACF,iBAAW,YAAY,QAAQ,EAAE,IAAI,KAAK,CAAC;AAAA,IAC7C,SAAS,GAAP;AACA,cAAQ,IAAI,0DAA0D,CAAC;AAAA,IACzE;AAAA,EACF;AAGA,aAAW;AAAA,IACT;AAAA,IACA;AAAA,MACE;AAAA,QACE,MAAM;AAAA,QACN,UAAU,CAAC,EAAE,MAAM,QAAQ,CAAC;AAAA,MAC9B;AAAA,IACF;AAAA,IACA;AAAA,MACE,IAAI,CAAC,CAAC;AAAA,IACR;AAAA,EACF;AACF","sourcesContent":["import { Editor, Element, Node, Path, Transforms } from \"slate\";\n\nexport function replaceEditorText(editor: Editor, newText: string) {\n // clear all previous text\n const paths: Path[] = [];\n for (const [node, path] of Node.nodes(editor)) {\n if (\n Element.isElement(node) &&\n (node.type === \"paragraph\" || node.type === \"suggestion\") &&\n path.length === 1\n ) {\n paths.push(path);\n }\n }\n for (const path of paths) {\n try {\n Transforms.removeNodes(editor, { at: path });\n } catch (e) {\n console.log(\"CopilotTextarea.replaceEditorText: error removing node\", e);\n }\n }\n\n // insert new text\n Transforms.insertNodes(\n editor,\n [\n {\n type: \"paragraph\",\n children: [{ text: newText }],\n },\n ],\n {\n at: [0],\n }\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx"],"names":[],"mappings":";;;;;AAAA,SAAS,sBAAsB;AAC/B,SAAS,aAAa,kBAAkB;AAoBjC,SAAS,sCACd,eACA,aACA,kBACA,iBACA,mBACA,gBAC6B;AAC7B,QAAM,EAAE,iBAAiB,IAAI,WAAW,cAAc;AAEtD,SAAO;AAAA,IACL,CAAO,YAAoB,WAAmB,gBAA6B;AACzE,YAAM,MAAM,MAAM,MAAM,MAAY;AAClC,cAAM,WAAoC;AAAA,UACxC;AAAA,YACE,MAAM;AAAA,YACN,SAAS;AAAA,cACP;AAAA,cACA,iBAAiB,iBAAiB;AAAA,YACpC;AAAA,UACF;AAAA,UACA,GAAG;AAAA,UACH;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS;AAAA,UACX;AAAA,UACA;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS;AAAA,UACX;AAAA,QACF;AAEA,eAAO,MAAM,YAAY,IAAI,aAAa,UAAU,cAAc;AAAA,MACpE,EAAC;AAED,aAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,MACP,IACA,cAAsB,GACtB,WAAmB,KACnB,UAAkB,KACN;AACZ,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,OAAG,EACA,KAAK,OAAO,EACZ,MAAM,CAAC,UAAU;AAChB,UAAI,gBAAgB,GAAG;AACrB,eAAO,KAAK;AACZ;AAAA,MACF;AAEA,iBAAW,MAAM;AACf,cAAM,IAAI,cAAc,GAAG,WAAW,SAAS,OAAO,EACnD,KAAK,OAAO,EACZ,MAAM,MAAM;AAAA,MACjB,GAAG,QAAQ;AAAA,IACb,CAAC;AAAA,EACL,CAAC;AACH","sourcesContent":["import { CopilotContext } from \"@copilotkit/react-core\";\nimport { useCallback, useContext } from \"react\";\nimport {\n AutosuggestionsBareFunction,\n MakeSystemPrompt,\n MinimalChatGPTMessage,\n} from \"../../types\";\nimport { ChatlikeApiEndpoint } from \"../../types/standard-autosuggestions/chatlike-api-endpoint\";\n/**\n * Returns a memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.\n * The function takes in the text before and after the cursor, and an abort signal.\n * It sends a POST request to the API endpoint with the messages array containing the system message, few shot messages, and user messages.\n * The function returns the suggestion from the API response.\n *\n * @param purposePrompt - The purpose of the textarea. This is included in the system message.\n * @param apiEndpoint - The API endpoint to send the autosuggestion request to.\n * @param makeSystemMessage - A function that takes in a context string and returns a system message to include in the autosuggestion request.\n * @param fewShotMessages - An array of few shot messages to include in the autosuggestion request.\n * @param contextCategories - The categories of context strings we want to include. By default, we include the (default) \"global\" context category.\n * @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.\n */\nexport function useMakeStandardAutosuggestionFunction(\n purposePrompt: string,\n apiEndpoint: ChatlikeApiEndpoint,\n makeSystemPrompt: MakeSystemPrompt,\n fewShotMessages: MinimalChatGPTMessage[],\n contextCategories: string[] | undefined,\n forwardedProps?: { [key: string]: any }\n): AutosuggestionsBareFunction {\n const { getContextString } = useContext(CopilotContext);\n\n return useCallback(\n async (beforeText: string, afterText: string, abortSignal: AbortSignal) => {\n const res = await retry(async () => {\n const messages: MinimalChatGPTMessage[] = [\n {\n role: \"system\",\n content: makeSystemPrompt(\n purposePrompt,\n getContextString(contextCategories)\n ),\n },\n ...fewShotMessages,\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: afterText,\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: beforeText,\n },\n ];\n\n return await apiEndpoint.run(abortSignal, messages, forwardedProps);\n });\n\n return res;\n },\n [\n apiEndpoint,\n makeSystemPrompt,\n fewShotMessages,\n getContextString,\n contextCategories,\n purposePrompt,\n ]\n );\n}\n\nfunction retry<T>(\n fn: () => Promise<T>,\n retriesLeft: number = 2,\n interval: number = 200,\n backoff: number = 1.5\n): Promise<T> {\n return new Promise((resolve, reject) => {\n fn()\n .then(resolve)\n .catch((error) => {\n if (retriesLeft === 1) {\n reject(error);\n return;\n }\n\n setTimeout(() => {\n retry(fn, retriesLeft - 1, interval * backoff, backoff)\n .then(resolve)\n .catch(reject);\n }, interval);\n });\n });\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/base/base-autosuggestions-config.tsx"],"names":[],"mappings":";AAQO,IAAM,mCAGT;AAAA,EACF,cAAc;AAAA,EACd,yBAAyB;AAAA,EACzB,kBAAkB;AAAA,EAClB,UAAU;AACZ","sourcesContent":["export interface BaseAutosuggestionsConfig {\n purposePrompt: string;\n debounceTime: number;\n acceptAutosuggestionKey: string;\n disableWhenEmpty: boolean;\n disabled: boolean;\n}\n\nexport const defaultBaseAutosuggestionsConfig: Omit<\n BaseAutosuggestionsConfig,\n \"purposePrompt\"\n> = {\n debounceTime: 500,\n acceptAutosuggestionKey: \"Tab\",\n disableWhenEmpty: true,\n disabled: false,\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/copilot-textarea/copilot-textarea.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,OAAO,WAAW;AAoCZ,mBACE,WADF;AApBC,IAAM,kBAAkB,MAAM;AAAA,EACnC,CACE,OACA,QACgB;AAChB,UAAM,wBAA+C,kCAChD,+BACA,MAAM;AAGX,UAAM,0BAA0B;AAAA,MAC9B,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,IACxB;AAEA,WACE;AAAA,MACE,8BAAC;AAAA,QACC;AAAA,SACI,QAFL;AAAA,QAGC;AAAA,QACA;AAAA,QACF;AAAA,KACF;AAAA,EAEJ;AACF","sourcesContent":["// This example is for an Editor with `ReactEditor` and `HistoryEditor`\nimport React from \"react\";\nimport { useMakeStandardAutosuggestionFunction } from \"../../hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function\";\nimport { HTMLCopilotTextAreaElement } from \"../../types\";\nimport { BaseCopilotTextareaProps } from \"../../types/base/base-copilot-textarea-props\";\nimport {\n AutosuggestionsConfig,\n defaultAutosuggestionsConfig,\n} from \"../../types/standard-autosuggestions\";\nimport { BaseCopilotTextarea } from \"../base-copilot-textarea/base-copilot-textarea\";\n\nexport interface CopilotTextareaProps extends BaseCopilotTextareaProps {\n autosuggestionsConfig: Partial<AutosuggestionsConfig> & {\n purposePrompt: string;\n };\n}\n\nexport const CopilotTextarea = React.forwardRef(\n (\n props: CopilotTextareaProps,\n ref: React.Ref<HTMLCopilotTextAreaElement>\n ): JSX.Element => {\n const autosuggestionsConfig: AutosuggestionsConfig = {\n ...defaultAutosuggestionsConfig,\n ...props.autosuggestionsConfig,\n };\n\n const autosuggestionsFunction = useMakeStandardAutosuggestionFunction(\n autosuggestionsConfig.purposePrompt,\n autosuggestionsConfig.apiEndpoint,\n autosuggestionsConfig.makeSystemPrompt,\n autosuggestionsConfig.fewShotMessages,\n autosuggestionsConfig.externalContextCategories,\n autosuggestionsConfig.forwardedParams\n );\n\n return (\n <>\n <BaseCopilotTextarea\n ref={ref}\n {...props}\n autosuggestionsConfig={autosuggestionsConfig}\n autosuggestionsFunction={autosuggestionsFunction}\n />\n </>\n );\n }\n);\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/base-copilot-textarea/use-add-branding-css.tsx"],"names":["styleEl"],"mappings":";AAAA,SAAS,iBAAiB;AAEnB,SAAS,kBACd,0BACA,iBACA;AACA,QAAM,cAAc;AACpB,YAAU,MAAM;AACd,QAAI,iBAAiB;AACnB;AAAA,IACF;AAIA,UAAM,UAAU,SAAS,cAAc,OAAO;AAC9C,YAAQ,KAAK;AAGb,QAAI,gBAAgB,OAAO,QAAQ,wBAAwB,EACxD,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AACrB,YAAM,eAAe,IAClB,QAAQ,gCAAgC,OAAO,EAC/C,YAAY;AACf,aAAO,GAAG,iBAAiB;AAAA,IAC7B,CAAC,EACA,KAAK,GAAG;AAGX,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AAGjB,YAAQ,YAAY;AAAA,QAChB;AAAA,UACE;AAAA;AAAA;AAIN,aAAS,KAAK,YAAY,OAAO;AAIjC,UAAM,WAAW,SAAS,cAAc,WAAW;AACnD,UAAM,eAAe,MAAM;AACzB,YAAMA,WAAU,SAAS,eAAe,gBAAgB;AACxD,UAAIA,YAAW,UAAU;AACvB,cAAM,mBAAmB,CAAC,SAAS,YAAY;AAC/C,cAAM,kBAAkB,CAAC,SAAS,aAAa;AAC/C,QAAAA,SAAQ,YAAY;AAAA,YAChB;AAAA,cACE;AAAA,sBACQ;AAAA,qBACD;AAAA;AAAA;AAAA,MAGf;AAAA,IACF;AAEA,yCAAU,iBAAiB,UAAU;AAGrC,WAAO,MAAM;AArEjB;AAsEM,qBAAS,eAAe,gBAAgB,MAAxC,mBAA2C;AAC3C,2CAAU,oBAAoB,UAAU;AAAA,IAC1C;AAAA,EACF,GAAG,CAAC,iBAAiB,wBAAwB,CAAC;AAChD","sourcesContent":["import { useEffect } from \"react\";\n\nexport function useAddBrandingCss(\n suggestionStyleAugmented: React.CSSProperties,\n disableBranding: boolean | undefined\n) {\n const cssSelector = \".copilot-textarea.with-branding\";\n useEffect(() => {\n if (disableBranding) {\n return;\n }\n\n // ---\n // 1: Add the CSS to the DOM\n const styleEl = document.createElement(\"style\");\n styleEl.id = \"dynamic-styles\";\n\n // Build the CSS string dynamically\n let dynamicStyles = Object.entries(suggestionStyleAugmented)\n .map(([key, value]) => {\n const kebabCaseKey = key\n .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, \"$1-$2\")\n .toLowerCase();\n return `${kebabCaseKey}: ${value};`;\n })\n .join(\" \");\n\n // Append overrides for italics and font-size\n dynamicStyles += `font-style: normal; font-size: x-small;`;\n dynamicStyles += `content: \"CopilotKit\";`;\n dynamicStyles += `bottom: 6px;`;\n dynamicStyles += `right: 6px;`;\n dynamicStyles += `pointer-events: none;`;\n dynamicStyles += `font-weight: 200;`;\n dynamicStyles += `padding: 0;`;\n dynamicStyles += `margin: 0;`;\n dynamicStyles += `border: 0;`;\n dynamicStyles += `line-height: 1;`;\n\n // Append it to the ::after class\n styleEl.innerHTML = `\n ${cssSelector}::after {\n ${dynamicStyles}\n }\n `;\n\n document.head.appendChild(styleEl);\n\n // ---\n // 2: Add the scroll listener (to keep the branding in the bottom right as the textarea scrolls)\n const textarea = document.querySelector(cssSelector);\n const handleScroll = () => {\n const styleEl = document.getElementById(\"dynamic-styles\");\n if (styleEl && textarea) {\n const offsetFromBottom = -textarea.scrollTop + 6;\n const offsetFromRight = -textarea.scrollLeft + 6;\n styleEl.innerHTML = `\n ${cssSelector}::after {\n ${dynamicStyles}\n bottom: ${offsetFromBottom}px;\n right: ${offsetFromRight}px;\n }\n `;\n }\n };\n\n textarea?.addEventListener(\"scroll\", handleScroll);\n\n // Cleanup\n return () => {\n document.getElementById(\"dynamic-styles\")?.remove();\n textarea?.removeEventListener(\"scroll\", handleScroll);\n };\n }, [disableBranding, suggestionStyleAugmented]);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/standard-autosuggestions/autosuggestions-config.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAoBO,IAAM,0BAA4C,CACvD,eACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBlB;AAAA;AAAA;AAGF;AAEO,IAAM,yBAAkD;AAAA,EAC7D;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;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,SACE;AAAA,EACJ;AACF;AACO,IAAM,+BAGT,iCACC,mCADD;AAAA,EAGF,aAAa,oBAAoB;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,2BAA2B;AAAA,EAC3B,iBAAiB;AACnB","sourcesContent":["import {\n BaseAutosuggestionsConfig,\n defaultBaseAutosuggestionsConfig,\n} from \"../base\";\nimport { ChatlikeApiEndpoint } from \"./chatlike-api-endpoint\";\nimport { MinimalChatGPTMessage } from \"./minimal-chat-gpt-message\";\n\nexport type MakeSystemPrompt = (\n purposePrompt: string,\n contextString: string\n) => string;\n\nexport interface AutosuggestionsConfig extends BaseAutosuggestionsConfig {\n apiEndpoint: ChatlikeApiEndpoint;\n externalContextCategories: string[] | undefined;\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: MinimalChatGPTMessage[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultMakeSystemPrompt: MakeSystemPrompt = (\n purposePrompt,\n contextString\n) => {\n return `You are a versatile writing assistant.\n \nThe user is writing some text.\nThe purpose is: \\\"${purposePrompt}\\\"\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 defaultFewShotMessages: 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: \"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];\nexport const defaultAutosuggestionsConfig: Omit<\n AutosuggestionsConfig,\n \"purposePrompt\"\n> = {\n ...defaultBaseAutosuggestionsConfig,\n\n apiEndpoint: ChatlikeApiEndpoint.standardOpenAIEndpoint(\n \"api/autosuggestions\"\n ),\n makeSystemPrompt: defaultMakeSystemPrompt,\n fewShotMessages: defaultFewShotMessages,\n externalContextCategories: undefined,\n forwardedParams: undefined,\n};\n"]}
|
|
File without changes
|
|
File without changes
|