mishig HF staff commited on
Commit
7298e92
1 Parent(s): d6fe957

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
  }