@copilotkit/react-textarea 0.17.0 → 0.19.0-alpha.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 +304 -190
- package/CHANGELOG.md +17 -0
- package/dist/chunk-2NURR2DX.mjs +47 -0
- package/dist/chunk-2NURR2DX.mjs.map +1 -0
- package/dist/chunk-3YJ63D5D.mjs +106 -0
- package/dist/chunk-3YJ63D5D.mjs.map +1 -0
- package/dist/chunk-4S5ZJH3I.mjs +18 -0
- package/dist/chunk-4S5ZJH3I.mjs.map +1 -0
- package/dist/chunk-4T72ROFJ.mjs +469 -0
- package/dist/chunk-4T72ROFJ.mjs.map +1 -0
- package/dist/chunk-55EGOC5T.mjs +87 -0
- package/dist/chunk-55EGOC5T.mjs.map +1 -0
- package/dist/{chunk-3A2CNIG5.mjs → chunk-5ARCOTW3.mjs} +8 -5
- package/dist/chunk-5ARCOTW3.mjs.map +1 -0
- package/dist/chunk-5EJ5XOGP.mjs +22 -0
- package/dist/chunk-5EJ5XOGP.mjs.map +1 -0
- package/dist/chunk-5FO6ISW4.mjs +3 -0
- package/dist/{chunk-JWN2VEE3.mjs → chunk-A2RRLD23.mjs} +13 -12
- package/dist/chunk-A2RRLD23.mjs.map +1 -0
- package/dist/chunk-ASPOPGV7.mjs +47 -0
- package/dist/chunk-ASPOPGV7.mjs.map +1 -0
- package/dist/chunk-CDB7HFCY.mjs +65 -0
- package/dist/chunk-CDB7HFCY.mjs.map +1 -0
- package/dist/chunk-CIFH63LP.mjs +107 -0
- package/dist/chunk-CIFH63LP.mjs.map +1 -0
- package/dist/{chunk-MFJNLKRC.mjs → chunk-D7SEV5PR.mjs} +4 -3
- package/dist/chunk-D7SEV5PR.mjs.map +1 -0
- package/dist/chunk-HAFHLU4N.mjs +55 -0
- package/dist/chunk-HAFHLU4N.mjs.map +1 -0
- package/dist/{chunk-3UQM3NLM.mjs → chunk-IXJ2HCOA.mjs} +42 -7
- package/dist/chunk-IXJ2HCOA.mjs.map +1 -0
- package/dist/{chunk-UW3ITU2Y.mjs → chunk-JAFCXEPU.mjs} +1 -1
- package/dist/chunk-JAFCXEPU.mjs.map +1 -0
- package/dist/chunk-L7VVZH4Q.mjs +3 -0
- package/dist/{chunk-V54GX4SO.mjs → chunk-MA4NHL3H.mjs} +69 -31
- package/dist/chunk-MA4NHL3H.mjs.map +1 -0
- package/dist/chunk-ND5PXTAW.mjs +17 -0
- package/dist/chunk-ND5PXTAW.mjs.map +1 -0
- package/dist/chunk-O5OWT5GE.mjs +114 -0
- package/dist/chunk-O5OWT5GE.mjs.map +1 -0
- package/dist/chunk-OD7ZMOVE.mjs +45 -0
- package/dist/chunk-OD7ZMOVE.mjs.map +1 -0
- package/dist/chunk-QL2GYGG5.mjs +19 -0
- package/dist/chunk-QL2GYGG5.mjs.map +1 -0
- package/dist/chunk-RQHOUUXQ.mjs +29 -0
- package/dist/chunk-RQHOUUXQ.mjs.map +1 -0
- package/dist/{chunk-HZGSG7ST.mjs → chunk-UHD44NC5.mjs} +10 -5
- package/dist/chunk-UHD44NC5.mjs.map +1 -0
- package/dist/chunk-VBIJPE3H.mjs +108 -0
- package/dist/chunk-VBIJPE3H.mjs.map +1 -0
- package/dist/chunk-VHIS7RTM.mjs +44 -0
- package/dist/chunk-VHIS7RTM.mjs.map +1 -0
- package/dist/chunk-XDT7BF3V.mjs +81 -0
- package/dist/chunk-XDT7BF3V.mjs.map +1 -0
- package/dist/chunk-XHUMROEY.mjs +91 -0
- package/dist/chunk-XHUMROEY.mjs.map +1 -0
- package/dist/{chunk-RKZRCIPE.mjs → chunk-YQU7WG7T.mjs} +3 -3
- package/dist/chunk-YTOPHPSG.mjs +45 -0
- package/dist/chunk-YTOPHPSG.mjs.map +1 -0
- package/dist/chunk-YW3REYX6.mjs +23 -0
- package/dist/chunk-YW3REYX6.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.d.ts +3 -5
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +23 -9
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.d.ts +6 -0
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +5 -0
- package/dist/components/copilot-textarea/copilot-textarea.d.ts +13 -10
- package/dist/components/copilot-textarea/copilot-textarea.mjs +33 -14
- package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +13 -0
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +4 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.d.ts +18 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +4 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.d.ts +8 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +17 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.d.ts +12 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +12 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.d.ts +3 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +13 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/mode-pre-suggestion.d.ts +16 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/mode-pre-suggestion.mjs +5 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/mode-pre-suggestion.mjs.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/mode-suggestion-appearing.d.ts +37 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/mode-suggestion-appearing.mjs +10 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/mode-suggestion-appearing.mjs.map +1 -0
- package/dist/components/index.d.ts +9 -4
- package/dist/components/index.mjs +33 -14
- package/dist/components/manual-ui/chip-with-icon.d.ts +10 -0
- package/dist/components/manual-ui/chip-with-icon.mjs +25 -0
- package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -0
- package/dist/components/source-search-box/source-search-box.d.ts +17 -0
- package/dist/components/source-search-box/source-search-box.mjs +10 -0
- package/dist/components/source-search-box/source-search-box.mjs.map +1 -0
- package/dist/components/ui/button.d.ts +14 -0
- package/dist/components/ui/button.mjs +5 -0
- package/dist/components/ui/button.mjs.map +1 -0
- package/dist/components/ui/card.d.ts +10 -0
- package/dist/components/ui/card.mjs +63 -0
- package/dist/components/ui/card.mjs.map +1 -0
- package/dist/components/ui/command.d.ts +48 -0
- package/dist/components/ui/command.mjs +6 -0
- package/dist/components/ui/command.mjs.map +1 -0
- package/dist/components/ui/dialog.d.ts +18 -0
- package/dist/components/ui/dialog.mjs +5 -0
- package/dist/components/ui/dialog.mjs.map +1 -0
- package/dist/components/ui/label.d.ts +8 -0
- package/dist/components/ui/label.mjs +5 -0
- package/dist/components/ui/label.mjs.map +1 -0
- package/dist/components/ui/separator.d.ts +6 -0
- package/dist/components/ui/separator.mjs +26 -0
- package/dist/components/ui/separator.mjs.map +1 -0
- package/dist/components/ui/textarea.d.ts +7 -0
- package/dist/components/ui/textarea.mjs +22 -0
- package/dist/components/ui/textarea.mjs.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +2 -2
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.d.ts +2 -2
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +3 -3
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +5 -7
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +2 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.d.ts +23 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +5 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs.map +1 -0
- package/dist/hooks/misc/use-autosize-textarea.d.ts +5 -0
- package/dist/hooks/misc/use-autosize-textarea.mjs +4 -0
- package/dist/hooks/misc/use-autosize-textarea.mjs.map +1 -0
- package/dist/index.css +674 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.mjs +34 -15
- package/dist/lib/editor-to-text.mjs +1 -42
- package/dist/lib/editor-to-text.mjs.map +1 -1
- package/dist/lib/get-text-around-cursor.d.ts +10 -3
- package/dist/lib/get-text-around-cursor.mjs +1 -1
- package/dist/lib/retry.d.ts +3 -0
- package/dist/lib/retry.mjs +4 -0
- package/dist/lib/retry.mjs.map +1 -0
- package/dist/lib/slatejs-edits/replace-text.mjs +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.ts +25 -0
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs +3 -0
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs.map +1 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +20 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +10 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -0
- package/dist/types/autosuggestions-config/editing-api-config.d.ts +17 -0
- package/dist/types/autosuggestions-config/editing-api-config.mjs +5 -0
- package/dist/types/autosuggestions-config/editing-api-config.mjs.map +1 -0
- package/dist/types/autosuggestions-config/index.d.ts +10 -0
- package/dist/types/autosuggestions-config/index.mjs +11 -0
- package/dist/types/autosuggestions-config/index.mjs.map +1 -0
- package/dist/types/autosuggestions-config/insertions-api-config.d.ts +17 -0
- package/dist/types/autosuggestions-config/insertions-api-config.mjs +5 -0
- package/dist/types/autosuggestions-config/insertions-api-config.mjs.map +1 -0
- package/dist/types/{standard-autosuggestions → autosuggestions-config/subtypes}/chatlike-api-endpoint.d.ts +7 -4
- package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.mjs +4 -0
- package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.mjs.map +1 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.d.ts +3 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs +3 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs.map +1 -0
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs.map +1 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.d.ts +17 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs +5 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs.map +1 -0
- package/dist/types/base/autosuggestions-bare-function.d.ts +16 -2
- package/dist/types/base/base-autosuggestions-config.d.ts +5 -1
- package/dist/types/base/base-autosuggestions-config.mjs +1 -1
- package/dist/types/base/base-copilot-textarea-props.d.ts +3 -1
- package/dist/types/base/editor-autocomplete-state.mjs +1 -1
- package/dist/types/base/index.mjs +1 -1
- package/dist/types/index.d.ts +8 -3
- package/dist/types/index.mjs +7 -4
- package/package.json +19 -5
- package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +64 -13
- package/src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx +61 -0
- package/src/components/copilot-textarea/copilot-textarea.tsx +29 -17
- package/src/components/hovering-toolbar/hovering-editor-provider.tsx +29 -0
- package/src/components/hovering-toolbar/hovering-toolbar-components.tsx +115 -0
- package/src/components/hovering-toolbar/hovering-toolbar.tsx +156 -0
- package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx +70 -0
- package/src/components/hovering-toolbar/text-insertion-prompt-box/index.ts +2 -0
- package/src/components/hovering-toolbar/text-insertion-prompt-box/mode-pre-suggestion.tsx +83 -0
- package/src/components/hovering-toolbar/text-insertion-prompt-box/mode-suggestion-appearing.tsx +399 -0
- package/src/components/manual-ui/chip-with-icon.tsx +29 -0
- package/src/components/source-search-box/source-search-box.tsx +127 -0
- package/src/components/ui/button.tsx +56 -0
- package/src/components/ui/card.tsx +86 -0
- package/src/components/ui/command.tsx +155 -0
- package/src/components/ui/dialog.tsx +123 -0
- package/src/components/ui/label.tsx +26 -0
- package/src/components/ui/separator.tsx +31 -0
- package/src/components/ui/textarea.tsx +24 -0
- package/src/hooks/base-copilot-textarea-implementation/use-autosuggestions.ts +10 -3
- package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +29 -44
- package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +150 -0
- package/src/hooks/misc/use-autosize-textarea.tsx +21 -0
- package/src/lib/get-text-around-cursor.ts +71 -6
- package/src/lib/retry.tsx +23 -0
- package/src/lib/slatejs-edits/replace-text.ts +15 -31
- package/src/styles.css +2 -0
- package/src/types/autosuggestions-config/autosuggestions-config-user-specified.tsx +27 -0
- package/src/types/autosuggestions-config/autosuggestions-config.tsx +43 -0
- package/src/types/autosuggestions-config/editing-api-config.tsx +102 -0
- package/src/types/autosuggestions-config/index.ts +11 -0
- package/src/types/autosuggestions-config/insertions-api-config.tsx +95 -0
- package/src/types/{standard-autosuggestions → autosuggestions-config/subtypes}/chatlike-api-endpoint.tsx +19 -7
- package/src/types/autosuggestions-config/subtypes/make-system-prompt.ts +4 -0
- package/src/types/{standard-autosuggestions/autosuggestions-config.tsx → autosuggestions-config/suggestions-api-config.tsx} +12 -23
- package/src/types/base/autosuggestions-bare-function.ts +24 -2
- package/src/types/base/base-autosuggestions-config.tsx +7 -2
- package/src/types/base/base-copilot-textarea-props.tsx +3 -1
- package/src/types/base/editor-autocomplete-state.ts +1 -0
- package/src/types/index.ts +1 -1
- package/tailwind.config.js +2 -0
- package/dist/chunk-3A2CNIG5.mjs.map +0 -1
- package/dist/chunk-3UQM3NLM.mjs.map +0 -1
- package/dist/chunk-BTAUKCBN.mjs +0 -60
- package/dist/chunk-BTAUKCBN.mjs.map +0 -1
- package/dist/chunk-HZGSG7ST.mjs.map +0 -1
- package/dist/chunk-JWN2VEE3.mjs.map +0 -1
- package/dist/chunk-KW6VCM7T.mjs +0 -40
- package/dist/chunk-KW6VCM7T.mjs.map +0 -1
- package/dist/chunk-MFJNLKRC.mjs.map +0 -1
- package/dist/chunk-O5VWVXYD.mjs +0 -32
- package/dist/chunk-O5VWVXYD.mjs.map +0 -1
- package/dist/chunk-SL4J5HMW.mjs +0 -3
- package/dist/chunk-UW3ITU2Y.mjs.map +0 -1
- package/dist/chunk-V54GX4SO.mjs.map +0 -1
- package/dist/types/standard-autosuggestions/autosuggestions-config.d.ts +0 -19
- package/dist/types/standard-autosuggestions/autosuggestions-config.mjs +0 -6
- package/dist/types/standard-autosuggestions/chatlike-api-endpoint.mjs +0 -4
- package/dist/types/standard-autosuggestions/index.d.ts +0 -4
- package/dist/types/standard-autosuggestions/index.mjs +0 -8
- package/src/types/standard-autosuggestions/index.ts +0 -14
- /package/dist/{chunk-SL4J5HMW.mjs.map → chunk-5FO6ISW4.mjs.map} +0 -0
- /package/dist/{types/standard-autosuggestions/autosuggestions-config.mjs.map → chunk-L7VVZH4Q.mjs.map} +0 -0
- /package/dist/{chunk-RKZRCIPE.mjs.map → chunk-YQU7WG7T.mjs.map} +0 -0
- /package/dist/{types/standard-autosuggestions/chatlike-api-endpoint.mjs.map → components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs.map} +0 -0
- /package/dist/{types/standard-autosuggestions/index.mjs.map → components/hovering-toolbar/hovering-editor-provider.mjs.map} +0 -0
- /package/dist/{types/standard-autosuggestions/minimal-chat-gpt-message.mjs.map → components/hovering-toolbar/hovering-toolbar-components.mjs.map} +0 -0
- /package/dist/types/{standard-autosuggestions → autosuggestions-config/subtypes}/minimal-chat-gpt-message.d.ts +0 -0
- /package/dist/types/{standard-autosuggestions → autosuggestions-config/subtypes}/minimal-chat-gpt-message.mjs +0 -0
- /package/src/types/{standard-autosuggestions → autosuggestions-config/subtypes}/minimal-chat-gpt-message.tsx +0 -0
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
import { use_autosize_textarea_default } from './chunk-ND5PXTAW.mjs';
|
|
2
|
+
import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandSeparator } from './chunk-3YJ63D5D.mjs';
|
|
3
|
+
import { Label } from './chunk-5EJ5XOGP.mjs';
|
|
4
|
+
import { Button } from './chunk-2NURR2DX.mjs';
|
|
5
|
+
import { __objRest, __spreadProps, __spreadValues, __async } from './chunk-MRXNTQOX.mjs';
|
|
6
|
+
import { useState, useRef, useEffect } from 'react';
|
|
7
|
+
import { Calendar, Smile, Calculator } from 'lucide-react';
|
|
8
|
+
import Chip from '@mui/material/Chip';
|
|
9
|
+
import Avatar from '@mui/material/Avatar';
|
|
10
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
11
|
+
|
|
12
|
+
var SuggestionAppearing = ({
|
|
13
|
+
performInsertion,
|
|
14
|
+
state,
|
|
15
|
+
goBack,
|
|
16
|
+
insertionOrEditingFunction,
|
|
17
|
+
onGeneratedText
|
|
18
|
+
}) => {
|
|
19
|
+
useState([state.initialSuggestion]);
|
|
20
|
+
const [editSuggestion, setEditSuggestion] = useState("");
|
|
21
|
+
const [suggestionIsLoading, setSuggestionIsLoading] = useState(false);
|
|
22
|
+
const [adjustmentPrompt, setAdjustmentPrompt] = useState("");
|
|
23
|
+
const [adjustmentLoading, setAdjustmentLoading] = useState(false);
|
|
24
|
+
const suggestionTextAreaRef = useRef(null);
|
|
25
|
+
const adjustmentTextAreaRef = useRef(null);
|
|
26
|
+
const [filePointers, setFilePointers] = useState([]);
|
|
27
|
+
use_autosize_textarea_default(suggestionTextAreaRef, editSuggestion || "");
|
|
28
|
+
use_autosize_textarea_default(adjustmentTextAreaRef, adjustmentPrompt || "");
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
(_a = suggestionTextAreaRef.current) == null ? void 0 : _a.focus();
|
|
32
|
+
(_b = suggestionTextAreaRef.current) == null ? void 0 : _b.setSelectionRange(
|
|
33
|
+
editSuggestion.length,
|
|
34
|
+
editSuggestion.length
|
|
35
|
+
);
|
|
36
|
+
}, []);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (state.initialSuggestion.generatingSuggestion.locked) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
setEditSuggestion("");
|
|
42
|
+
const reader = state.initialSuggestion.generatingSuggestion.getReader();
|
|
43
|
+
const read = () => __async(void 0, null, function* () {
|
|
44
|
+
setSuggestionIsLoading(true);
|
|
45
|
+
while (true) {
|
|
46
|
+
const { done, value } = yield reader.read();
|
|
47
|
+
if (done) {
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
setEditSuggestion((prev) => {
|
|
51
|
+
const newSuggestion = prev + value;
|
|
52
|
+
if (suggestionTextAreaRef.current) {
|
|
53
|
+
suggestionTextAreaRef.current.scrollTop = suggestionTextAreaRef.current.scrollHeight;
|
|
54
|
+
}
|
|
55
|
+
return newSuggestion;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
setSuggestionIsLoading(false);
|
|
59
|
+
});
|
|
60
|
+
read();
|
|
61
|
+
return () => {
|
|
62
|
+
const releaseLockIfNotClosed = () => __async(void 0, null, function* () {
|
|
63
|
+
try {
|
|
64
|
+
yield reader.closed;
|
|
65
|
+
} catch (e) {
|
|
66
|
+
reader.releaseLock();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
releaseLockIfNotClosed();
|
|
70
|
+
};
|
|
71
|
+
}, [state]);
|
|
72
|
+
const generateAdjustment = () => __async(void 0, null, function* () {
|
|
73
|
+
if (!adjustmentPrompt.trim()) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
setAdjustmentLoading(true);
|
|
77
|
+
const adjustmentSuggestionTextStream = yield insertionOrEditingFunction(
|
|
78
|
+
__spreadProps(__spreadValues({}, state.initialSuggestion.editorState), {
|
|
79
|
+
selectedText: editSuggestion
|
|
80
|
+
}),
|
|
81
|
+
adjustmentPrompt,
|
|
82
|
+
new AbortController().signal
|
|
83
|
+
);
|
|
84
|
+
setAdjustmentLoading(false);
|
|
85
|
+
onGeneratedText(adjustmentSuggestionTextStream);
|
|
86
|
+
});
|
|
87
|
+
const showLoading = suggestionIsLoading || adjustmentLoading;
|
|
88
|
+
const AdjustmentPromptComponent = /* @__PURE__ */ jsxs(Fragment, {
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ jsx(Label, {
|
|
91
|
+
className: "",
|
|
92
|
+
children: "Describe adjustments to the suggested text:"
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ jsxs("div", {
|
|
95
|
+
className: "relative w-full flex items-center",
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsx("textarea", {
|
|
98
|
+
disabled: suggestionIsLoading,
|
|
99
|
+
ref: adjustmentTextAreaRef,
|
|
100
|
+
value: adjustmentPrompt,
|
|
101
|
+
onChange: (e) => setAdjustmentPrompt(e.target.value),
|
|
102
|
+
onKeyDown: (e) => {
|
|
103
|
+
if (e.key === "Enter" && e.shiftKey) {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
setAdjustmentPrompt(adjustmentPrompt + "\n");
|
|
106
|
+
} else if (e.key === "Enter") {
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
generateAdjustment();
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
placeholder: '"make it more formal", "be more specific", ...',
|
|
112
|
+
style: { minHeight: "3rem" },
|
|
113
|
+
className: "w-full bg-slate-100 h-auto h-min-14 text-sm p-2 rounded-md resize-none overflow-visible focus:outline-none focus:ring-0 focus:border-non pr-[3rem]",
|
|
114
|
+
rows: 1
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ jsx("button", {
|
|
117
|
+
onClick: generateAdjustment,
|
|
118
|
+
className: "absolute right-2 bg-blue-500 text-white w-8 h-8 rounded-full flex items-center justify-center",
|
|
119
|
+
children: /* @__PURE__ */ jsx("i", {
|
|
120
|
+
className: "material-icons",
|
|
121
|
+
children: "arrow_forward"
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
]
|
|
125
|
+
})
|
|
126
|
+
]
|
|
127
|
+
});
|
|
128
|
+
const SuggestionComponent = /* @__PURE__ */ jsxs(Fragment, {
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ jsxs("div", {
|
|
131
|
+
className: "flex justify-between items-end w-full",
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ jsx(Label, {
|
|
134
|
+
className: "mt-4",
|
|
135
|
+
children: "Suggested:"
|
|
136
|
+
}),
|
|
137
|
+
/* @__PURE__ */ jsx("div", {
|
|
138
|
+
className: "ml-auto",
|
|
139
|
+
children: showLoading && /* @__PURE__ */ jsx("div", {
|
|
140
|
+
className: "flex justify-center items-center",
|
|
141
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
142
|
+
className: "inline-block h-4 w-4 animate-spin rounded-full border-4 border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite]",
|
|
143
|
+
role: "status",
|
|
144
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
145
|
+
className: "!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]",
|
|
146
|
+
children: "Loading..."
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
}),
|
|
153
|
+
/* @__PURE__ */ jsx("textarea", {
|
|
154
|
+
ref: suggestionTextAreaRef,
|
|
155
|
+
value: editSuggestion,
|
|
156
|
+
disabled: adjustmentLoading,
|
|
157
|
+
onChange: (e) => setEditSuggestion(e.target.value),
|
|
158
|
+
className: "w-full text-base p-2 border border-gray-300 rounded-md resize-none bg-green-50",
|
|
159
|
+
style: { overflow: "auto", maxHeight: "10em" }
|
|
160
|
+
})
|
|
161
|
+
]
|
|
162
|
+
});
|
|
163
|
+
const SubmitComponent = /* @__PURE__ */ jsxs("div", {
|
|
164
|
+
className: "flex w-full gap-4 justify-start",
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
167
|
+
className: " bg-gray-300",
|
|
168
|
+
onClick: () => {
|
|
169
|
+
goBack();
|
|
170
|
+
},
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ jsx("i", {
|
|
173
|
+
className: "material-icons",
|
|
174
|
+
children: "arrow_back"
|
|
175
|
+
}),
|
|
176
|
+
" Back"
|
|
177
|
+
]
|
|
178
|
+
}),
|
|
179
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
180
|
+
className: " bg-green-700 text-white",
|
|
181
|
+
onClick: () => {
|
|
182
|
+
performInsertion(editSuggestion);
|
|
183
|
+
},
|
|
184
|
+
children: [
|
|
185
|
+
"Insert ",
|
|
186
|
+
/* @__PURE__ */ jsx("i", {
|
|
187
|
+
className: "material-icons",
|
|
188
|
+
children: "check"
|
|
189
|
+
})
|
|
190
|
+
]
|
|
191
|
+
})
|
|
192
|
+
]
|
|
193
|
+
});
|
|
194
|
+
const sourceSearchCandidate = adjustmentPrompt.split(" ").pop();
|
|
195
|
+
const sourceSearchWord = (sourceSearchCandidate == null ? void 0 : sourceSearchCandidate.startsWith("@")) ? sourceSearchCandidate.slice(1) : void 0;
|
|
196
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
197
|
+
className: "w-full flex flex-col items-start relative gap-2",
|
|
198
|
+
children: [
|
|
199
|
+
AdjustmentPromptComponent,
|
|
200
|
+
filePointers.length > 0 && /* @__PURE__ */ jsx(IncludedFilesPreview, {
|
|
201
|
+
includedFiles: filePointers,
|
|
202
|
+
setIncludedFiles: setFilePointers
|
|
203
|
+
}),
|
|
204
|
+
sourceSearchWord !== void 0 && /* @__PURE__ */ jsx(SourceSearchBox, {
|
|
205
|
+
searchTerm: sourceSearchWord,
|
|
206
|
+
recentFiles: mockFiles,
|
|
207
|
+
onSelectedFile: (filePointer) => {
|
|
208
|
+
var _a;
|
|
209
|
+
setAdjustmentPrompt(
|
|
210
|
+
adjustmentPrompt.replace(
|
|
211
|
+
new RegExp(`@${sourceSearchWord}$`),
|
|
212
|
+
""
|
|
213
|
+
)
|
|
214
|
+
);
|
|
215
|
+
setFilePointers((prev) => [...prev, filePointer]);
|
|
216
|
+
(_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
|
|
217
|
+
}
|
|
218
|
+
}),
|
|
219
|
+
SuggestionComponent,
|
|
220
|
+
SubmitComponent
|
|
221
|
+
]
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
var IncludedFilesPreview = ({ includedFiles, setIncludedFiles }) => {
|
|
225
|
+
return /* @__PURE__ */ jsx("div", {
|
|
226
|
+
className: "flex flex-col gap-2",
|
|
227
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
228
|
+
className: "flex flex-wrap gap-2",
|
|
229
|
+
children: includedFiles.map((filePointer, index) => {
|
|
230
|
+
return /* @__PURE__ */ jsx(FileChipPreview, {
|
|
231
|
+
filePointer,
|
|
232
|
+
onDelete: () => {
|
|
233
|
+
setIncludedFiles((prev) => prev.filter((fp) => fp !== filePointer));
|
|
234
|
+
}
|
|
235
|
+
}, `file-${filePointer.sourceApplication}.${filePointer.name}`);
|
|
236
|
+
})
|
|
237
|
+
})
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
var FileChipPreview = ({
|
|
241
|
+
filePointer,
|
|
242
|
+
onDelete
|
|
243
|
+
}) => {
|
|
244
|
+
return /* @__PURE__ */ jsx(Chip, {
|
|
245
|
+
label: filePointer.name,
|
|
246
|
+
onDelete,
|
|
247
|
+
avatar: /* @__PURE__ */ jsx(Avatar, {
|
|
248
|
+
sx: { backgroundColor: "transparent" },
|
|
249
|
+
children: /* @__PURE__ */ jsx(IconForFilePointer, {
|
|
250
|
+
filePointer,
|
|
251
|
+
className: "w-4 h-4 object-contain"
|
|
252
|
+
})
|
|
253
|
+
})
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
function IconForFilePointer({ filePointer, className }) {
|
|
257
|
+
if (filePointer.sourceApplication === "Salesforce") {
|
|
258
|
+
return /* @__PURE__ */ jsx(IconSalesforce, {
|
|
259
|
+
className
|
|
260
|
+
});
|
|
261
|
+
} else {
|
|
262
|
+
return /* @__PURE__ */ jsx(IconSalesforce, {
|
|
263
|
+
className
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
function IconSalesforce(_a) {
|
|
268
|
+
var _b = _a, props = __objRest(_b, ["className"]);
|
|
269
|
+
return /* @__PURE__ */ jsxs("svg", __spreadProps(__spreadValues({
|
|
270
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
271
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
272
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
273
|
+
viewBox: "0 0 273 191"
|
|
274
|
+
}, props), {
|
|
275
|
+
children: [
|
|
276
|
+
/* @__PURE__ */ jsx("title", {
|
|
277
|
+
children: "Salesforce.com logo"
|
|
278
|
+
}),
|
|
279
|
+
/* @__PURE__ */ jsx("defs", {
|
|
280
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
281
|
+
id: "a",
|
|
282
|
+
d: "M.06.5h272v190H.06z"
|
|
283
|
+
})
|
|
284
|
+
}),
|
|
285
|
+
/* @__PURE__ */ jsxs("g", {
|
|
286
|
+
fillRule: "evenodd",
|
|
287
|
+
children: [
|
|
288
|
+
/* @__PURE__ */ jsx("mask", {
|
|
289
|
+
id: "b",
|
|
290
|
+
fill: "#fff",
|
|
291
|
+
children: /* @__PURE__ */ jsx("use", {
|
|
292
|
+
xlinkHref: "#a"
|
|
293
|
+
})
|
|
294
|
+
}),
|
|
295
|
+
/* @__PURE__ */ jsx("path", {
|
|
296
|
+
fill: "#00A1E0",
|
|
297
|
+
d: "M113 21.3c8.78-9.14 21-14.8 34.5-14.8 18 0 33.6 10 42 24.9a58 58 0 0 1 23.7-5.05c32.4 0 58.7 26.5 58.7 59.2s-26.3 59.2-58.7 59.2c-3.96 0-7.82-.398-11.6-1.15-7.35 13.1-21.4 22-37.4 22a42.7 42.7 0 0 1-18.8-4.32c-7.45 17.5-24.8 29.8-45 29.8-21.1 0-39-13.3-45.9-32a45.1 45.1 0 0 1-9.34.972c-25.1 0-45.4-20.6-45.4-45.9 0-17 9.14-31.8 22.7-39.8a52.6 52.6 0 0 1-4.35-21c0-29.2 23.7-52.8 52.9-52.8 17.1 0 32.4 8.15 42 20.8",
|
|
298
|
+
mask: "url(#b)"
|
|
299
|
+
}),
|
|
300
|
+
/* @__PURE__ */ jsx("path", {
|
|
301
|
+
fill: "#FFFFFE",
|
|
302
|
+
d: "M39.4 99.3c-.171.446.061.539.116.618.511.37 1.03.638 1.55.939 2.78 1.47 5.4 1.9 8.14 1.9 5.58 0 9.05-2.97 9.05-7.75v-.094c0-4.42-3.92-6.03-7.58-7.18l-.479-.155c-2.77-.898-5.16-1.68-5.16-3.5v-.093c0-1.56 1.4-2.71 3.56-2.71 2.4 0 5.26.799 7.09 1.81 0 0 .542.35.739-.173.107-.283 1.04-2.78 1.14-3.06.106-.293-.08-.514-.271-.628-2.1-1.28-5-2.15-8-2.15l-.557.002c-5.11 0-8.68 3.09-8.68 7.51v.095c0 4.66 3.94 6.18 7.62 7.23l.592.184c2.68.824 5 1.54 5 3.42v.094c0 1.73-1.51 3.02-3.93 3.02-.941 0-3.94-.016-7.19-2.07-.393-.229-.617-.394-.92-.579-.16-.097-.56-.272-.734.252l-1.1 3.06m81.7 0c-.171.446.061.539.118.618.509.37 1.03.638 1.55.939 2.78 1.47 5.4 1.9 8.14 1.9 5.58 0 9.05-2.97 9.05-7.75v-.094c0-4.42-3.91-6.03-7.58-7.18l-.479-.155c-2.77-.898-5.16-1.68-5.16-3.5v-.093c0-1.56 1.4-2.71 3.56-2.71 2.4 0 5.25.799 7.09 1.81 0 0 .542.35.74-.173.106-.283 1.04-2.78 1.13-3.06.107-.293-.08-.514-.27-.628-2.1-1.28-5-2.15-8-2.15l-.558.002c-5.11 0-8.68 3.09-8.68 7.51v.095c0 4.66 3.94 6.18 7.62 7.23l.591.184c2.69.824 5 1.54 5 3.42v.094c0 1.73-1.51 3.02-3.93 3.02-.943 0-3.95-.016-7.19-2.07-.393-.229-.623-.387-.921-.579-.101-.064-.572-.248-.733.252l-1.1 3.06m55.8-9.36c0 2.7-.504 4.83-1.49 6.34-.984 1.49-2.47 2.22-4.54 2.22s-3.55-.724-4.52-2.21c-.977-1.5-1.47-3.64-1.47-6.34 0-2.7.496-4.82 1.47-6.31.968-1.48 2.44-2.19 4.52-2.19s3.56.717 4.54 2.19c.992 1.49 1.49 3.61 1.49 6.31m4.66-5.01c-.459-1.55-1.17-2.91-2.12-4.05a10.151 10.151 0 0 0-3.58-2.72c-1.42-.665-3.1-1-5-1s-3.57.337-5 1c-1.42.664-2.63 1.58-3.58 2.72-.948 1.14-1.66 2.5-2.12 4.05-.455 1.54-.686 3.22-.686 5.01 0 1.79.231 3.47.686 5.01.457 1.55 1.17 2.91 2.12 4.05.951 1.14 2.16 2.05 3.58 2.7 1.43.648 3.11.978 5 .978 1.89 0 3.57-.33 4.99-.978 1.42-.648 2.63-1.56 3.58-2.7.949-1.14 1.66-2.5 2.12-4.05.454-1.54.685-3.22.685-5.01 0-1.78-.231-3.47-.685-5.01m38.3 12.8c-.153-.453-.595-.282-.595-.282-.677.259-1.4.499-2.17.619-.776.122-1.64.183-2.55.183-2.25 0-4.05-.671-5.33-2-1.29-1.33-2.01-3.47-2-6.37.007-2.64.645-4.62 1.79-6.14 1.13-1.5 2.87-2.28 5.17-2.28 1.92 0 3.39.223 4.93.705 0 0 .365.159.54-.322.409-1.13.711-1.94 1.15-3.18.124-.355-.18-.505-.291-.548-.604-.236-2.03-.623-3.11-.786-1.01-.154-2.18-.234-3.5-.234-1.96 0-3.7.335-5.19.999-1.49.663-2.75 1.58-3.75 2.72-1 1.14-1.76 2.5-2.27 4.05-.505 1.54-.76 3.23-.76 5.02 0 3.86 1.04 6.99 3.1 9.28 2.06 2.3 5.16 3.46 9.2 3.46 2.39 0 4.84-.483 6.6-1.18 0 0 .336-.162.19-.554l-1.15-3.16m8.15-10.4c.223-1.5.634-2.75 1.28-3.72.967-1.48 2.44-2.29 4.51-2.29s3.44.814 4.42 2.29c.65.975.934 2.27 1.04 3.72l-11.3-.002zm15.7-3.3c-.397-1.49-1.38-3-2.02-3.69-1.02-1.09-2.01-1.86-3-2.28a11.5 11.5 0 0 0-4.52-.917c-1.97 0-3.76.333-5.21 1.01-1.45.682-2.67 1.61-3.63 2.77-.959 1.16-1.68 2.53-2.14 4.1-.46 1.55-.692 3.25-.692 5.03 0 1.82.241 3.51.715 5.04.479 1.54 1.25 2.89 2.29 4.01 1.04 1.13 2.37 2.01 3.97 2.63 1.59.615 3.52.934 5.73.927 4.56-.015 6.96-1.03 7.94-1.58.175-.098.34-.267.134-.754l-1.03-2.89c-.158-.431-.594-.275-.594-.275-1.13.422-2.73 1.18-6.48 1.17-2.45-.004-4.26-.727-5.4-1.86-1.16-1.16-1.74-2.85-1.83-5.25l15.8.012s.416-.004.459-.41c.017-.168.541-3.24-.471-6.79zm-142 3.3c.223-1.5.635-2.75 1.28-3.72.968-1.48 2.44-2.29 4.51-2.29s3.44.814 4.42 2.29c.649.975.933 2.27 1.04 3.72l-11.3-.002zm15.7-3.3c-.396-1.49-1.38-3-2.02-3.69-1.02-1.09-2.01-1.86-3-2.28a11.5 11.5 0 0 0-4.52-.917c-1.97 0-3.76.333-5.21 1.01-1.45.682-2.67 1.61-3.63 2.77-.957 1.16-1.68 2.53-2.14 4.1-.459 1.55-.69 3.25-.69 5.03 0 1.82.239 3.51.716 5.04.478 1.54 1.25 2.89 2.28 4.01 1.04 1.13 2.37 2.01 3.97 2.63 1.59.615 3.51.934 5.73.927 4.56-.015 6.96-1.03 7.94-1.58.174-.098.34-.267.133-.754l-1.03-2.89c-.159-.431-.595-.275-.595-.275-1.13.422-2.73 1.18-6.48 1.17-2.44-.004-4.26-.727-5.4-1.86-1.16-1.16-1.74-2.85-1.83-5.25l15.8.012s.416-.004.459-.41c.017-.168.541-3.24-.472-6.79zm-49.8 13.6c-.619-.494-.705-.615-.91-.936-.313-.483-.473-1.17-.473-2.05 0-1.38.46-2.38 1.41-3.05-.01.002 1.36-1.18 4.58-1.14a32 32 0 0 1 4.28.365v7.17h.002s-2 .431-4.26.567c-3.21.193-4.63-.924-4.62-.921zm6.28-11.1c-.64-.047-1.47-.07-2.46-.07-1.35 0-2.66.168-3.88.498-1.23.332-2.34.846-3.29 1.53a7.63 7.63 0 0 0-2.29 2.6c-.559 1.04-.844 2.26-.844 3.64 0 1.4.243 2.61.723 3.6a6.54 6.54 0 0 0 2.06 2.47c.877.638 1.96 1.11 3.21 1.39 1.24.283 2.64.426 4.18.426 1.62 0 3.23-.136 4.79-.399a95.1 95.1 0 0 0 3.97-.772c.526-.121 1.11-.28 1.11-.28.39-.099.36-.516.36-.516l-.009-14.4c0-3.16-.844-5.51-2.51-6.96-1.66-1.45-4.09-2.18-7.24-2.18-1.18 0-3.09.16-4.23.389 0 0-3.44.668-4.86 1.78 0 0-.312.192-.142.627l1.12 3c.139.389.518.256.518.256s.119-.047.259-.13c3.03-1.65 6.87-1.6 6.87-1.6 1.7 0 3.02.345 3.9 1.02.861.661 1.3 1.66 1.3 3.76v.667c-1.35-.196-2.6-.309-2.6-.309zm127-8.13a.428.428 0 0 0-.237-.568c-.269-.102-1.61-.385-2.64-.449-1.98-.124-3.08.21-4.07.654-.978.441-2.06 1.15-2.66 1.97l-.002-1.92c0-.264-.187-.477-.453-.477h-4.04c-.262 0-.452.213-.452.477v23.5a.48.48 0 0 0 .479.479h4.14a.479.479 0 0 0 .478-.479v-11.8c0-1.58.174-3.15.521-4.14.342-.979.807-1.76 1.38-2.32a4.79 4.79 0 0 1 1.95-1.17 7.68 7.68 0 0 1 2.12-.298c.825 0 1.73.212 1.73.212.304.034.473-.152.576-.426.271-.721 1.04-2.88 1.19-3.31"
|
|
303
|
+
}),
|
|
304
|
+
/* @__PURE__ */ jsx("path", {
|
|
305
|
+
fill: "#FFFFFE",
|
|
306
|
+
d: "M162.201 67.548a13.258 13.258 0 0 0-1.559-.37 12.217 12.217 0 0 0-2.144-.166c-2.853 0-5.102.806-6.681 2.398-1.568 1.58-2.635 3.987-3.17 7.154l-.193 1.069h-3.581s-.437-.018-.529.459l-.588 3.28c-.041.314.094.51.514.508h3.486l-3.537 19.743c-.277 1.59-.594 2.898-.945 3.889-.346.978-.684 1.711-1.1 2.243-.403.515-.785.894-1.444 1.115-.544.183-1.17.267-1.856.267-.382 0-.89-.064-1.265-.139-.375-.074-.57-.158-.851-.276 0 0-.409-.156-.57.254-.131.335-1.06 2.89-1.17 3.206-.112.312.045.558.243.629.464.166.809.272 1.441.421.878.207 1.618.22 2.311.22 1.452 0 2.775-.204 3.872-.6 1.104-.399 2.065-1.094 2.915-2.035.919-1.015 1.497-2.078 2.05-3.528.547-1.437 1.013-3.221 1.386-5.3l3.554-20.109h5.196s.438.016.529-.459l.588-3.28c.041-.314-.093-.51-.515-.508h-5.043c.025-.114.254-1.888.833-3.558.247-.713.712-1.288 1.106-1.683a3.273 3.273 0 0 1 1.321-.822 5.48 5.48 0 0 1 1.693-.244c.475 0 .941.057 1.296.131.489.104.679.159.807.197.514.157.583.005.684-.244l1.206-3.312c.124-.356-.178-.506-.29-.55m-70.474 34.117c0 .264-.188.479-.452.479h-4.183c-.265 0-.453-.215-.453-.479V67.997c0-.263.188-.476.453-.476h4.183c.264 0 .452.213.452.476v33.668"
|
|
307
|
+
})
|
|
308
|
+
]
|
|
309
|
+
})
|
|
310
|
+
]
|
|
311
|
+
}));
|
|
312
|
+
}
|
|
313
|
+
var mockFiles = [
|
|
314
|
+
{
|
|
315
|
+
name: "prospecting call transcript",
|
|
316
|
+
sourceApplication: "Salesforce",
|
|
317
|
+
getContents: () => __async(void 0, null, function* () {
|
|
318
|
+
return "some contents";
|
|
319
|
+
})
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
name: "customer feedback",
|
|
323
|
+
sourceApplication: "Zendesk",
|
|
324
|
+
getContents: () => __async(void 0, null, function* () {
|
|
325
|
+
return "some contents";
|
|
326
|
+
})
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
name: "product specifications",
|
|
330
|
+
sourceApplication: "Google Docs",
|
|
331
|
+
getContents: () => __async(void 0, null, function* () {
|
|
332
|
+
return "some contents";
|
|
333
|
+
})
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
name: "meeting minutes",
|
|
337
|
+
sourceApplication: "Microsoft Teams",
|
|
338
|
+
getContents: () => __async(void 0, null, function* () {
|
|
339
|
+
return "some contents";
|
|
340
|
+
})
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
name: "project plan",
|
|
344
|
+
sourceApplication: "Trello",
|
|
345
|
+
getContents: () => __async(void 0, null, function* () {
|
|
346
|
+
return "some contents";
|
|
347
|
+
})
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
name: "code review comments",
|
|
351
|
+
sourceApplication: "Github",
|
|
352
|
+
getContents: () => __async(void 0, null, function* () {
|
|
353
|
+
return "some contents";
|
|
354
|
+
})
|
|
355
|
+
}
|
|
356
|
+
];
|
|
357
|
+
function SourceSearchBox(props) {
|
|
358
|
+
const [selectedValue, setSelectedValue] = useState("");
|
|
359
|
+
return /* @__PURE__ */ jsxs(Command, {
|
|
360
|
+
className: "rounded-lg border shadow-md",
|
|
361
|
+
value: selectedValue,
|
|
362
|
+
onValueChange: (value) => {
|
|
363
|
+
setSelectedValue(value);
|
|
364
|
+
},
|
|
365
|
+
filter: (value, search) => {
|
|
366
|
+
if (props.searchTerm === "")
|
|
367
|
+
return 1;
|
|
368
|
+
if (value.startsWith(props.searchTerm))
|
|
369
|
+
return 1;
|
|
370
|
+
return 0;
|
|
371
|
+
},
|
|
372
|
+
children: [
|
|
373
|
+
/* @__PURE__ */ jsx(CommandInput, {
|
|
374
|
+
value: props.searchTerm,
|
|
375
|
+
className: "rounded-t-lg hidden",
|
|
376
|
+
placeholder: "Search for a command..."
|
|
377
|
+
}),
|
|
378
|
+
/* @__PURE__ */ jsxs(CommandList, {
|
|
379
|
+
children: [
|
|
380
|
+
/* @__PURE__ */ jsx(CommandEmpty, {
|
|
381
|
+
children: "No results found."
|
|
382
|
+
}),
|
|
383
|
+
/* @__PURE__ */ jsx(CommandGroup, {
|
|
384
|
+
heading: "Recents",
|
|
385
|
+
children: props.recentFiles.map((filePointer) => {
|
|
386
|
+
return /* @__PURE__ */ jsx(CommandItem, {
|
|
387
|
+
value: filePointer.name,
|
|
388
|
+
onSelect: (value) => {
|
|
389
|
+
console.log(filePointer.name);
|
|
390
|
+
props.onSelectedFile(filePointer);
|
|
391
|
+
},
|
|
392
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
393
|
+
className: "flex flex-row gap-3 items-center bg-slate-400 ",
|
|
394
|
+
children: [
|
|
395
|
+
/* @__PURE__ */ jsx(Logo, {
|
|
396
|
+
size: "40px",
|
|
397
|
+
children: /* @__PURE__ */ jsx(IconForFilePointer, {
|
|
398
|
+
filePointer,
|
|
399
|
+
className: "mx-auto my-auto"
|
|
400
|
+
})
|
|
401
|
+
}),
|
|
402
|
+
filePointer.name
|
|
403
|
+
]
|
|
404
|
+
})
|
|
405
|
+
}, `word-${filePointer.sourceApplication}.${filePointer.name}`);
|
|
406
|
+
})
|
|
407
|
+
}),
|
|
408
|
+
/* @__PURE__ */ jsxs(CommandGroup, {
|
|
409
|
+
heading: "Suggestions",
|
|
410
|
+
children: [
|
|
411
|
+
/* @__PURE__ */ jsxs(CommandItem, {
|
|
412
|
+
onSelect: (value) => {
|
|
413
|
+
console.log(value);
|
|
414
|
+
console.log(value);
|
|
415
|
+
},
|
|
416
|
+
children: [
|
|
417
|
+
/* @__PURE__ */ jsx(Calendar, {
|
|
418
|
+
className: "mr-2 h-4 w-4"
|
|
419
|
+
}),
|
|
420
|
+
/* @__PURE__ */ jsx("span", {
|
|
421
|
+
children: "Calendar"
|
|
422
|
+
})
|
|
423
|
+
]
|
|
424
|
+
}),
|
|
425
|
+
/* @__PURE__ */ jsxs(CommandItem, {
|
|
426
|
+
children: [
|
|
427
|
+
/* @__PURE__ */ jsx(Smile, {
|
|
428
|
+
className: "mr-2 h-4 w-4"
|
|
429
|
+
}),
|
|
430
|
+
/* @__PURE__ */ jsx("span", {
|
|
431
|
+
children: "Search Emoji"
|
|
432
|
+
})
|
|
433
|
+
]
|
|
434
|
+
}),
|
|
435
|
+
/* @__PURE__ */ jsxs(CommandItem, {
|
|
436
|
+
children: [
|
|
437
|
+
/* @__PURE__ */ jsx(Calculator, {
|
|
438
|
+
className: "mr-2 h-4 w-4"
|
|
439
|
+
}),
|
|
440
|
+
/* @__PURE__ */ jsx("span", {
|
|
441
|
+
children: "Calculator"
|
|
442
|
+
})
|
|
443
|
+
]
|
|
444
|
+
})
|
|
445
|
+
]
|
|
446
|
+
}),
|
|
447
|
+
/* @__PURE__ */ jsx(CommandSeparator, {})
|
|
448
|
+
]
|
|
449
|
+
})
|
|
450
|
+
]
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
function Logo({ children, size = "20px" }) {
|
|
454
|
+
return /* @__PURE__ */ jsx("div", {
|
|
455
|
+
className: "",
|
|
456
|
+
style: {
|
|
457
|
+
width: size,
|
|
458
|
+
height: size
|
|
459
|
+
},
|
|
460
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
461
|
+
className: "",
|
|
462
|
+
children
|
|
463
|
+
})
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
export { FileChipPreview, IconForFilePointer, IncludedFilesPreview, Logo, SourceSearchBox, SuggestionAppearing };
|
|
468
|
+
//# sourceMappingURL=out.js.map
|
|
469
|
+
//# sourceMappingURL=chunk-4T72ROFJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/source-search-box/source-search-box.tsx","../src/components/hovering-toolbar/text-insertion-prompt-box/mode-suggestion-appearing.tsx"],"names":["useState","jsx","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAAA,iBAAgB;AAazB;AAAA,EACE;AAAA,EACA;AAAA,EAGA;AAAA,OAEK;;;ACPP,SAAgB,WAAW,QAAQ,gBAAgB;AAEnD,OAAO,UAAU;AACjB,OAAO,YAAY;AA8Hf,mBACE,KACA,YAFF;AAxGG,IAAM,sBAA0D,CAAC;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,mBAAmB,oBAAoB,IAAI,SAEhD,CAAC,MAAM,iBAAiB,CAAC;AAE3B,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAiB,EAAE;AAC/D,QAAM,CAAC,qBAAqB,sBAAsB,IAChD,SAAkB,KAAK;AAEzB,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAiB,EAAE;AACnE,QAAM,CAAC,mBAAmB,oBAAoB,IAAI,SAAkB,KAAK;AAEzE,QAAM,wBAAwB,OAA4B,IAAI;AAC9D,QAAM,wBAAwB,OAA4B,IAAI;AAE9D,QAAM,CAAC,cAAc,eAAe,IAAI,SAAwB,CAAC,CAAC;AAElE,gCAAoB,uBAAuB,kBAAkB,EAAE;AAC/D,gCAAoB,uBAAuB,oBAAoB,EAAE;AAGjE,YAAU,MAAM;AAjElB;AAkEI,gCAAsB,YAAtB,mBAA+B;AAC/B,gCAAsB,YAAtB,mBAA+B;AAAA,MAC7B,eAAe;AAAA,MACf,eAAe;AAAA;AAAA,EAEnB,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AAEd,QAAI,MAAM,kBAAkB,qBAAqB,QAAQ;AACvD;AAAA,IACF;AAEA,sBAAkB,EAAE;AAGpB,UAAM,SAAS,MAAM,kBAAkB,qBAAqB,UAAU;AAEtE,UA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iB;AAAA;AAAA,OACpB;AAAA;AAAA,GACF;AAEJ;AAEO,SAAS,KAAK,EAAE,UAAU,OAAO,OAAO,GAAiD;AAC9F,SACE,gBAAAA,KAAC;AAAA,IACC,WAAW;AAAA,IACX,OAAO;AAAA,MACL,OAAO;AAAA,MACP,QAAQ;AAAA,IACV;AAAA,IAEA,0BAAAA,KAAC;AAAA,MAAI,WAAW;AAAA,MACb;AAAA,KACH;AAAA,GACF;AAEJ","sourcesContent":["import { useState } from \"react\";\nimport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n} from \"../ui/command\";\n\nimport {\n Calculator,\n Calendar,\n CreditCard,\n Settings,\n Smile,\n User,\n} from \"lucide-react\";\nimport { IconForFilePointer } from \"../hovering-toolbar/text-insertion-prompt-box/mode-suggestion-appearing\";\n\nexport interface FilePointer {\n name: string;\n sourceApplication: string;\n getContents: () => Promise<string>;\n}\n\nexport interface SourceSearchBoxProps {\n searchTerm: string;\n recentFiles: FilePointer[];\n onSelectedFile: (filePointer: FilePointer) => void;\n}\n\nexport function SourceSearchBox(props: SourceSearchBoxProps) {\n\n const [selectedValue, setSelectedValue] = useState<string>(\"\");\n\n return (\n <Command\n className=\"rounded-lg border shadow-md\"\n value={selectedValue}\n onValueChange={(value) => {\n setSelectedValue(value);\n }}\n filter={(value, search) => {\n // if the search term is empty, show all commands\n if (props.searchTerm === \"\") return 1;\n\n // if the search term is a prefix of the command, show it\n if (value.startsWith(props.searchTerm)) return 1;\n\n // otherwise, don't show it\n return 0;\n }}\n >\n <CommandInput\n value={props.searchTerm}\n className=\"rounded-t-lg hidden\"\n placeholder=\"Search for a command...\"\n />\n <CommandList>\n <CommandEmpty>No results found.</CommandEmpty>\n\n <CommandGroup heading=\"Recents\">\n {props.recentFiles.map((filePointer) => {\n return (\n <CommandItem\n key={`word-${filePointer.sourceApplication}.${filePointer.name}`}\n value={filePointer.name}\n onSelect={(value) => {\n console.log(filePointer.name)\n props.onSelectedFile(filePointer);\n }}\n >\n <div className=\"flex flex-row gap-3 items-center bg-slate-400 \">\n <Logo size=\"40px\">\n <IconForFilePointer filePointer={filePointer} className=\"mx-auto my-auto\" />\n </Logo>\n {filePointer.name}\n </div>\n </CommandItem>\n );\n })}\n </CommandGroup>\n\n <CommandGroup heading=\"Suggestions\">\n <CommandItem\n onSelect={(value) => {\n console.log(value);\n console.log(value);\n }}\n >\n <Calendar className=\"mr-2 h-4 w-4\" />\n <span>Calendar</span>\n </CommandItem>\n <CommandItem>\n <Smile className=\"mr-2 h-4 w-4\" />\n <span>Search Emoji</span>\n </CommandItem>\n <CommandItem>\n <Calculator className=\"mr-2 h-4 w-4\" />\n <span>Calculator</span>\n </CommandItem>\n </CommandGroup>\n <CommandSeparator />\n </CommandList>\n </Command>\n );\n}\n\nexport function Logo({ children, size = '20px' }: { children: React.ReactNode; size?: string }) {\n return (\n <div\n className={\"\"}\n style={{\n width: size,\n height: size,\n }}\n >\n <div className={\"\"}>\n {children}\n </div>\n </div>\n )\n}\n","import useAutosizeTextArea from \"../../../hooks/misc/use-autosize-textarea\";\nimport { MinimalChatGPTMessage } from \"../../../types\";\nimport {\n EditingEditorState,\n Generator_InsertionOrEditingSuggestion,\n} from \"../../../types/base/autosuggestions-bare-function\";\nimport { ChipWithIcon } from \"../../manual-ui/chip-with-icon\";\nimport {\n FilePointer,\n SourceSearchBox,\n} from \"../../source-search-box/source-search-box\";\nimport { Button } from \"../../ui/button\";\nimport { Label } from \"../../ui/label\";\nimport React, { useEffect, useRef, useState } from \"react\";\n\nimport Chip from '@mui/material/Chip';\nimport Avatar from '@mui/material/Avatar';\n\n\nexport type State_SuggestionAppearing = {\n type: \"suggestion-appearing\";\n initialSuggestion: SuggestionSnapshot;\n};\n\ntype SuggestionSnapshot = {\n adjustmentPrompt: string;\n generatingSuggestion: ReadableStream<string>;\n editorState: EditingEditorState;\n};\n\nexport interface SuggestionAppearingProps {\n state: State_SuggestionAppearing;\n performInsertion: (insertedText: string) => void;\n goBack: () => void;\n insertionOrEditingFunction: Generator_InsertionOrEditingSuggestion;\n onGeneratedText: (generatedText: ReadableStream<string>) => void;\n}\n\nexport const SuggestionAppearing: React.FC<SuggestionAppearingProps> = ({\n performInsertion,\n state,\n goBack,\n insertionOrEditingFunction,\n onGeneratedText,\n}) => {\n const [adjustmentHistory, setAdjustmentHistory] = useState<\n SuggestionSnapshot[]\n >([state.initialSuggestion]);\n\n const [editSuggestion, setEditSuggestion] = useState<string>(\"\");\n const [suggestionIsLoading, setSuggestionIsLoading] =\n useState<boolean>(false);\n\n const [adjustmentPrompt, setAdjustmentPrompt] = useState<string>(\"\");\n const [adjustmentLoading, setAdjustmentLoading] = useState<boolean>(false);\n\n const suggestionTextAreaRef = useRef<HTMLTextAreaElement>(null);\n const adjustmentTextAreaRef = useRef<HTMLTextAreaElement>(null);\n\n const [filePointers, setFilePointers] = useState<FilePointer[]>([]);\n\n useAutosizeTextArea(suggestionTextAreaRef, editSuggestion || \"\");\n useAutosizeTextArea(adjustmentTextAreaRef, adjustmentPrompt || \"\");\n\n // initially focus on the end of the suggestion text area\n useEffect(() => {\n suggestionTextAreaRef.current?.focus();\n suggestionTextAreaRef.current?.setSelectionRange(\n editSuggestion.length,\n editSuggestion.length\n );\n }, []);\n\n useEffect(() => {\n // Check if the stream is already locked\n if (state.initialSuggestion.generatingSuggestion.locked) {\n return;\n }\n // reset the edit suggestion\n setEditSuggestion(\"\");\n\n // read the generating suggestion stream and continuously update the edit suggestion\n const reader = state.initialSuggestion.generatingSuggestion.getReader();\n\n const read = async () => {\n setSuggestionIsLoading(true);\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n setEditSuggestion((prev) => {\n const newSuggestion = prev + value;\n // Scroll to the bottom of the textarea. We call this here to make sure scroll-to-bottom is synchronous with the state update.\n if (suggestionTextAreaRef.current) {\n suggestionTextAreaRef.current.scrollTop =\n suggestionTextAreaRef.current.scrollHeight;\n }\n return newSuggestion;\n });\n }\n\n setSuggestionIsLoading(false);\n };\n read();\n\n return () => {\n const releaseLockIfNotClosed = async () => {\n try {\n await reader.closed;\n } catch {\n reader.releaseLock();\n }\n };\n\n releaseLockIfNotClosed();\n };\n }, [state]);\n\n const generateAdjustment = async () => {\n // don't generate text if the prompt is empty\n if (!adjustmentPrompt.trim()) {\n return;\n }\n\n setAdjustmentLoading(true);\n // use insertionOrEditingFunction\n const adjustmentSuggestionTextStream = await insertionOrEditingFunction(\n {\n ...state.initialSuggestion.editorState,\n selectedText: editSuggestion,\n },\n adjustmentPrompt,\n new AbortController().signal\n );\n setAdjustmentLoading(false);\n onGeneratedText(adjustmentSuggestionTextStream);\n };\n\n const showLoading = suggestionIsLoading || adjustmentLoading;\n\n const AdjustmentPromptComponent = (\n <>\n <Label className=\"\">Describe adjustments to the suggested text:</Label>\n <div className=\"relative w-full flex items-center\">\n <textarea\n disabled={suggestionIsLoading}\n ref={adjustmentTextAreaRef}\n value={adjustmentPrompt}\n onChange={(e) => setAdjustmentPrompt(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && e.shiftKey) {\n e.preventDefault();\n setAdjustmentPrompt(adjustmentPrompt + \"\\n\");\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n generateAdjustment();\n }\n }}\n placeholder={'\"make it more formal\", \"be more specific\", ...'}\n style={{ minHeight: \"3rem\" }}\n className=\"w-full bg-slate-100 h-auto h-min-14 text-sm p-2 rounded-md resize-none overflow-visible focus:outline-none focus:ring-0 focus:border-non pr-[3rem]\"\n rows={1}\n />\n <button\n onClick={generateAdjustment}\n className=\"absolute right-2 bg-blue-500 text-white w-8 h-8 rounded-full flex items-center justify-center\"\n >\n <i className=\"material-icons\">arrow_forward</i>\n </button>\n </div>\n </>\n );\n\n const SuggestionComponent = (\n <>\n <div className=\"flex justify-between items-end w-full\">\n <Label className=\"mt-4\">Suggested:</Label>\n <div className=\"ml-auto\">\n {showLoading && (\n <div className=\"flex justify-center items-center\">\n <div\n className=\"inline-block h-4 w-4 animate-spin rounded-full border-4 border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite]\"\n role=\"status\"\n >\n <span className=\"!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]\">\n Loading...\n </span>\n </div>\n </div>\n )}\n </div>\n </div>\n <textarea\n ref={suggestionTextAreaRef}\n value={editSuggestion}\n disabled={adjustmentLoading}\n onChange={(e) => setEditSuggestion(e.target.value)}\n className=\"w-full text-base p-2 border border-gray-300 rounded-md resize-none bg-green-50\"\n style={{ overflow: \"auto\", maxHeight: \"10em\" }}\n />\n </>\n );\n\n const SubmitComponent = (\n <div className=\"flex w-full gap-4 justify-start\">\n <Button\n className=\" bg-gray-300\"\n onClick={() => {\n goBack();\n }}\n >\n <i className=\"material-icons\">arrow_back</i> Back\n </Button>\n\n <Button\n className=\" bg-green-700 text-white\"\n onClick={() => {\n performInsertion(editSuggestion);\n }}\n >\n Insert <i className=\"material-icons\">check</i>\n </Button>\n </div>\n );\n\n // show source search if the last word in the adjustment prompt BEGINS with an @\n const sourceSearchCandidate = adjustmentPrompt.split(\" \").pop();\n // if the candidate is @someCandidate, then 'someCandidate', otherwise undefined\n const sourceSearchWord = sourceSearchCandidate?.startsWith(\"@\")\n ? sourceSearchCandidate.slice(1)\n : undefined;\n\n return (\n <div className=\"w-full flex flex-col items-start relative gap-2\">\n {AdjustmentPromptComponent}\n { filePointers.length > 0 && (\n <IncludedFilesPreview includedFiles={filePointers} setIncludedFiles={setFilePointers} />\n )}\n {sourceSearchWord !== undefined && (\n <SourceSearchBox\n searchTerm={sourceSearchWord}\n recentFiles={mockFiles}\n onSelectedFile={(filePointer) => {\n setAdjustmentPrompt(\n adjustmentPrompt.replace(\n new RegExp(`@${sourceSearchWord}$`),\n \"\"\n )\n );\n setFilePointers((prev) => [...prev, filePointer]);\n\n // focus back on the adjustment prompt, and move the cursor to the end\n adjustmentTextAreaRef.current?.focus();\n }}\n />\n )}\n {SuggestionComponent}\n {SubmitComponent}\n </div>\n );\n};\n\n\ninterface IncludedFilesPreviewProps {\n includedFiles: FilePointer[];\n setIncludedFiles: React.Dispatch<React.SetStateAction<FilePointer[]>>;\n}\n\nexport const IncludedFilesPreview: React.FC<IncludedFilesPreviewProps> = ({ includedFiles, setIncludedFiles }) => {\n return (\n <div className=\"flex flex-col gap-2\">\n <div className=\"flex flex-wrap gap-2\">\n {includedFiles.map((filePointer, index) => {\n return (\n <FileChipPreview\n key={`file-${filePointer.sourceApplication}.${filePointer.name}`}\n filePointer={filePointer}\n onDelete={() => {\n setIncludedFiles((prev) => prev.filter((fp) => fp !== filePointer));\n }}\n />\n );\n })}\n </div>\n </div>\n );\n};\n\nexport interface FileChipPreviewProp {\n filePointer: FilePointer;\n onDelete: () => void;\n}\n\nexport const FileChipPreview: React.FC<FileChipPreviewProp> = ({\n filePointer,\n onDelete,\n}) => {\n return (\n <Chip\n label={filePointer.name}\n onDelete={onDelete}\n avatar={\n <Avatar sx={{ backgroundColor: 'transparent' }}>\n <IconForFilePointer filePointer={filePointer} className=\"w-4 h-4 object-contain\" />\n </Avatar>\n }\n />\n );\n}\n\nexport function IconForFilePointer({filePointer, className}: {filePointer: FilePointer, className: string}): JSX.Element {\n if(filePointer.sourceApplication === \"Salesforce\") {\n return <IconSalesforce className={className} />\n } else {\n return <IconSalesforce className={className} />\n }\n}\n\nfunction IconSalesforce({ className, ...props }: React.ComponentProps<\"svg\">) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n preserveAspectRatio=\"xMidYMid meet\"\n viewBox=\"0 0 273 191\"\n {...props}\n >\n <title>{\"Salesforce.com logo\"}</title>\n <defs>\n <path id=\"a\" d=\"M.06.5h272v190H.06z\" />\n </defs>\n <g fillRule=\"evenodd\">\n <mask id=\"b\" fill=\"#fff\">\n <use xlinkHref=\"#a\" />\n </mask>\n <path\n fill=\"#00A1E0\"\n d=\"M113 21.3c8.78-9.14 21-14.8 34.5-14.8 18 0 33.6 10 42 24.9a58 58 0 0 1 23.7-5.05c32.4 0 58.7 26.5 58.7 59.2s-26.3 59.2-58.7 59.2c-3.96 0-7.82-.398-11.6-1.15-7.35 13.1-21.4 22-37.4 22a42.7 42.7 0 0 1-18.8-4.32c-7.45 17.5-24.8 29.8-45 29.8-21.1 0-39-13.3-45.9-32a45.1 45.1 0 0 1-9.34.972c-25.1 0-45.4-20.6-45.4-45.9 0-17 9.14-31.8 22.7-39.8a52.6 52.6 0 0 1-4.35-21c0-29.2 23.7-52.8 52.9-52.8 17.1 0 32.4 8.15 42 20.8\"\n mask=\"url(#b)\"\n />\n <path\n fill=\"#FFFFFE\"\n d=\"M39.4 99.3c-.171.446.061.539.116.618.511.37 1.03.638 1.55.939 2.78 1.47 5.4 1.9 8.14 1.9 5.58 0 9.05-2.97 9.05-7.75v-.094c0-4.42-3.92-6.03-7.58-7.18l-.479-.155c-2.77-.898-5.16-1.68-5.16-3.5v-.093c0-1.56 1.4-2.71 3.56-2.71 2.4 0 5.26.799 7.09 1.81 0 0 .542.35.739-.173.107-.283 1.04-2.78 1.14-3.06.106-.293-.08-.514-.271-.628-2.1-1.28-5-2.15-8-2.15l-.557.002c-5.11 0-8.68 3.09-8.68 7.51v.095c0 4.66 3.94 6.18 7.62 7.23l.592.184c2.68.824 5 1.54 5 3.42v.094c0 1.73-1.51 3.02-3.93 3.02-.941 0-3.94-.016-7.19-2.07-.393-.229-.617-.394-.92-.579-.16-.097-.56-.272-.734.252l-1.1 3.06m81.7 0c-.171.446.061.539.118.618.509.37 1.03.638 1.55.939 2.78 1.47 5.4 1.9 8.14 1.9 5.58 0 9.05-2.97 9.05-7.75v-.094c0-4.42-3.91-6.03-7.58-7.18l-.479-.155c-2.77-.898-5.16-1.68-5.16-3.5v-.093c0-1.56 1.4-2.71 3.56-2.71 2.4 0 5.25.799 7.09 1.81 0 0 .542.35.74-.173.106-.283 1.04-2.78 1.13-3.06.107-.293-.08-.514-.27-.628-2.1-1.28-5-2.15-8-2.15l-.558.002c-5.11 0-8.68 3.09-8.68 7.51v.095c0 4.66 3.94 6.18 7.62 7.23l.591.184c2.69.824 5 1.54 5 3.42v.094c0 1.73-1.51 3.02-3.93 3.02-.943 0-3.95-.016-7.19-2.07-.393-.229-.623-.387-.921-.579-.101-.064-.572-.248-.733.252l-1.1 3.06m55.8-9.36c0 2.7-.504 4.83-1.49 6.34-.984 1.49-2.47 2.22-4.54 2.22s-3.55-.724-4.52-2.21c-.977-1.5-1.47-3.64-1.47-6.34 0-2.7.496-4.82 1.47-6.31.968-1.48 2.44-2.19 4.52-2.19s3.56.717 4.54 2.19c.992 1.49 1.49 3.61 1.49 6.31m4.66-5.01c-.459-1.55-1.17-2.91-2.12-4.05a10.151 10.151 0 0 0-3.58-2.72c-1.42-.665-3.1-1-5-1s-3.57.337-5 1c-1.42.664-2.63 1.58-3.58 2.72-.948 1.14-1.66 2.5-2.12 4.05-.455 1.54-.686 3.22-.686 5.01 0 1.79.231 3.47.686 5.01.457 1.55 1.17 2.91 2.12 4.05.951 1.14 2.16 2.05 3.58 2.7 1.43.648 3.11.978 5 .978 1.89 0 3.57-.33 4.99-.978 1.42-.648 2.63-1.56 3.58-2.7.949-1.14 1.66-2.5 2.12-4.05.454-1.54.685-3.22.685-5.01 0-1.78-.231-3.47-.685-5.01m38.3 12.8c-.153-.453-.595-.282-.595-.282-.677.259-1.4.499-2.17.619-.776.122-1.64.183-2.55.183-2.25 0-4.05-.671-5.33-2-1.29-1.33-2.01-3.47-2-6.37.007-2.64.645-4.62 1.79-6.14 1.13-1.5 2.87-2.28 5.17-2.28 1.92 0 3.39.223 4.93.705 0 0 .365.159.54-.322.409-1.13.711-1.94 1.15-3.18.124-.355-.18-.505-.291-.548-.604-.236-2.03-.623-3.11-.786-1.01-.154-2.18-.234-3.5-.234-1.96 0-3.7.335-5.19.999-1.49.663-2.75 1.58-3.75 2.72-1 1.14-1.76 2.5-2.27 4.05-.505 1.54-.76 3.23-.76 5.02 0 3.86 1.04 6.99 3.1 9.28 2.06 2.3 5.16 3.46 9.2 3.46 2.39 0 4.84-.483 6.6-1.18 0 0 .336-.162.19-.554l-1.15-3.16m8.15-10.4c.223-1.5.634-2.75 1.28-3.72.967-1.48 2.44-2.29 4.51-2.29s3.44.814 4.42 2.29c.65.975.934 2.27 1.04 3.72l-11.3-.002zm15.7-3.3c-.397-1.49-1.38-3-2.02-3.69-1.02-1.09-2.01-1.86-3-2.28a11.5 11.5 0 0 0-4.52-.917c-1.97 0-3.76.333-5.21 1.01-1.45.682-2.67 1.61-3.63 2.77-.959 1.16-1.68 2.53-2.14 4.1-.46 1.55-.692 3.25-.692 5.03 0 1.82.241 3.51.715 5.04.479 1.54 1.25 2.89 2.29 4.01 1.04 1.13 2.37 2.01 3.97 2.63 1.59.615 3.52.934 5.73.927 4.56-.015 6.96-1.03 7.94-1.58.175-.098.34-.267.134-.754l-1.03-2.89c-.158-.431-.594-.275-.594-.275-1.13.422-2.73 1.18-6.48 1.17-2.45-.004-4.26-.727-5.4-1.86-1.16-1.16-1.74-2.85-1.83-5.25l15.8.012s.416-.004.459-.41c.017-.168.541-3.24-.471-6.79zm-142 3.3c.223-1.5.635-2.75 1.28-3.72.968-1.48 2.44-2.29 4.51-2.29s3.44.814 4.42 2.29c.649.975.933 2.27 1.04 3.72l-11.3-.002zm15.7-3.3c-.396-1.49-1.38-3-2.02-3.69-1.02-1.09-2.01-1.86-3-2.28a11.5 11.5 0 0 0-4.52-.917c-1.97 0-3.76.333-5.21 1.01-1.45.682-2.67 1.61-3.63 2.77-.957 1.16-1.68 2.53-2.14 4.1-.459 1.55-.69 3.25-.69 5.03 0 1.82.239 3.51.716 5.04.478 1.54 1.25 2.89 2.28 4.01 1.04 1.13 2.37 2.01 3.97 2.63 1.59.615 3.51.934 5.73.927 4.56-.015 6.96-1.03 7.94-1.58.174-.098.34-.267.133-.754l-1.03-2.89c-.159-.431-.595-.275-.595-.275-1.13.422-2.73 1.18-6.48 1.17-2.44-.004-4.26-.727-5.4-1.86-1.16-1.16-1.74-2.85-1.83-5.25l15.8.012s.416-.004.459-.41c.017-.168.541-3.24-.472-6.79zm-49.8 13.6c-.619-.494-.705-.615-.91-.936-.313-.483-.473-1.17-.473-2.05 0-1.38.46-2.38 1.41-3.05-.01.002 1.36-1.18 4.58-1.14a32 32 0 0 1 4.28.365v7.17h.002s-2 .431-4.26.567c-3.21.193-4.63-.924-4.62-.921zm6.28-11.1c-.64-.047-1.47-.07-2.46-.07-1.35 0-2.66.168-3.88.498-1.23.332-2.34.846-3.29 1.53a7.63 7.63 0 0 0-2.29 2.6c-.559 1.04-.844 2.26-.844 3.64 0 1.4.243 2.61.723 3.6a6.54 6.54 0 0 0 2.06 2.47c.877.638 1.96 1.11 3.21 1.39 1.24.283 2.64.426 4.18.426 1.62 0 3.23-.136 4.79-.399a95.1 95.1 0 0 0 3.97-.772c.526-.121 1.11-.28 1.11-.28.39-.099.36-.516.36-.516l-.009-14.4c0-3.16-.844-5.51-2.51-6.96-1.66-1.45-4.09-2.18-7.24-2.18-1.18 0-3.09.16-4.23.389 0 0-3.44.668-4.86 1.78 0 0-.312.192-.142.627l1.12 3c.139.389.518.256.518.256s.119-.047.259-.13c3.03-1.65 6.87-1.6 6.87-1.6 1.7 0 3.02.345 3.9 1.02.861.661 1.3 1.66 1.3 3.76v.667c-1.35-.196-2.6-.309-2.6-.309zm127-8.13a.428.428 0 0 0-.237-.568c-.269-.102-1.61-.385-2.64-.449-1.98-.124-3.08.21-4.07.654-.978.441-2.06 1.15-2.66 1.97l-.002-1.92c0-.264-.187-.477-.453-.477h-4.04c-.262 0-.452.213-.452.477v23.5a.48.48 0 0 0 .479.479h4.14a.479.479 0 0 0 .478-.479v-11.8c0-1.58.174-3.15.521-4.14.342-.979.807-1.76 1.38-2.32a4.79 4.79 0 0 1 1.95-1.17 7.68 7.68 0 0 1 2.12-.298c.825 0 1.73.212 1.73.212.304.034.473-.152.576-.426.271-.721 1.04-2.88 1.19-3.31\"\n />\n <path\n fill=\"#FFFFFE\"\n d=\"M162.201 67.548a13.258 13.258 0 0 0-1.559-.37 12.217 12.217 0 0 0-2.144-.166c-2.853 0-5.102.806-6.681 2.398-1.568 1.58-2.635 3.987-3.17 7.154l-.193 1.069h-3.581s-.437-.018-.529.459l-.588 3.28c-.041.314.094.51.514.508h3.486l-3.537 19.743c-.277 1.59-.594 2.898-.945 3.889-.346.978-.684 1.711-1.1 2.243-.403.515-.785.894-1.444 1.115-.544.183-1.17.267-1.856.267-.382 0-.89-.064-1.265-.139-.375-.074-.57-.158-.851-.276 0 0-.409-.156-.57.254-.131.335-1.06 2.89-1.17 3.206-.112.312.045.558.243.629.464.166.809.272 1.441.421.878.207 1.618.22 2.311.22 1.452 0 2.775-.204 3.872-.6 1.104-.399 2.065-1.094 2.915-2.035.919-1.015 1.497-2.078 2.05-3.528.547-1.437 1.013-3.221 1.386-5.3l3.554-20.109h5.196s.438.016.529-.459l.588-3.28c.041-.314-.093-.51-.515-.508h-5.043c.025-.114.254-1.888.833-3.558.247-.713.712-1.288 1.106-1.683a3.273 3.273 0 0 1 1.321-.822 5.48 5.48 0 0 1 1.693-.244c.475 0 .941.057 1.296.131.489.104.679.159.807.197.514.157.583.005.684-.244l1.206-3.312c.124-.356-.178-.506-.29-.55m-70.474 34.117c0 .264-.188.479-.452.479h-4.183c-.265 0-.453-.215-.453-.479V67.997c0-.263.188-.476.453-.476h4.183c.264 0 .452.213.452.476v33.668\"\n />\n </g>\n </svg>\n );\n}\n\n\nconst mockFiles: FilePointer[] = [\n {\n name: \"prospecting call transcript\",\n sourceApplication: \"Salesforce\",\n getContents: async () => {\n return \"some contents\";\n },\n },\n {\n name: \"customer feedback\",\n sourceApplication: \"Zendesk\",\n getContents: async () => {\n return \"some contents\";\n },\n },\n {\n name: \"product specifications\",\n sourceApplication: \"Google Docs\",\n getContents: async () => {\n return \"some contents\";\n },\n },\n {\n name: \"meeting minutes\",\n sourceApplication: \"Microsoft Teams\",\n getContents: async () => {\n return \"some contents\";\n },\n },\n {\n name: \"project plan\",\n sourceApplication: \"Trello\",\n getContents: async () => {\n return \"some contents\";\n },\n },\n {\n name: \"code review comments\",\n sourceApplication: \"Github\",\n getContents: async () => {\n return \"some contents\";\n },\n },\n];\n"]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { ChatlikeApiEndpoint } from './chunk-5ARCOTW3.mjs';
|
|
2
|
+
|
|
3
|
+
// src/types/autosuggestions-config/editing-api-config.tsx
|
|
4
|
+
var defaultEditingMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
5
|
+
return `You are a versatile writing assistant.
|
|
6
|
+
|
|
7
|
+
The user is writing some text.
|
|
8
|
+
The purpose is: "${textareaPurpose}"
|
|
9
|
+
|
|
10
|
+
The user also provides you with a prompt for EDITING some text they are writing.
|
|
11
|
+
Your job is to come up with an EDIT of the text that the user would like to use - AS BEST YOU CAN.
|
|
12
|
+
|
|
13
|
+
Adjust yourself to the user's style and implied intent.
|
|
14
|
+
|
|
15
|
+
The user will provide the following information; use this to infer the best relevant EDIT:
|
|
16
|
+
<TextBeforeCursor>
|
|
17
|
+
<TextToEdit>
|
|
18
|
+
<TextAfterCursor>
|
|
19
|
+
<EditingPrompt>
|
|
20
|
+
|
|
21
|
+
<YourEditSuggestion>
|
|
22
|
+
|
|
23
|
+
If we need to add a whitespace character to the suggested edit text, make sure to explicitly add it in.
|
|
24
|
+
|
|
25
|
+
The following external context is also provided. Use it to help you make better suggestions!!!
|
|
26
|
+
\`\`\`
|
|
27
|
+
${contextString}
|
|
28
|
+
\`\`\`
|
|
29
|
+
`;
|
|
30
|
+
};
|
|
31
|
+
var defaultEditingFewShotMessages = [
|
|
32
|
+
{
|
|
33
|
+
role: "user",
|
|
34
|
+
name: "TextBeforeCursor",
|
|
35
|
+
content: "This morning I woke up and went straight to the grocery store. "
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
role: "user",
|
|
39
|
+
name: "TextToEdit",
|
|
40
|
+
content: "While I was there I also picked up some apples, oranges, and bananas. "
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
role: "user",
|
|
44
|
+
name: "TextAfterCursor",
|
|
45
|
+
content: "The grocery store was having a sale on fruit, so I decided to stock up."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
role: "user",
|
|
49
|
+
name: "EditingPrompt",
|
|
50
|
+
content: "I bought a big watermelon"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
role: "assistant",
|
|
54
|
+
content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
role: "user",
|
|
58
|
+
name: "TextAfterCursor",
|
|
59
|
+
content: "and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
role: "user",
|
|
63
|
+
name: "TextBeforeCursor",
|
|
64
|
+
content: `The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;`
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
role: "user",
|
|
68
|
+
name: "InsertionPrompt",
|
|
69
|
+
content: "add section about the optionholder's pro rata share"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
role: "assistant",
|
|
73
|
+
content: ` (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder's "Pro Rata Share"; `
|
|
74
|
+
}
|
|
75
|
+
];
|
|
76
|
+
var defaultEditingApiConfig = {
|
|
77
|
+
apiEndpoint: ChatlikeApiEndpoint.standardOpenAIEndpoint(
|
|
78
|
+
"/api/copilotkit_chatlike"
|
|
79
|
+
),
|
|
80
|
+
makeSystemPrompt: defaultEditingMakeSystemPrompt,
|
|
81
|
+
fewShotMessages: defaultEditingFewShotMessages,
|
|
82
|
+
forwardedParams: void 0
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export { defaultEditingApiConfig, defaultEditingFewShotMessages, defaultEditingMakeSystemPrompt };
|
|
86
|
+
//# sourceMappingURL=out.js.map
|
|
87
|
+
//# sourceMappingURL=chunk-55EGOC5T.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/autosuggestions-config/editing-api-config.tsx"],"names":[],"mappings":";;;;;AAWO,IAAM,iCAAmD,CAC9D,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBlB;AAAA;AAAA;AAGF;AAEO,IAAM,gCAAyD;AAAA,EACpE;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AACF;AAEO,IAAM,0BAA4C;AAAA,EACvD,aAAa,oBAAoB;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB","sourcesContent":["import { ChatlikeApiEndpoint } from \"./subtypes/chatlike-api-endpoint\";\nimport { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\nimport { MinimalChatGPTMessage } from \"./subtypes/minimal-chat-gpt-message\";\n\nexport interface EditingApiConfig {\n apiEndpoint: ChatlikeApiEndpoint;\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: MinimalChatGPTMessage[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultEditingMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString\n) => {\n return `You are a versatile writing assistant.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe user also provides you with a prompt for EDITING some text they are writing. \nYour job is to come up with an EDIT of the text that the user would like to use - AS BEST YOU CAN.\n\nAdjust yourself to the user's style and implied intent.\n\nThe user will provide the following information; use this to infer the best relevant EDIT:\n<TextBeforeCursor>\n<TextToEdit>\n<TextAfterCursor>\n<EditingPrompt>\n\n<YourEditSuggestion>\n\nIf we need to add a whitespace character to the suggested edit 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 defaultEditingFewShotMessages: MinimalChatGPTMessage[] = [\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: \"This morning I woke up and went straight to the grocery store. \",\n },\n {\n role: \"user\",\n name: \"TextToEdit\",\n content:\n \"While I was there I also picked up some apples, oranges, and bananas. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"The grocery store was having a sale on fruit, so I decided to stock up.\",\n },\n {\n role: \"user\",\n name: \"EditingPrompt\",\n content: \"I bought a big watermelon\",\n },\n {\n role: \"assistant\",\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content:\n 'The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;',\n },\n {\n role: \"user\",\n name: \"InsertionPrompt\",\n content: \"add section about the optionholder's pro rata share\",\n },\n {\n role: \"assistant\",\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n },\n];\n\nexport const defaultEditingApiConfig: EditingApiConfig = {\n apiEndpoint: ChatlikeApiEndpoint.standardOpenAIEndpoint(\n \"/api/copilotkit_chatlike\"\n ),\n makeSystemPrompt: defaultEditingMakeSystemPrompt,\n fewShotMessages: defaultEditingFewShotMessages,\n forwardedParams: undefined,\n};\n"]}
|