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

View file

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