diff --git a/src/lib/components/chat/messages/AssistantMessage.svelte b/src/lib/components/chat/messages/AssistantMessage.svelte index a43e7e3..eef07a0 100644 --- a/src/lib/components/chat/messages/AssistantMessage.svelte +++ b/src/lib/components/chat/messages/AssistantMessage.svelte @@ -5,21 +5,22 @@ import { afterUpdate } from "svelte" import { get } from "svelte/store" + + // extract contents within backticks + const regex = /`([^`]*)`/g + export let message: string = "" let showingMessage = "" let delay = 0 - message.split("").forEach(char => { + message.replaceAll(regex, "").trim().split("").forEach(char => { delay += get(stateStore).delay setTimeout(() => { showingMessage += char }, delay) }) - // extract contents within backticks - const regex = /`([^`]*)`/g - let raw_commands: Array = [] // raw commands but extract only the first one let command: string // the first element of commands if it exists