Polyfill safari 14 (#149)

* add core-js and necessary polyfills

* set TS target to ES2015

* set ES2018 as default since it's prob enough

* remove --host added by mistake

* replace usage of array.prototype.at by more compatible alternative

* remove core-js and replaceAll polyfill

* fix wrong usage of crypto global
share-api-fix
Adrien Denat 2023-05-02 10:48:39 +02:00 committed by GitHub
parent a415295e20
commit 9c038aa1d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -22,7 +22,7 @@
}
// If last message is from user, scroll to bottom
$: if (messages.at(-1)?.from === "user") {
$: if (messages[messages.length - 1]?.from === "user") {
scrollToBottom();
}
</script>

View File

@ -80,7 +80,8 @@
// final message
if (data.generated_text) {
const lastMessage = messages.at(-1);
const lastMessage = messages[messages.length - 1];
if (lastMessage) {
lastMessage.content = data.generated_text;
messages = [...messages];
@ -89,7 +90,7 @@
}
if (!data.token.special) {
const lastMessage = messages.at(-1);
const lastMessage = messages[messages.length - 1];
if (lastMessage?.from !== "assistant") {
// First token has a space at the beginning, trim it
@ -112,7 +113,7 @@
});
}
async function writeMessage(message: string, messageId = crypto.randomUUID()) {
async function writeMessage(message: string, messageId = randomUUID()) {
if (!message.trim()) return;
try {

View File

@ -8,7 +8,8 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true
"strict": true,
"target": "ES2018"
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
//