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 globalshare-api-fix
parent
a415295e20
commit
9c038aa1d0
|
@ -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>
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue