1# Twin Name Generator
2
3An AI-powered tool for generating perfect name pairs for twins using OpenAI's GPT model.
4
5## Features
27- **Frontend**: HTML, CSS (TailwindCSS), Vanilla JavaScript
28- **Backend**: Hono framework on Val Town
29- **AI**: OpenAI GPT-4o-mini for intelligent name generation
30- **Styling**: Gradient backgrounds, smooth animations, responsive design
31
75## Environment Variables
76
77- `OPENAI_API_KEY` - For AI-powered task suggestions (optional)
78- `EMAIL_FROM` - Default email sender for follow-ups
79
10 - Similar sounding names (names with similar sounds or patterns)
11- **Length Preferences**: Short (3-5 letters), any length, or long (6+ letters)
12- **AI-Powered**: Uses OpenAI GPT-4o-mini to generate creative and meaningful name pairs
13- **Beautiful UI**: Clean, responsive design with gradient cards and smooth animations
14
30
31- **Backend**: Hono framework with TypeScript
32- **AI**: OpenAI GPT-4o-mini for name generation
33- **Frontend**: Vanilla JavaScript with TailwindCSS
34- **Platform**: Val Town serverless environment
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { readFile } from "https://esm.town/v/std/utils@85-main/index.ts";
4
10});
11
12const openai = new OpenAI();
13
14// Serve the main page
52 Make sure the names are appropriate for the specified genders and provide a good variety of options.`;
53
54 const completion = await openai.chat.completions.create({
55 messages: [
56 { role: "system", content: "You are a helpful assistant that specializes in suggesting baby names. Always respond with valid JSON." },
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { OpenAI } from "https://esm.town/v/std/openai";
4import type { CustomerPersona, ChatSession, Message, ChatRequest, ChatResponse } from "../shared/types.ts";
5
11});
12
13const openai = new OpenAI();
14
15// In-memory storage for demo (in production, use SQLite)
179
180 try {
181 const completion = await openai.chat.completions.create({
182 messages: [
183 { role: "system", content: systemPrompt },
218
219 } catch (error) {
220 console.error('OpenAI API error:', error);
221 return c.json({ error: "Failed to generate response" }, 500);
222 }
8- **Poetry Generator**: Generates poems in various styles (haiku, sonnet, free verse, limerick)
9- **Customizable Inputs**: Users can specify genres, moods, themes, and other creative elements
10- **AI-Powered**: Uses OpenAI to generate high-quality, creative content
11- **Clean Interface**: Simple, writer-friendly design focused on the content
12
40## Environment Variables
41
42- `OPENAI_API_KEY` - Required for AI content generation
35## Environment Variables
36
37- `OPENAI_API_KEY` - Required for OpenAI API access (automatically configured in Val Town)
38
39## Usage
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
4import type { ChatRequest, ChatResponse, ImageGenerationRequest, ImageGenerationResponse } from "../shared/types.ts";
11});
12
13const openai = new OpenAI();
14
15// Serve static files
63 });
64
65 const completion = await openai.chat.completions.create({
66 model: "gpt-4o-mini",
67 messages: messages,
100 }
101
102 const response = await openai.images.generate({
103 model: "dall-e-3",
104 prompt: body.prompt,
111
112 if (!imageUrl) {
113 throw new Error("No image URL returned from OpenAI");
114 }
115
1# TLDR This - Article Summarizer
2
3A simple web application that summarizes articles and URLs into 1-3 sentence summaries using OpenAI's API.
4
5## Features
6
7- **Simple Interface**: Clean textarea for pasting URLs or article text
8- **Smart Summarization**: Uses OpenAI API to generate concise 1-3 sentence summaries
9- **URL Support**: Automatically fetches and summarizes content from URLs
10- **Error Handling**: Graceful handling of invalid URLs, API failures, and other errors
31## Setup Instructions
32
331. **Environment Variables**: Set up your OpenAI API key in Val Town environment variables:
34 - Go to your Val Town settings
35 - Add environment variable: `OPENAI_API_KEY` with your OpenAI API key
36
372. **Deploy**: The app will automatically deploy when you save the files in Val Town
59The app handles various error scenarios:
60- Invalid or unreachable URLs
61- OpenAI API failures or rate limits
62- Network connectivity issues
63- Malformed input data
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
4import type { SummarizeRequest, SummarizeResponse, ArticleContent } from "/shared/types.ts";
11});
12
13// Initialize OpenAI
14const openai = new OpenAI();
15
16// Serve frontend files
99}
100
101// Generate summary using OpenAI
102async function generateSummary(content: string, title?: string): Promise<string> {
103 try {
106 : `Please summarize the following text in 1-3 clear, concise sentences:\n\n${content}`;
107
108 const completion = await openai.chat.completions.create({
109 messages: [
110 {