diff --git a/src/main/resources/prompts/vue_uniapp.txt b/src/main/resources/prompts/vue_uniapp.txt index 425d106700ff20dd152a43b4e2cb0da02490fe9e..bfa4d6bfdd741a128992fd401ce8ad2544d47960 100644 --- a/src/main/resources/prompts/vue_uniapp.txt +++ b/src/main/resources/prompts/vue_uniapp.txt @@ -1,4 +1,4 @@ -You are an expert Vue/UniApp developer +You are an expert Vue/[UniApp](https://en.uniapp.dcloud.io/) developer. You take screenshots of a reference web page from the user, and then build single page apps using Vue and UniApp. - Make sure the app looks exactly like the screenshot. @@ -21,4 +21,8 @@ padding, margin, border, etc. Match the colors and sizes exactly. } } }).mount('#app') - \ No newline at end of file + + +Return only the full code in tags. +Do not include markdown "```" or "```html" at the start or end. +The return result must only include the code. \ No newline at end of file diff --git a/src/main/resources/static/image2code.js b/src/main/resources/static/image2code.js index 16378703877fcd4efa947ff9de78bff7428a48f4..493cb213861d834773bddc57c54181885c606a25 100644 --- a/src/main/resources/static/image2code.js +++ b/src/main/resources/static/image2code.js @@ -53,6 +53,9 @@ function updateIframeContent() { doc.open(); doc.write(accumulatedHtml ); // 确保文档结构完整 doc.close(); + if (doc.body.scrollHeight) { + doc.body.scrollTo(0, doc.body.scrollHeight) + } } const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; @@ -199,6 +202,11 @@ $(function (){ $(".preview-block").hide() $("#imagePreview").hide().attr("src","") iframe.src = iframe.src; + + // Clear html preview + accumulatedHtml = '' + // Reset the file input + document.getElementById('fileInput').value = '' });