fix: ai completion

This commit is contained in:
Artemy 2023-04-29 09:19:14 +03:00
parent 0a0f0f950a
commit b8c7c69012
2 changed files with 12 additions and 9 deletions

View file

@ -140,6 +140,7 @@ function NoteTextArea({ value, onChange, preview = false }) {
maxLength={5000}
onChange={onChange}
defaultValue={value}
id="noteTextArea"
></textarea>
);
}
@ -159,8 +160,9 @@ function NotesAdditionalSettings({
text={locals.AIComplete}
className="m-1"
w="w-full"
onClick={() => {
let text = Complete(noteText);
onClick={async () => {
let text = await Complete(noteText);
document.getElementById("noteTextArea").value = text;
onClick(text);
}}

View file

@ -58,13 +58,14 @@ function NotePage() {
value={note.text}
onChange={(e) => (note.text = e.target.value)}
/>
<NotesAdditionalSettings
noteText={note.text}
onClick={(text) => {
note.text = text;
}}
/>
<div className="grid grid-cols-1 lg:grid-cols-2 justify-items-center w-full">
<NotesAdditionalSettings
noteText={note.text}
onClick={(text) => {
note.text = text;
}}
/>
</div>
</>
) : (
<Note note={note} />