Search

3,380 results found for openai (9129ms)

Code
3,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
const completion = await openai.chat.completions.create({
messages: [
{ role: "system", content: "You are a helpful assistant that specializes in suggesting b
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
});
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
});
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 Summarizer
rizes 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 Instructions
1. **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 key
2. **Deploy**: The app will automatically deploy when you save the files in Val Town
The 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 OpenAI
const openai = new OpenAI();
// Serve frontend files
}
// Generate summary using OpenAI
async 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: [
{
<div className="text-center mt-8 text-white/60 text-sm">
<p>
Powered by OpenAIBuilt with ❤️ on Val Town
</p>
</div>