Merge pull request #45 from tldraw/prompt

Bump
pull/93/head
Steve Ruiz 3 years ago committed by GitHub
commit 1d7fd6a02b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -11,7 +11,7 @@ import {
useIsEditing,
useToasts,
useValue,
} from '@tldraw/tldraw'
} from 'tldraw'
import { useEffect } from 'react'
import { Dropdown } from '../components/Dropdown'
import { LINK_HOST, PROTOCOL } from '../lib/hosts'

@ -1,4 +1,4 @@
import { TldrawUiIcon, useBreakpoint, useEditor, useValue } from '@tldraw/tldraw'
import { TldrawUiIcon, useBreakpoint, useEditor, useValue } from 'tldraw'
import { ChangeEvent, useCallback, useState } from 'react'
import { setTimeout } from 'timers'

@ -1,6 +1,6 @@
import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
import sdk from '@stackblitz/sdk'
import { stopEventPropagation, useToasts } from '@tldraw/tldraw'
import { stopEventPropagation, useToasts } from 'tldraw'
import { useCallback } from 'react'
import {
createReplitProject,

@ -1,4 +1,4 @@
import { useBreakpoint, useEditor, useValue } from '@tldraw/tldraw'
import { useBreakpoint, useEditor, useValue } from 'tldraw'
import { track } from '@vercel/analytics/react'
export function LinkArea() {

@ -1,6 +1,6 @@
'use client'
import { TldrawUiIcon, stopEventPropagation, useToasts } from '@tldraw/tldraw'
import { TldrawUiIcon, stopEventPropagation, useToasts } from 'tldraw'
export function UrlLinkButton({ uploadUrl }: { uploadUrl: string }) {
const toast = useToasts()

@ -1,4 +1,4 @@
import { useEditor, useToasts } from '@tldraw/tldraw'
import { useEditor, useToasts } from 'tldraw'
import { track } from '@vercel/analytics/react'
import { useCallback } from 'react'
import { makeReal } from '../lib/makeReal'

@ -1,4 +1,4 @@
import { Editor, TLGeoShape, TLTextShape } from '@tldraw/tldraw'
import { Editor, TLGeoShape, TLTextShape } from 'tldraw'
export function getSelectionAsText(editor: Editor) {
const selectedShapeIds = editor.getSelectedShapeIds()

@ -1,4 +1,4 @@
import { Editor, createShapeId, getSvgAsImage } from '@tldraw/tldraw'
import { Editor, createShapeId, getSvgAsImage } from 'tldraw'
import { track } from '@vercel/analytics/react'
import { PreviewShape } from '../PreviewShape/PreviewShape'
import { addGridToSvg } from './addGridToSvg'
@ -31,8 +31,8 @@ export async function makeReal(editor: Editor, apiKey: string) {
})
// Add the grid lines to the SVG
const grid = { color: 'red', size: 100, labels: true }
addGridToSvg(svg, grid)
// const grid = { color: 'red', size: 100, labels: true }
// addGridToSvg(svg, grid)
if (!svg) throw Error(`Could not get the SVG.`)
@ -62,7 +62,7 @@ export async function makeReal(editor: Editor, apiKey: string) {
apiKey,
text: getSelectionAsText(editor),
previousPreviews,
grid,
// grid,
theme: editor.user.getUserPreferences().isDarkMode ? 'dark' : 'light',
})

@ -2,7 +2,7 @@
/* eslint-disable react-hooks/rules-of-hooks */
'use client'
import '@tldraw/tldraw/tldraw.css'
import 'tldraw/tldraw.css'
import dynamic from 'next/dynamic'
import { PreviewShapeUtil } from '../PreviewShape/PreviewShape'
import { APIKeyInput } from '../components/APIKeyInput'
@ -10,7 +10,7 @@ import { ExportButton } from '../components/ExportButton'
import { LinkArea } from '../components/LinkArea'
const Tldraw = dynamic(async () => (await import('@tldraw/tldraw')).Tldraw, {
const Tldraw = dynamic(async () => (await import('tldraw')).Tldraw, {
ssr: false,
})

@ -1,24 +1,17 @@
export const OPEN_AI_SYSTEM_PROMPT = `You are an expert web developer. You are an expert in HTML, JavaScript, and CSS. You are especially expert in creating designs using Tailwind CSS.
export const OPEN_AI_SYSTEM_PROMPT = `You are an expert web developer who specializes in building working website prototypes from low-fidelity wireframes. Your job is to accept low-fidelity designs and turn them into interactive and responsive working prototypes. When sent new designs, you should reply with your best attempt at a high fidelity working prototype as a single HTML file.
Your job is to
- accept designs (low-fidelity wireframes, sketches, compositions, and user experience notes)
- return working single-page web apps that follow the designs
Use tailwind CSS for styling. If you must use other CSS, place it in a style tag.
Instructions:
- Use Tailwind CSS for styling.
- Use Google fonts to pull in any open source fonts you require.
- Use Unsplash to pull in any images you require.
- Use Unpkg to pull in any JavaScript or CSS libraries you require.
- Respond with a single HTML file that includes all necessary CSS and JavaScript.
Put any JavaScript in a script tag. Use unpkg or skypack to import any required JavaScript dependencies. Use Google fonts to pull in any open source fonts you require. If you have any images, load them from Unsplash or use solid colored rectangles as placeholders.
Tips:
- Markup in the color red is probably an annotation
- Avoid "etc etc" sections. Create placeholder content instead.
- Do not include any comments in your code!
- Make your web apps are more beautiful, professional, complete, and high fidelity than the designs you are given.
`
The designs may include flow charts, diagrams, labels, arrows, sticky notes, screenshots of other applications, or even previous designs. Treat all of these as references for your prototype. Use your best judgement to determine what is an annotation and what should be included in the final result. Treat anything in the color red as an annotation rather than part of the design. Do NOT include any red elements or any other annotations in your final result.
export const OPENAI_USER_PROMPT = 'Please create a web app from these designs.'
Your prototype should look and feel much more complete and advanced than the wireframes provided. Flesh it out, make it real! Try your best to figure out what the designer wants and make it happen. If there are any questions or underspecified features, use what you know about applications, user experience, and website design patterns to "fill in the blanks". If you're unsure of how the designs should work, take a guess—it's better for you to get it wrong than to leave things incomplete.
Remember: you love your designers and want them to be happy. The more complete and impressive your prototype, the happier they will be. Good luck, you've got this!`
export const OPENAI_USER_PROMPT =
'Here are the latest wireframes. Return a single HMTL file based on these wireframes and notes. Send back just the HTML file contents.'
export const OPENAI_USER_PROMPT_WITH_PREVIOUS_DESIGN =
'Please create a webapp from these designs. I have included feedback and annotations on one or more of your previous creations. Try to incorporate my feedback and annotations into your new web app.'
'Here are the latest wireframes. There are also some previous outputs here. Could you make a new website based on these wireframes and notes and send back just the html file?'

272
package-lock.json generated

@ -11,7 +11,6 @@
"dependencies": {
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@stackblitz/sdk": "^1.9.0",
"@tldraw/tldraw": "^2.0.0-canary.2211ca0063d6",
"@vercel/analytics": "^1.1.1",
"@vercel/blob": "^0.15.1",
"@vercel/kv": "^1.0.0",
@ -22,7 +21,8 @@
"next": "14.0.1",
"prettier": "^3.1.0",
"react": "^18",
"react-dom": "^18"
"react-dom": "^18",
"tldraw": "^2.0.0"
},
"devDependencies": {
"@types/node": "^20",
@ -1707,157 +1707,6 @@
"tslib": "^2.4.0"
}
},
"node_modules/@tldraw/editor": {
"version": "2.0.0-canary.2211ca0063d6",
"resolved": "https://registry.npmjs.org/@tldraw/editor/-/editor-2.0.0-canary.2211ca0063d6.tgz",
"integrity": "sha512-6Wy8PcjkEXoo7yaq9qbAkK+pq2ZhCJCh3NxEqJY+3A273bhzdTIFKpDSeURgsYly/e9RQ4wikbTVMVF0V+Lx0A==",
"dependencies": {
"@tldraw/state": "2.0.0-canary.2211ca0063d6",
"@tldraw/store": "2.0.0-canary.2211ca0063d6",
"@tldraw/tlschema": "2.0.0-canary.2211ca0063d6",
"@tldraw/utils": "2.0.0-canary.2211ca0063d6",
"@tldraw/validate": "2.0.0-canary.2211ca0063d6",
"@types/core-js": "^2.5.5",
"@use-gesture/react": "^10.2.27",
"classnames": "^2.3.2",
"core-js": "^3.31.1",
"eventemitter3": "^4.0.7",
"idb": "^7.1.1",
"is-plain-object": "^5.0.0",
"lodash.throttle": "^4.1.1",
"lodash.uniq": "^4.5.0",
"nanoid": "4.0.2"
},
"peerDependencies": {
"react": "^18",
"react-dom": "^18"
}
},
"node_modules/@tldraw/editor/node_modules/nanoid": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-4.0.2.tgz",
"integrity": "sha512-7ZtY5KTCNheRGfEFxnedV5zFiORN1+Y1N6zvPTnHQd8ENUvfaDBeuJDZb2bN/oXwXxu3qkTXDzy57W5vAmDTBw==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"bin": {
"nanoid": "bin/nanoid.js"
},
"engines": {
"node": "^14 || ^16 || >=18"
}
},
"node_modules/@tldraw/state": {
"version": "2.0.0-canary.2211ca0063d6",
"resolved": "https://registry.npmjs.org/@tldraw/state/-/state-2.0.0-canary.2211ca0063d6.tgz",
"integrity": "sha512-nZLg7jJdy2IZ6vMKVNBTM0ejt5B++QAyrQiieuTSej/fmj9yJSSE/54RsVWUCXy3tjAaogedWFZon/S0pALi/A==",
"peerDependencies": {
"react": "^18"
}
},
"node_modules/@tldraw/store": {
"version": "2.0.0-canary.2211ca0063d6",
"resolved": "https://registry.npmjs.org/@tldraw/store/-/store-2.0.0-canary.2211ca0063d6.tgz",
"integrity": "sha512-sfrHLni1OFqmfhlzyCMEzL6K6RlGIMrNBGMPQdkK6gFnsvRtIIcfVsgK0P95Rg6F+V84/WS0WTnwoJ6MeKUP3Q==",
"dependencies": {
"@tldraw/state": "2.0.0-canary.2211ca0063d6",
"@tldraw/utils": "2.0.0-canary.2211ca0063d6",
"lodash.isequal": "^4.5.0",
"nanoid": "4.0.2"
},
"peerDependencies": {
"react": "^18"
}
},
"node_modules/@tldraw/store/node_modules/nanoid": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-4.0.2.tgz",
"integrity": "sha512-7ZtY5KTCNheRGfEFxnedV5zFiORN1+Y1N6zvPTnHQd8ENUvfaDBeuJDZb2bN/oXwXxu3qkTXDzy57W5vAmDTBw==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"bin": {
"nanoid": "bin/nanoid.js"
},
"engines": {
"node": "^14 || ^16 || >=18"
}
},
"node_modules/@tldraw/tldraw": {
"version": "2.0.0-canary.2211ca0063d6",
"resolved": "https://registry.npmjs.org/@tldraw/tldraw/-/tldraw-2.0.0-canary.2211ca0063d6.tgz",
"integrity": "sha512-JJGny6p6kZ78MJ/NszPSZ7ZMxhvugeW+TQJVdYNOEzDXFLSa2q7c58zo1nUJYEvWGgRZdWkCV+Qb6kCNwDD/gQ==",
"dependencies": {
"@radix-ui/react-alert-dialog": "^1.0.5",
"@radix-ui/react-context-menu": "^2.1.5",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-select": "^1.2.0",
"@radix-ui/react-slider": "^1.1.0",
"@radix-ui/react-toast": "^1.1.1",
"@tldraw/editor": "2.0.0-canary.2211ca0063d6",
"canvas-size": "^1.2.6",
"classnames": "^2.3.2",
"hotkeys-js": "^3.11.2",
"lz-string": "^1.4.4"
},
"peerDependencies": {
"react": "^18",
"react-dom": "^18"
}
},
"node_modules/@tldraw/tlschema": {
"version": "2.0.0-canary.2211ca0063d6",
"resolved": "https://registry.npmjs.org/@tldraw/tlschema/-/tlschema-2.0.0-canary.2211ca0063d6.tgz",
"integrity": "sha512-zhUY25v5JVB2YG/Ozh9UJtSFzEZb+V2/fN/jjkNK28Rip3iZBiOj1IOSgpzuOtbKYyLvsKd6LzL8UmsbxRxyzw==",
"dependencies": {
"@tldraw/state": "2.0.0-canary.2211ca0063d6",
"@tldraw/store": "2.0.0-canary.2211ca0063d6",
"@tldraw/utils": "2.0.0-canary.2211ca0063d6",
"@tldraw/validate": "2.0.0-canary.2211ca0063d6",
"nanoid": "4.0.2"
},
"peerDependencies": {
"react": "^18"
}
},
"node_modules/@tldraw/tlschema/node_modules/nanoid": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-4.0.2.tgz",
"integrity": "sha512-7ZtY5KTCNheRGfEFxnedV5zFiORN1+Y1N6zvPTnHQd8ENUvfaDBeuJDZb2bN/oXwXxu3qkTXDzy57W5vAmDTBw==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"bin": {
"nanoid": "bin/nanoid.js"
},
"engines": {
"node": "^14 || ^16 || >=18"
}
},
"node_modules/@tldraw/utils": {
"version": "2.0.0-canary.2211ca0063d6",
"resolved": "https://registry.npmjs.org/@tldraw/utils/-/utils-2.0.0-canary.2211ca0063d6.tgz",
"integrity": "sha512-TV/F0FMTa8VneNVnScG/9FcrHx3RZ2P34xCjJXdekuiQByMNjWQ3ZIRzt5UYWHg1L1W6xTQFJtx91lMG4gt9bA=="
},
"node_modules/@tldraw/validate": {
"version": "2.0.0-canary.2211ca0063d6",
"resolved": "https://registry.npmjs.org/@tldraw/validate/-/validate-2.0.0-canary.2211ca0063d6.tgz",
"integrity": "sha512-gzsVh085zsDOD0L98zyJX3LEnF0w7Ti8Rz0rGjyaunJXVMd0U6lB0QC3W1YCuZ7a2ciOdy7EZ/kCh7+KTUm4zA==",
"dependencies": {
"@tldraw/utils": "2.0.0-canary.2211ca0063d6"
}
},
"node_modules/@tootallnate/once": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz",
@ -6651,6 +6500,123 @@
"node": ">=0.8"
}
},
"node_modules/tldraw": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/tldraw/-/tldraw-2.0.0.tgz",
"integrity": "sha512-Q0rQ9pMhQxt+SZbLpnieZhfUFWuRNDabxbSCPlmBk7IMYq7bLrJMSARpM4fQesD/IfTNPzrQPS1dzteFBK3FaA==",
"dependencies": {
"@radix-ui/react-alert-dialog": "^1.0.5",
"@radix-ui/react-context-menu": "^2.1.5",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-select": "^1.2.0",
"@radix-ui/react-slider": "^1.1.0",
"@radix-ui/react-toast": "^1.1.1",
"@tldraw/editor": "2.0.0",
"canvas-size": "^1.2.6",
"classnames": "^2.3.2",
"hotkeys-js": "^3.11.2",
"lz-string": "^1.4.4"
},
"peerDependencies": {
"react": "^18",
"react-dom": "^18"
}
},
"node_modules/tldraw/node_modules/@tldraw/editor": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@tldraw/editor/-/editor-2.0.0.tgz",
"integrity": "sha512-LfZr09NctyeaQr17HMM9ZZzTxMY2k2h9Qk/RKUwWnw//kidn65r/ODsgtnViDDrSymBA6zw9IlrzIENBMnczPA==",
"dependencies": {
"@tldraw/state": "2.0.0",
"@tldraw/store": "2.0.0",
"@tldraw/tlschema": "2.0.0",
"@tldraw/utils": "2.0.0",
"@tldraw/validate": "2.0.0",
"@types/core-js": "^2.5.5",
"@use-gesture/react": "^10.2.27",
"classnames": "^2.3.2",
"core-js": "^3.31.1",
"eventemitter3": "^4.0.7",
"idb": "^7.1.1",
"is-plain-object": "^5.0.0",
"lodash.throttle": "^4.1.1",
"lodash.uniq": "^4.5.0",
"nanoid": "4.0.2"
},
"peerDependencies": {
"react": "^18",
"react-dom": "^18"
}
},
"node_modules/tldraw/node_modules/@tldraw/state": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@tldraw/state/-/state-2.0.0.tgz",
"integrity": "sha512-MaD8bVRouQ69OsgySDpFBNcGw7nhI1pc0vf/0Ryl2cMIo0lztPKj0mfgm+cU+dFYxZLdeEi83OOxk6uH6RZAnQ==",
"peerDependencies": {
"react": "^18"
}
},
"node_modules/tldraw/node_modules/@tldraw/store": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@tldraw/store/-/store-2.0.0.tgz",
"integrity": "sha512-2z+DF/eEgr/ruIzHpbO8VgtYl2gFjALK/LDm/fYDvi1DTUUvZtG/NN+9gSNf4UtsgVbjHJUupsB8spCCQ3QjdA==",
"dependencies": {
"@tldraw/state": "2.0.0",
"@tldraw/utils": "2.0.0",
"lodash.isequal": "^4.5.0",
"nanoid": "4.0.2"
},
"peerDependencies": {
"react": "^18"
}
},
"node_modules/tldraw/node_modules/@tldraw/tlschema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@tldraw/tlschema/-/tlschema-2.0.0.tgz",
"integrity": "sha512-ylV+LhqOa5NULFt5LMvd78oQvx4xi4yB2Tz0PZnZ6kB840iTitlxI98qwXUIlXVBeKAgmhssvtzG26BAACa9Wg==",
"dependencies": {
"@tldraw/state": "2.0.0",
"@tldraw/store": "2.0.0",
"@tldraw/utils": "2.0.0",
"@tldraw/validate": "2.0.0",
"nanoid": "4.0.2"
},
"peerDependencies": {
"react": "^18"
}
},
"node_modules/tldraw/node_modules/@tldraw/utils": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@tldraw/utils/-/utils-2.0.0.tgz",
"integrity": "sha512-8EKrAOMlhO7fPDJMFdGEVdYzR/Enc9K5PBSWkiZGw4jWXbe3e828xk6m/sJ/iDBRZzdPPn7UnZPhY1mQ/ONgig=="
},
"node_modules/tldraw/node_modules/@tldraw/validate": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@tldraw/validate/-/validate-2.0.0.tgz",
"integrity": "sha512-bnSEtYnr/+i/B5ej0IHshAiJnRFa3SgIHXI57b/Cctw17kdidMhQLokTPlUaWOzcFvySaGYqmO2aPo3Ede25jw==",
"dependencies": {
"@tldraw/utils": "2.0.0"
}
},
"node_modules/tldraw/node_modules/nanoid": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-4.0.2.tgz",
"integrity": "sha512-7ZtY5KTCNheRGfEFxnedV5zFiORN1+Y1N6zvPTnHQd8ENUvfaDBeuJDZb2bN/oXwXxu3qkTXDzy57W5vAmDTBw==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"bin": {
"nanoid": "bin/nanoid.js"
},
"engines": {
"node": "^14 || ^16 || >=18"
}
},
"node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",

@ -12,7 +12,7 @@
"dependencies": {
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@stackblitz/sdk": "^1.9.0",
"@tldraw/tldraw": "^2.0.0-canary.2211ca0063d6",
"tldraw": "^2.0.0",
"@vercel/analytics": "^1.1.1",
"@vercel/blob": "^0.15.1",
"@vercel/kv": "^1.0.0",

Loading…
Cancel
Save