From b8c7c690122cfd82428c2faf857fcf8e4975c732 Mon Sep 17 00:00:00 2001 From: Artemy Date: Sat, 29 Apr 2023 09:19:14 +0300 Subject: [PATCH] fix: ai completion --- src/components/settingsInputs.jsx | 6 ++++-- src/pages/note.jsx | 15 ++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/components/settingsInputs.jsx b/src/components/settingsInputs.jsx index a9374d5..155c425 100644 --- a/src/components/settingsInputs.jsx +++ b/src/components/settingsInputs.jsx @@ -140,6 +140,7 @@ function NoteTextArea({ value, onChange, preview = false }) { maxLength={5000} onChange={onChange} defaultValue={value} + id="noteTextArea" > ); } @@ -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); }} diff --git a/src/pages/note.jsx b/src/pages/note.jsx index 6e84d49..e8e6564 100644 --- a/src/pages/note.jsx +++ b/src/pages/note.jsx @@ -58,13 +58,14 @@ function NotePage() { value={note.text} onChange={(e) => (note.text = e.target.value)} /> - - { - note.text = text; - }} - /> +
+ { + note.text = text; + }} + /> +
) : (