Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)
Python
improve preview for videos by showing the streaming response as it comes in
Abi Rajaf09b4c780898
diff --git a/frontend/src/components/preview/extractHtml.ts b/frontend/src/components/preview/extractHtml.tsindex f33b206a..6e9c9ffa 100644--- a/frontend/src/components/preview/extractHtml.ts+++ b/frontend/src/components/preview/extractHtml.ts@@ -1,4 +1,16 @@+// Not robust enough to support <html lang='en'> for instanceexport function extractHtml(code: string): string {- const htmlStartIndex = code.indexOf("<html>");- return htmlStartIndex !== -1 ? code.slice(htmlStartIndex) : "";+ const lastHtmlStartIndex = code.lastIndexOf("<html>");+ let htmlEndIndex = code.indexOf("</html>", lastHtmlStartIndex);++ if (lastHtmlStartIndex !== -1) {+ // If "</html>" is found, adjust htmlEndIndex to include the "</html>" tag+ if (htmlEndIndex !== -1) {+ htmlEndIndex += "</html>".length;+ return code.slice(lastHtmlStartIndex, htmlEndIndex);+ }+ // If "</html>" is not found, return the rest of the string starting from the last "<html>"+ return code.slice(lastHtmlStartIndex);+ }+ return "";}