diff --git a/js/src/lib/components/InferenceWidget/widgets/TextGenerationWidget/TextGenerationWidget.svelte b/js/src/lib/components/InferenceWidget/widgets/TextGenerationWidget/TextGenerationWidget.svelte index d7ed94107..66bce9eea 100644 --- a/js/src/lib/components/InferenceWidget/widgets/TextGenerationWidget/TextGenerationWidget.svelte +++ b/js/src/lib/components/InferenceWidget/widgets/TextGenerationWidget/TextGenerationWidget.svelte @@ -61,8 +61,9 @@ if (exampleOutput) { output = exampleOutput.text; outputJson = ""; - const outputWithSpace = /^\s/.test(output) ? output : ` ${output}`; - renderTypingEffect(outputWithSpace); + // if output doesn't start with space, add space in front of output + const prefix = /^\s/.test(output) ? "" : " "; + renderTypingEffect(prefix+output); return; }