3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
4
5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
20await createTables();
21
22export default async function cerebras_coder(req: Request): Promise<Response> {
23 if (req.method === "POST") {
24 let { prompt, currentCode, versionHistory, projectId } = await req.json();
23);
24
25function Hero({
26 prompt,
27 setPrompt,
44
45 <p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
46 Turn your ideas into fully functional apps in{" "}
47 <span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
48 less than a second
115}
116
117function App() {
118 const previewRef = React.useRef<HTMLDivElement>(null);
119 const [prompt, setPrompt] = useState("");
169 });
170
171 function handleStarterPromptClick(promptItem: typeof prompts[number]) {
172 setLoading(true);
173 setTimeout(() => handleSubmit(promptItem.prompt), 0);
174 }
175
176 async function handleSubmit(e: React.FormEvent | string) {
177 if (typeof e !== "string") {
178 e.preventDefault();
225 }
226
227 function handleVersionChange(direction: "back" | "forward") {
228 const { currentVersionIndex, versions } = versionHistory;
229 if (direction === "back" && currentVersionIndex > 0) {
973);
974
975function client() {
976 const path = window.location.pathname;
977 const root = createRoot(document.getElementById("root")!);
2import STARTER_PROMPTS from "../public/starter-prompts.js";
3
4function extractCodeFromFence(text: string): string {
5 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
6 return htmlMatch ? htmlMatch[1].trim() : text;
7}
8
9export async function generateCode(prompt: string, currentCode: string) {
10 const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
11 if (starterPrompt) {
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}
14}
15
16function App() {
17 const [expenses, setExpenses] = useState<Expense[]>([]);
18 const [newExpense, setNewExpense] = useState<Partial<Expense>>({
28 }, []);
29
30 async function fetchExpenses() {
31 try {
32 const response = await fetch('/expenses');
38 }
39
40 async function submitExpense() {
41 try {
42 const response = await fetch('/submit-expense', {
141}
142
143function client() {
144 createRoot(document.getElementById("root")).render(<App />);
145}
146if (typeof document !== "undefined") { client(); }
147
148export default async function server(request: Request): Promise<Response> {
149 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
150 const KEY = "enterpriseExpenseManagement";
13];
14
15function App() {
16 const [noClicks, setNoClicks] = useState(0);
17 const [isValentine, setIsValentine] = useState(false);
98}
99
100function client() {
101 createRoot(document.getElementById("root")).render(<App />);
102}
103if (typeof document !== "undefined") { client(); }
104
105export default async function server(request: Request): Promise<Response> {
106 return new Response(
107 `
45`;
46
47function getYesterdayDateRange(): { startDate: string; endDate: string } {
48 const now = new Date();
49 const yesterday = new Date(now.setDate(now.getDate() - 1));
56}
57
58export async function exec(interval: Interval) {
59 const apiKey = Deno.env.get("LINEAR_API_KEY");
60 if (!apiKey) {
132 });
133
134 function determineMatchedContext(
135 history: any[],
136 startDate: string,
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function PercentileCalculator() {
6 const [longExams, setLongExams] = useState([0, 0, 0]);
7 const [finalExam, setFinalExam] = useState(0);
65}
66
67function client() {
68 createRoot(document.getElementById("root")).render(<PercentileCalculator />);
69}
70if (typeof document !== "undefined") { client(); }
71
72export default async function server(request: Request): Promise<Response> {
73 return new Response(`
74 <html>
3import type { Message } from "../shared/types.ts";
4
5export function MessageInput({ onSubmit }: { onSubmit: () => void }) {
6 const [message, setMessage] = React.useState("");
7
4import { OpenAI } from "npm:openai";
5
6function emailValHandlerExtra(inboundEmail: Email) {
7 console.log("Received email:", {
8 from: inboundEmail.from,
21}
22
23function pm(...lines: string[]): string {
24 return lines.join("\n");
25}
26
27export async function emailValHandler(inboundEmail: Email) {
28 const userPrompt = pm(
29 `From: ${inboundEmail.from}`,