File size: 1,351 Bytes
b93a813
 
e781b23
b93a813
 
e781b23
 
 
 
 
 
 
b93a813
 
 
 
 
 
 
 
 
e781b23
 
b93a813
 
 
 
 
e781b23
b93a813
 
 
 
 
 
 
 
 
 
 
e781b23
 
 
 
 
b93a813
e781b23
b93a813
 
 
e781b23
b93a813
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
import { alpine } from "./alpine.mts"
import { daisy } from "./daisy.mts"
import { dockerfile } from "./docker.mts"

export function getReactApp(prompt: string) {
  const prefix = `# In src/pages/index.tsx:\n\`\`\``
  const files = [
    {
      path: `Dockerfile`,
      content: dockerfile,
    }
  ]
  const instructions = [
    {
      role: "system",
      content: [
        `You are a TypeScript developer, expert at crafting NextJS and React applications, using TailwindCSS utility classes.`,
      ].filter(item => item).join("\n")
    },
    {
      role: "user",
      content: `Think step by step, you got this! Please write, file by file, the source code for a Next 12 application.
The app should be buildable when we run this in command line:
\`\`\`
npm install
npm run start
\`\`\`

The project will be deployed to Hugging Face, so it must include a README.md with the following YAML header:
\`\`\`
---
license: apache-2.0
title: <APPNAME>
sdk: docker
emoji: πŸ‘¨β€πŸ’»
colorFrom: yellow
colorTo: green
---
\`\`\`

Important rules:
- you need to leave: "sdk: docker" as-is, but replace: "<APPNAME>" with an actual name, please.
- Don't forget to write a valid package.json file!

The app is about: ${prompt}.

Remember: don't forget to edit the README.me and a package.json file!`,
    }
  ]

  return { prefix, files, instructions }
}