Spaces:
Running
Running
File size: 2,450 Bytes
d4febae b93a813 d4febae b93a813 d4febae b93a813 d4febae b93a813 d4febae b93a813 236ee90 48ee71e b93a813 ddb7871 296b17c d4febae 936a455 d4febae e781b23 d4febae |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
import { alpine } from "./alpine.mts"
import { daisy } from "./daisy.mts"
export function getWebApp(prompt: string) {
const prefix = `# In index.html:\n\`\`\`
<html><head><link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.css" rel="stylesheet" type="text/css" /><script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script><script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"></script><script defer src="https://cdnjs.cloudflare.com/ajax/libs/three.js/0.156.1/three.min.js"></script><script type="module" src="main.js"></script><title>`
const instructions = [
{
role: "system",
content: [
`You are a JavaScript developer, expert at crafting applications using AlpineJS, DaisyUI and Tailwind.`,
`Here is an extract from the AlpineJS documentation:`,
alpine,
`Here is an extract from the DaisyUI documentation:`,
daisy
].filter(item => item).join("\n")
},
{
role: "user",
content: `Please write, file by file, the source code for a HTML JS app.
Here are some recommended librairies:
- AlpineJS (use "https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js")
- DaisyUI (use "https://cdn.jsdelivr.net/npm/[email protected]/dist/full.css")
- Tailwind (use "https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio")
- Three.js (use "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.156.1/three.min.js")
Those library will be globally exposed thanks to the <script> dependencies, so you do not need to write "import ... from ..".
Some remarks:
- Unless specified in the user instructions, make a nice Tailwind-based layout, with nice colors/padding
- DO NOT USE REACT OR VUE.JS
- Keep the code minimalist, it must be functional but simple (try to write is already minified JS/CSS and HTML and compact if possible, but don't minify the user-visible content, the README / YAML files or the space name)
Remember, you need to write the index.html but also the app.js and/or the style.css files!
DO NOT WRITE AN EXAMPLE! WRITE THE FULL CODE, NOT AN EXAMPLE.
You must not leave any TODO in the code.
Don't forget to write a non-minified (!) README.md with the following header:
\`\`\`
---
license: apache-2.0
title: <app name>
sdk: static
emoji: π¨βπ»
colorFrom: yellow
colorTo: green
---
\`\`\`
The app is about: ${prompt}`,
}
]
return { prefix, files: [], instructions }
} |