diff --git a/src/lib/components/chat/Artifacts.svelte b/src/lib/components/chat/Artifacts.svelte index 84906ced9..6df05ade0 100644 --- a/src/lib/components/chat/Artifacts.svelte +++ b/src/lib/components/chat/Artifacts.svelte @@ -17,9 +17,12 @@ let iframeElement: HTMLIFrameElement; - $: if (history.currentId) { + $: if (history) { messages = createMessagesList(history, history.currentId); getContents(); + } else { + messages = []; + getContents(); } function getContents() { @@ -97,6 +100,10 @@ } }); + if (messages.length === 0 || (messages.at(-1)?.done && contents.length === 0)) { + showArtifacts.set(false); + showControls.set(false); + } selectedContentIdx = contents ? contents.length - 1 : 0; }