Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
make sure messages alternate with user/assistant roles
Browse files
src/lib/components/InferencePlayground/InferencePlayground.svelte
CHANGED
|
@@ -128,14 +128,14 @@
|
|
| 128 |
const endTime = performance.now();
|
| 129 |
latency = Math.round(endTime - startTime);
|
| 130 |
} catch (error) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
if (error instanceof Error) {
|
| 132 |
if (error.message.includes("token seems invalid")) {
|
| 133 |
hfToken = "";
|
| 134 |
localStorage.removeItem(hfTokenLocalStorageKey);
|
| 135 |
-
if (conversation.messages.at(-1)?.role === "assistant") {
|
| 136 |
-
conversation.messages.pop();
|
| 137 |
-
conversation.messages = [...conversation.messages];
|
| 138 |
-
}
|
| 139 |
showTokenModal = true;
|
| 140 |
}
|
| 141 |
if (error.name !== "AbortError") {
|
|
|
|
| 128 |
const endTime = performance.now();
|
| 129 |
latency = Math.round(endTime - startTime);
|
| 130 |
} catch (error) {
|
| 131 |
+
if (conversation.messages.at(-1)?.role === "assistant") {
|
| 132 |
+
conversation.messages.pop();
|
| 133 |
+
conversation.messages = [...conversation.messages];
|
| 134 |
+
}
|
| 135 |
if (error instanceof Error) {
|
| 136 |
if (error.message.includes("token seems invalid")) {
|
| 137 |
hfToken = "";
|
| 138 |
localStorage.removeItem(hfTokenLocalStorageKey);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
showTokenModal = true;
|
| 140 |
}
|
| 141 |
if (error.name !== "AbortError") {
|