Revert "combine assistant messages"
Browse filesThis reverts commit 7a5ba03813d147b98afc17eb6faf840114c5c90d.
src/lib/components/InferencePlayground/InferencePlayground.svelte
CHANGED
@@ -92,29 +92,18 @@
|
|
92 |
|
93 |
if (conversation.streaming) {
|
94 |
const streamingMessage = { role: "assistant", content: "" };
|
95 |
-
conversation.messages.
|
96 |
abortController = new AbortController();
|
97 |
-
let firstChunk = true;
|
98 |
-
let previousContent = "";
|
99 |
|
100 |
await handleStreamingResponse(
|
101 |
hf,
|
102 |
conversation,
|
103 |
content => {
|
104 |
-
if (
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
previousContent = content;
|
109 |
-
if (previousContent && !/\s$/.test(previousContent)) {
|
110 |
-
previousContent += " ";
|
111 |
-
}
|
112 |
-
conversation.messages = [...conversation.messages, streamingMessage];
|
113 |
}
|
114 |
-
conversation.messages.at(-1).content = previousContent ? `${previousContent}${content}` : content;
|
115 |
-
conversation.messages = [...conversation.messages];
|
116 |
-
generatedTokensCount += 1;
|
117 |
-
firstChunk = false;
|
118 |
},
|
119 |
abortController
|
120 |
);
|
|
|
92 |
|
93 |
if (conversation.streaming) {
|
94 |
const streamingMessage = { role: "assistant", content: "" };
|
95 |
+
conversation.messages = [...conversation.messages, streamingMessage];
|
96 |
abortController = new AbortController();
|
|
|
|
|
97 |
|
98 |
await handleStreamingResponse(
|
99 |
hf,
|
100 |
conversation,
|
101 |
content => {
|
102 |
+
if (streamingMessage) {
|
103 |
+
streamingMessage.content = content;
|
104 |
+
conversation.messages = [...conversation.messages];
|
105 |
+
generatedTokensCount += 1;
|
|
|
|
|
|
|
|
|
|
|
106 |
}
|
|
|
|
|
|
|
|
|
107 |
},
|
108 |
abortController
|
109 |
);
|