refac: close artifacts if html codeblock is not found

This commit is contained in:
Timothy J. Baek 2024-10-06 01:20:10 -07:00
parent 3082d0de7a
commit cdd024db81

View File

@ -17,9 +17,12 @@
let iframeElement: HTMLIFrameElement; let iframeElement: HTMLIFrameElement;
$: if (history.currentId) { $: if (history) {
messages = createMessagesList(history, history.currentId); messages = createMessagesList(history, history.currentId);
getContents(); getContents();
} else {
messages = [];
getContents();
} }
function 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; selectedContentIdx = contents ? contents.length - 1 : 0;
} }