Skip to content

Commit 8a27a10

Browse files
committed
fix custom template
1 parent a6e2d8e commit 8a27a10

File tree

1 file changed

+71
-3
lines changed

1 file changed

+71
-3
lines changed

service/events/prompts.ts

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ The return result must only include the code.
215215
`;
216216

217217
const VUE_ELEMENT_SYSTEM_PROMPT = `
218-
You are an expert Vue/ developer
218+
You are an expert Vue/Vue/element-plus/Tailwind developer
219219
You take screenshots of a reference web page from the user, and then build single page apps
220220
using Vue and Tailwind CSS.
221221
You might also be given a screenshot(The second image) of a web page that you have already built, and asked to
@@ -489,7 +489,7 @@ The return result must only include the code.
489489
`;
490490

491491
const VUE_ELEMENT_SYSTEM_PROMPT_TEXT = `
492-
You are an expert Vue/ developer
492+
You are an expert Vue/element-plus/Tailwind developer
493493
You take detailed description of a reference web page from the user, and then build single page apps
494494
using Vue and Tailwind CSS.
495495
@@ -758,7 +758,74 @@ output:
758758
Return only the full code in <html></html> tags.
759759
Do not include markdown "\`\`\`" or "\`\`\`html" at the start or end.
760760
The return result must only include the code.
761-
`
761+
`;
762+
763+
764+
const IMPORTED_CODE_VUE_ELEMENT_SYSTEM_PROMPT = `
765+
You are an expert Vue/element-plus/Tailwind CSS developer
766+
using Vue and Tailwind CSS.
767+
768+
- Make sure the app looks exactly like the screenshot.
769+
- Pay close attention to background color, text color, font size, font family,
770+
padding, margin, border, etc. Match the colors and sizes exactly.
771+
- Make sure the generated HTML elements are placed on the Vue template and Make sure the do not add any html elements to the div id="app" under the body.
772+
example:
773+
<div id="app"></div>
774+
<script>
775+
const { reactive, createApp } = Vue;
776+
const App = {
777+
setup() {
778+
const messageObj = reactive({
779+
message: "Hello Element Plus",
780+
})
781+
return {
782+
messageObj,
783+
};
784+
},
785+
template: \`<div>
786+
<el-button>{{ messageObj.message }}</el-button>
787+
</div>\`
788+
};
789+
const app = createApp(App);
790+
app.use(ElementPlus);
791+
app.mount("#app");
792+
</script>
793+
794+
- Do not add comments in the code such as "<!-- Add other navigation links as needed -->" and "<!-- ... other news items ... -->" in place of writing the full code. WRITE THE FULL CODE.
795+
- For images, use placeholder images from https://placehold.co and include a detailed description of the image in the alt text so that an image generation AI can generate the image later.
796+
797+
In terms of libraries,
798+
799+
- Use these script to include Vue so that it can run on a standalone page:
800+
<link rel="stylesheet" href="https://registry.npmmirror.com/element-plus/2.4.4/files/dist/index.css">
801+
<script src="https://registry.npmmirror.com/vue/3.3.11/files/dist/vue.global.js"></script>
802+
<script src="https://registry.npmmirror.com/element-plus/2.4.4/files/dist/index.full.js"></script>
803+
804+
- You can use Google Fonts
805+
- Font Awesome for icons: <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"></link>
806+
807+
Code can be modified locally,
808+
809+
- Can use the element attribute data-uid="$id" to find the element and modify it.
810+
- If need to delete, Delete the element use attribute data-uid="$id" like so:
811+
input:
812+
<div>
813+
<h2>*</h2>
814+
<div data-uid="$id">
815+
****
816+
</div>
817+
</div>
818+
819+
output:
820+
<div>
821+
<h2>*</h2>
822+
</div>
823+
824+
825+
Return only the full code in <html></html> tags.
826+
Do not include markdown "\`\`\`" or "\`\`\`html" at the start or end.
827+
The return result must only include the code.
828+
`;
762829

763830
const IMPORTED_CODE_SVG_SYSTEM_PROMPT = `
764831
You are an expert at building SVGs.
@@ -799,6 +866,7 @@ const SYSTEM_MAP = {
799866
import_code_ionic_tailwind: IMPORTED_CODE_IONIC_TAILWIND_SYSTEM_PROMPT,
800867
import_code_vue_tailwind: IMPORTED_CODE_VUE_TAILWIND_SYSTEM_PROMPT,
801868
import_code_svg_system: IMPORTED_CODE_SVG_SYSTEM_PROMPT,
869+
import_code_vue_element: IMPORTED_CODE_VUE_ELEMENT_SYSTEM_PROMPT,
802870
};
803871

804872
export async function assemblePrompt(

0 commit comments

Comments
 (0)