Search
Code3,285
## Environment Variables- `OPENAI_API_KEY` - For AI-powered task suggestions (optional)- `EMAIL_FROM` - Default email sender for follow-ups
- Similar sounding names (names with similar sounds or patterns)- **Length Preferences**: Short (3-5 letters), any length, or long (6+ letters)- **AI-Powered**: Uses OpenAI GPT-4o-mini to generate creative and meaningful name pairs- **Beautiful UI**: Clean, responsive design with gradient cards and smooth animations- **Backend**: Hono framework with TypeScript- **AI**: OpenAI GPT-4o-mini for name generation- **Frontend**: Vanilla JavaScript with TailwindCSS- **Platform**: Val Town serverless environment
import { Hono } from "https://esm.sh/hono@3.11.7";import { OpenAI } from "https://esm.town/v/std/openai";import { readFile } from "https://esm.town/v/std/utils@85-main/index.ts";});const openai = new OpenAI();// Serve the main page Make sure the names are appropriate for the specified genders and provide a good variety of options.`; const completion = await openai.chat.completions.create({ messages: [ { role: "system", content: "You are a helpful assistant that specializes in suggesting baby names. Always respond with valid JSON." },
import { Hono } from "https://esm.sh/hono@3.11.7";import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";import { OpenAI } from "https://esm.town/v/std/openai";import type { CustomerPersona, ChatSession, Message, ChatRequest, ChatResponse } from "../shared/types.ts";});const openai = new OpenAI();// In-memory storage for demo (in production, use SQLite) try { const completion = await openai.chat.completions.create({ messages: [ { role: "system", content: systemPrompt }, } catch (error) { console.error('OpenAI API error:', error); return c.json({ error: "Failed to generate response" }, 500); }
- **Poetry Generator**: Generates poems in various styles (haiku, sonnet, free verse, limerick)- **Customizable Inputs**: Users can specify genres, moods, themes, and other creative elements- **AI-Powered**: Uses OpenAI to generate high-quality, creative content- **Clean Interface**: Simple, writer-friendly design focused on the content## Environment Variables- `OPENAI_API_KEY` - Required for AI content generation
## Environment Variables- `OPENAI_API_KEY` - Required for OpenAI API access (automatically configured in Val Town)## Usage
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 type { ChatRequest, ChatResponse, ImageGenerationRequest, ImageGenerationResponse } from "../shared/types.ts";});const openai = new OpenAI();// Serve static files }); const completion = await openai.chat.completions.create({ model: "gpt-4o-mini", messages: messages, } const response = await openai.images.generate({ model: "dall-e-3", prompt: body.prompt, if (!imageUrl) { throw new Error("No image URL returned from OpenAI"); }
# TLDR This - Article SummarizerA simple web application that summarizes articles and URLs into 1-3 sentence summaries using OpenAI's API.## Features- **Simple Interface**: Clean textarea for pasting URLs or article text- **Smart Summarization**: Uses OpenAI API to generate concise 1-3 sentence summaries- **URL Support**: Automatically fetches and summarizes content from URLs- **Error Handling**: Graceful handling of invalid URLs, API failures, and other errors## Setup Instructions1. **Environment Variables**: Set up your OpenAI API key in Val Town environment variables: - Go to your Val Town settings - Add environment variable: `OPENAI_API_KEY` with your OpenAI API key2. **Deploy**: The app will automatically deploy when you save the files in Val TownThe app handles various error scenarios:- Invalid or unreachable URLs- OpenAI API failures or rate limits- Network connectivity issues- Malformed input data
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 type { SummarizeRequest, SummarizeResponse, ArticleContent } from "/shared/types.ts";});// Initialize OpenAIconst openai = new OpenAI();// Serve frontend files}// Generate summary using OpenAIasync function generateSummary(content: string, title?: string): Promise<string> { try { : `Please summarize the following text in 1-3 clear, concise sentences:\n\n${content}`; const completion = await openai.chat.completions.create({ 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