Rm last message on error if empty
Browse files
src/lib/components/InferencePlayground/InferencePlayground.svelte
CHANGED
@@ -128,7 +128,7 @@
|
|
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 |
}
|
|
|
128 |
const endTime = performance.now();
|
129 |
latency = Math.round(endTime - startTime);
|
130 |
} catch (error) {
|
131 |
+
if (conversation.messages.at(-1)?.role === "assistant" && !conversation.messages.at(-1)?.content.trim()) {
|
132 |
conversation.messages.pop();
|
133 |
conversation.messages = [...conversation.messages];
|
134 |
}
|