Search
Code3,275
import { Hono } from "https://esm.sh/hono@3.11.7";import { OpenAI } from "https://esm.town/v/std/openai";import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";import { parseProject } from "https://esm.town/v/std/utils@85-main/index.ts"; } const openai = new OpenAI(); // Prepare messages with history and enhanced system prompt ]; const completion = await openai.chat.completions.create({ messages, model: "gpt-4o-mini",
<footer class="mt-8 text-center text-gray-500 text-sm"> <p> Digital 3D AI Teacher - Powered by OpenAI and Three.js <br> <a id="view-source" href="#" target="_top" class="text-indigo-500 hover:underline">View Source</a>
- Detailed facial features with realistic skin, eyes, and hair - Lifelike animations and expressions- AI-powered responses using OpenAI's API- Interactive chat interface- Educational content delivery - Advanced lighting setup for photorealistic rendering - Facial animation system- OpenAI API for AI responses- Tailwind CSS for styling
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" },
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" },
import { anthropic } from "npm:@ai-sdk/anthropic";import { openai } from "npm:@ai-sdk/openai";import { generateText } from "npm:ai";import { try { const { text, toolCalls, toolResults } = await generateText({ // model: openai(this.modelName), model: anthropic("claude-3-7-sonnet-20250219"), tools: this.tools,
import { openai } from "npm:@ai-sdk/openai";import { streamText, tool } from "npm:ai";import { z } from "npm:zod"; const result = streamText({ model: openai("gpt-4o"), messages, toolChoice: "auto",
import { OpenAI } from "https://esm.town/v/std/openai";/** * Simple test to verify OpenAI API key is working */export default async function(): Promise<Response> { try { // Check for OpenAI API key const apiKey = Deno.env.get("OPENAI_API_KEY"); if (!apiKey) { return new Response(JSON.stringify({ error: "OpenAI API key is missing", message: "Please set the OPENAI_API_KEY environment variable in Val Town." }), { status: 500, } // Test OpenAI API const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-3.5-turbo", messages: [ return new Response(JSON.stringify({ success: true, message: "OpenAI API key is working correctly", response: completion.choices[0].message.content }), { } catch (error) { return new Response(JSON.stringify({ error: "OpenAI API test failed", message: error.message || "Unknown error" }), {
# AI Course GeneratorThis Val Town project generates comprehensive course structures from user prompts using OpenAI.## Features- Takes a course topic as input and generates a complete course structure- Uses OpenAI's GPT-4o model for high-quality content generation- Provides a structured output with course title, description, target audience, prerequisites, learning outcomes, modules, and lessons- Includes a user-friendly web interface## Project Structure- `/course-generator.ts` - Core logic for generating course structures using OpenAI- `/frontend-handler.ts` - HTTP handler that serves the frontend and processes API requests- `/frontend/index.html` - Web interface for the course generator## Requirements- OpenAI API key set as an environment variable in Val Town## Setup Instructions1. In Val Town, go to your account settings2. Add an environment variable named `OPENAI_API_KEY` with your OpenAI API key3. Deploy both the course-generator.ts and frontend-handler.ts files with HTTP triggersIf the application isn't generating any responses, check the following:1. **OpenAI API Key**: Make sure you've set the `OPENAI_API_KEY` environment variable in Val Town2. **Console Logs**: Check the Val Town logs for any error messages3. **Browser Console**: Open your browser's developer tools to check for any JavaScript errors4. **API Limits**: If you're using a free OpenAI API key, you might have hit your usage limits
<footer class="text-center mt-10 text-gray-500 text-sm"> <p>Powered by Val Town and OpenAI</p> <a href="#" id="viewSource" target="_top" class="text-blue-500 hover:underline">View Source</a> </footer>
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