Search
Code3,900
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";import { Hono } from "npm:hono@4.4.12"; </button> </form> <p class="text-sm text-gray-500 mt-6">Powered by Val Town & OpenAI</p> </div> <div id="start-overlay" class="fixed inset-0 bg-gray-900/80 backdrop-blur-sm z-20 flex flex-col justify-center items-center text-center p-8 opacity-0 pointer-events-none transition-opacity duration-500"> } const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [ } } catch (error) { console.error("OpenAI API Error:", error); return c.json({ error: "An error occurred while communicating with the AI designer.", } const response = await fetch("https://api.openai.com/v1/chat/completions", { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${process.env.OPENAI_API_KEY}`, }, body: JSON.stringify({ if (!response.ok) { throw new Error(`OpenAI API error: ${response.status}`); } } const response = await fetch("https://api.openai.com/v1/chat/completions", { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${process.env.OPENAI_API_KEY}`, }, body: JSON.stringify({ if (!response.ok) { throw new Error(`OpenAI API error: ${response.status}`); }Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.### OpenAI```tsimport { OpenAI } from "https://esm.town/v/std/openai";const openai = new OpenAI();const completion = await openai.chat.completions.create({ messages: [ { role: "user", content: "Say hello in a creative way" },_2 or _3) to create a fresh table.### OpenAI```tsimport { OpenAI } from "https://esm.town/v/std/openai";const openai = new OpenAI();const completion = await openai.chat.completions.create({ messages: [ { role: "user", content: "Say hello in a creative way" },**AI enrichment, browser automation:**- [std/openai: Prompt an OpenAI model](/reference/std/openai)- [Clay: Enrich user data with Clay](https://blog.val.town/clay)- [Browserbase: Search the web with Browserbase](/guides/browser-automation/browserbase/)// @description: Intelligently scaffolds new Val Town projects from a string, with a helpful UI and debug console.import { OpenAI } from "https://esm.town/v/std/openai?v=4";// --- Frontend UI Generation --- content: string,): Promise<{ projectName: string; projectDescription: string }> { const openai = new OpenAI(); const prompt = `You are an expert software architect. Analyze the following file paths and code snippets. Based on the content, generate: 1. A concise, descriptive, and URL-safe project name in kebab-case. 2. A one-sentence description of the project's purpose. Respond ONLY with a single, minified JSON object with these exact keys: "projectName" and "projectDescription". Input Content: \`\`\`${content}\`\`\``; try { const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: prompt }], }; } catch (error) { console.error("OpenAI call failed:", error); return { projectName: `fallback-project-${Date.now()}`,import { slack } from "./slack.ts";import { Hono } from "npm:hono";import { icp } from "./openai.ts";const app = new Hono();import { OpenAI } from "https://esm.town/v/std/openai";import { z } from "npm:zod@3.23.8";import { zodResponseFormat } from "npm:openai@5.12.2/helpers/zod";const openai = new OpenAI();const ICPResult = z.object({ }]; const resp = await openai.chat.completions.parse({ model: "gpt-5-mini", messages,// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// --- AI BEHAVIORAL GUIDELINES --- if (req.method === "POST") { try { const openai = new OpenAI(); const body = await req.json(); ]; const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: messages,reconsumeralization
import { OpenAI } from "https://esm.town/v/std/openai";
import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
/**
* Practical Implementation of Collective Content Intelligence
* Bridging advanced AI with collaborative content creation
*/
exp
kwhinnery_openai
lost1991
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
No docs found