You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/api/generateCode/route.ts
+34-7Lines changed: 34 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
-
import{shadcnComponents}from"@/utils/Shadcn";
1
+
// import { shadcnComponents } from "@/utils/Shadcn";
2
+
importshadcnDocsfrom"@/utils/shadcn-docs";
2
3
import{
3
4
TogetherAIStream,
4
5
TogetherAIStreamPayload,
@@ -13,14 +14,40 @@ You are an expert frontend React engineer who is also a great UI/UX designer. Fo
13
14
- Make sure the React app is interactive and functional by creating state when needed and having no required props
14
15
- Use TypeScript as the language for the React component
15
16
- Use Tailwind classes for styling. DO NOT USE ARBITRARY VALUES (e.g. \`h-[600px]\`). Make sure to use a consistent color palette.
16
-
- If the code calls for a button, use the provided \`Button\` component. Here's how to import it: \`import { Button } from '/components/ui/button';\` And here are the extra props available for use: \`\`\`type ExtraButtonProps = {variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined}\`\`\`. Use your best judgement and use an extra prop if it seems appropriate.
17
-
- NO OTHER LIBRARIES (e.g. zod, hookform) ARE INSTALLED OR ABLE TO BE IMPORTED.
18
17
- Please ONLY return the full React code starting with the imports, nothing else. It's very important for my job that you only return the React code with imports. DO NOT START WITH \`\`\`typescript or \`\`\`javascript or \`\`\`tsx or \`\`\`.
18
+
19
+
- The [email protected] library is also available to be imported. If you need an icon, use one from lucide-react. Here's an example of importing and using one: import { Camera } from "lucide-react"\` & \`<Camera color="red" size={48} />\`
20
+
21
+
22
+
There are some prestyled components available for use. Please use your best judgement to use any of these components if the app calls for one.
23
+
24
+
Here are the components that are available, along with how to use them:
25
+
26
+
${shadcnDocs
27
+
.map(
28
+
(component)=>`
29
+
<component>
30
+
<name>
31
+
${component.name}
32
+
</name>
33
+
<usage>
34
+
${component.usage}
35
+
</component>
36
+
`,
37
+
)
38
+
.join("\n")}
39
+
40
+
NO OTHER LIBRARIES (e.g. zod, hookform) ARE INSTALLED OR ABLE TO BE IMPORTED.
19
41
`;
20
-
// - The assistant can ONLY use these 2 prebuilt components from the \`shadcn\` library if needed:
21
-
// - \`import { Button } from '@/components/ui/button';\`
// - ONLY IF the user asks for a dashboard, graph or chart, the recharts library is available to be imported, e.g. \`import { LineChart, XAxis, ... } from "recharts"\` & \`<LineChart ...><XAxis dataKey="name"> ...\`. Please only use this when needed.
42
+
43
+
console.log(systemPrompt);
44
+
45
+
// - If the code calls for a button, use the provided \`Button\` component. Here's how to import it: \`import { Button } from '/components/ui/button';\` And here are the extra props available for use: \`\`\`type ExtraButtonProps = {variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined}\`\`\`. Use your best judgement and use an extra prop if it seems appropriate.
46
+
// // - The assistant can ONLY use these 2 prebuilt components from the \`shadcn\` library if needed:
47
+
// // - \`import { Button } from '@/components/ui/button';\`
// // - ONLY IF the user asks for a dashboard, graph or chart, the recharts library is available to be imported, e.g. \`import { LineChart, XAxis, ... } from "recharts"\` & \`<LineChart ...><XAxis dataKey="name"> ...\`. Please only use this when needed.
50
+
24
51
// - Here are all the prebuilt components ${JSON.stringify(shadcnComponents.button + shadcnComponents.alert)}
0 commit comments