Adrien Denat
commited on
Commit
•
9c038aa
1
Parent(s):
a415295
Polyfill safari 14 (#149)
Browse files* 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
src/lib/components/chat/ChatMessages.svelte
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
}
|
23 |
|
24 |
// If last message is from user, scroll to bottom
|
25 |
-
$: if (messages.
|
26 |
scrollToBottom();
|
27 |
}
|
28 |
</script>
|
|
|
22 |
}
|
23 |
|
24 |
// If last message is from user, scroll to bottom
|
25 |
+
$: if (messages[messages.length - 1]?.from === "user") {
|
26 |
scrollToBottom();
|
27 |
}
|
28 |
</script>
|
src/routes/conversation/[id]/+page.svelte
CHANGED
@@ -80,7 +80,8 @@
|
|
80 |
|
81 |
// final message
|
82 |
if (data.generated_text) {
|
83 |
-
const lastMessage = messages.
|
|
|
84 |
if (lastMessage) {
|
85 |
lastMessage.content = data.generated_text;
|
86 |
messages = [...messages];
|
@@ -89,7 +90,7 @@
|
|
89 |
}
|
90 |
|
91 |
if (!data.token.special) {
|
92 |
-
const lastMessage = messages.
|
93 |
|
94 |
if (lastMessage?.from !== "assistant") {
|
95 |
// First token has a space at the beginning, trim it
|
@@ -112,7 +113,7 @@
|
|
112 |
});
|
113 |
}
|
114 |
|
115 |
-
async function writeMessage(message: string, messageId =
|
116 |
if (!message.trim()) return;
|
117 |
|
118 |
try {
|
|
|
80 |
|
81 |
// final message
|
82 |
if (data.generated_text) {
|
83 |
+
const lastMessage = messages[messages.length - 1];
|
84 |
+
|
85 |
if (lastMessage) {
|
86 |
lastMessage.content = data.generated_text;
|
87 |
messages = [...messages];
|
|
|
90 |
}
|
91 |
|
92 |
if (!data.token.special) {
|
93 |
+
const lastMessage = messages[messages.length - 1];
|
94 |
|
95 |
if (lastMessage?.from !== "assistant") {
|
96 |
// First token has a space at the beginning, trim it
|
|
|
113 |
});
|
114 |
}
|
115 |
|
116 |
+
async function writeMessage(message: string, messageId = randomUUID()) {
|
117 |
if (!message.trim()) return;
|
118 |
|
119 |
try {
|
tsconfig.json
CHANGED
@@ -8,7 +8,8 @@
|
|
8 |
"resolveJsonModule": true,
|
9 |
"skipLibCheck": true,
|
10 |
"sourceMap": true,
|
11 |
-
"strict": true
|
|
|
12 |
}
|
13 |
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
|
14 |
//
|
|
|
8 |
"resolveJsonModule": true,
|
9 |
"skipLibCheck": true,
|
10 |
"sourceMap": true,
|
11 |
+
"strict": true,
|
12 |
+
"target": "ES2018"
|
13 |
}
|
14 |
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
|
15 |
//
|