Public

Versions

  • v3

    8/25/2024
    Open: Version
    Changes from v2 to v3
    +25
    -7
    ⦚ 68 unchanged lines ⦚
    </div>
    )}
    <a href={import.meta.url.replace("esm.town", "val.town")} target="_blank" rel="noopener noreferrer" className="view-source">
    View Source
    </a>
    ⦚ 21 unchanged lines ⦚
    const completion = await openai.chat.completions.create({
    messages: [
    { role: "system", content: "You are an expert in Val Town development. Generate an optimized prompt for creating a Val Town application based on the user's idea. Include specific Val Town features and best practices in your response." },
    { role: "user", content: `Generate a prompt for a Val Town application with the following idea: ${idea}. Include references to Val Town features like: ${valTownFeatures.join(", ")}. The prompt should guide the user to create a well-structured Val Town application.` },
    ],
    model: "gpt-4-1106-preview",
    ⦚ 14 unchanged lines ⦚
    }

    return new Response(`
    <!DOCTYPE html>
    <html lang="en">
    ⦚ 9 unchanged lines ⦚
    </body>
    </html>
    `, {
    headers: { "content-type": "text/html" },
    });
    }

    ⦚ 89 unchanged lines ⦚
    ⦚ 68 unchanged lines ⦚
    </div>
    )}
    <a
    href={import.meta.url.replace("esm.town", "val.town")}
    target="_blank"
    rel="noopener noreferrer"
    className="view-source"
    >
    View Source
    </a>
    ⦚ 21 unchanged lines ⦚
    const completion = await openai.chat.completions.create({
    messages: [
    {
    role: "system",
    content:
    "You are an expert in Val Town development. Generate an optimized prompt for creating a Val Town application based on the user's idea. Include specific Val Town features and best practices in your response. Respond with only with the prompt in a single text line.",
    },
    {
    role: "user",
    content:
    `Generate a prompt for a Val Town application with the following idea: ${idea}. Include references to Val Town features like: ${
    valTownFeatures.join(", ")
    }. The prompt should guide the user to create a well-structured Val Town application.`,
    },
    ],
    model: "gpt-4-1106-preview",
    ⦚ 14 unchanged lines ⦚
    }

    return new Response(
    `
  • v2

    8/23/2024
    Open: Version
    Changes from v1 to v2
    +63
    -61
    /**
    * This val creates a website that generates optimized prompts for Hono and Deno based on user input.
    * It uses a simulated API for Hono and Deno features and incorporates a loading animation.
    * The prompt is tested and debugged using a simulated API before presenting to the user.
    */
    /** @jsxImportSource https://esm.sh/react */
    import React, { useState } from "https://esm.sh/react";
    import { createRoot } from "https://esm.sh/react-dom/client";

    // Simulated API for Hono and Deno features
    const features = {
    hono: [
    "Routing",
    "Middleware",
    "Static file serving",
    "WebSocket support",
    "JWT authentication",
    "Validation",
    "Templating",
    ],
    deno: [
    "TypeScript support",
    "Top-level await",
    "ES modules",
    "Standard library",
    "Built-in testing",
    "Permissions system",
    "Web standard APIs",
    ],
    };

    function App() {
    const [idea, setIdea] = useState("");
    const [prompt, setPrompt] = useState("");
    const [loading, setLoading] = useState(false);
    const [progress, setProgress] = useState(0);
    /**
    * This val creates a website that generates optimized prompts for Val Town based on user input.
    * It uses the OpenAI API to generate prompts and incorporates a loading animation.
    * The generated prompt is tailored to Val Town's specific features and best practices.
    */
    /** @jsxImportSource https://esm.sh/react */
    import React, { useState } from "https://esm.sh/react";
    import { createRoot } from "https://esm.sh/react-dom/client";

    const valTownFeatures = [
    "HTTP vals",
    "Scheduled vals",
    "SQLite database",
    "Blob storage",
    "Email sending",
    "OpenAI integration",
    "React support",
    "TypeScript support",
    "Deno runtime",
    "Web APIs",
    ];

    function App() {
    const [idea, setIdea] = useState("");
    const [prompt, setPrompt] = useState("");
    const [loading, setLoading] = useState(false);

    const generatePrompt = async () => {
    setLoading(true);
    try {
    const response = await fetch("/generate", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ idea }),
    });
    if (!response.ok) throw new Error("Failed to generate prompt");
  • v1

    8/23/2024
    Open: Version
    Changes from v0 to v1
    +0
    -0
    ⦚ 222 unchanged lines ⦚
    ⦚ 222 unchanged lines ⦚
  • v0

    8/23/2024
    Open: Version
    +222
    -0

    /**
    * This val creates a website that generates optimized prompts for Hono and Deno based on user input.
    * It uses a simulated API for Hono and Deno features and incorporates a loading animation.
    * The prompt is tested and debugged using a simulated API before presenting to the user.
    */
    /** @jsxImportSource https://esm.sh/react */
    import React, { useState } from "https://esm.sh/react";
    import { createRoot } from "https://esm.sh/react-dom/client";

    // Simulated API for Hono and Deno features
    const features = {
    hono: [
    "Routing",
    "Middleware",
    "Static file serving",
    "WebSocket support",
    "JWT authentication",
    "Validation",
    "Templating",
    ],
    deno: [
    "TypeScript support",
    "Top-level await",
    "ES modules",
    "Standard library",
    "Built-in testing",
    "Permissions system",
    "Web standard APIs",
    ],
    };

    function App() {
    const [idea, setIdea] = useState("");
    const [prompt, setPrompt] = useState("");
    const [loading, setLoading] = useState(false);
    const [progress, setProgress] = useState(0);
1
Next
all-promptgen.web.val.run
Updated: August 25, 2024