feat: autocompletion

This commit is contained in:
Timothy Jaeryang Baek
2024-11-29 00:16:49 -08:00
parent 0e8e9820d0
commit a07213b5be
6 changed files with 98 additions and 14 deletions

View File

@@ -34,6 +34,7 @@
export let value = '';
export let id = '';
export let generateAutoCompletion: Function = async () => null;
export let autocomplete = false;
export let messageInput = false;
export let shiftEnter = false;
@@ -159,7 +160,12 @@
return null;
}
return 'AI-generated suggestion';
const suggestion = await generateAutoCompletion(text).catch(() => null);
if (!suggestion || suggestion.trim().length === 0) {
return null;
}
return suggestion;
}
})
]