186export default async function server(request: Request): Promise<Response> {
187 if (request.method === "POST") {
188 const { OpenAI } = await import("https://esm.town/v/std/openai");
189 const openai = new OpenAI();
190
191 const { campaignType, targetAudience } = await request.json();
199 Tone should be professional, confident, and friendly. Suitable for LinkedIn, Instagram, and TikTok.`;
200
201 const completion = await openai.chat.completions.create({
202 messages: [{ role: "user", content: prompt }],
203 model: "gpt-4o-mini",
1import OpenAI from "https://esm.sh/openai@4.96.0";
2import { getDistance } from "https://esm.sh/geolib@3.3.4";
3const API_ROOT =
4 "https://esm.town/v/wolf/fixItWand/backend/workorders/locations";
5
6const openai = new OpenAI();
7
8export interface Site {
176
177 // Use GPT-4o-mini to find the best match
178 const chatResponse = await openai.chat.completions.create({
179 model: "gpt-4o-mini",
180 messages: [
35 console.log("🔊 Sending request to Groq Speech API");
36 const start = Date.now();
37 const response = await fetch("https://api.groq.com/openai/v1/audio/speech", {
38 method: "POST",
39 headers: {
291 }
292
293 // Using the OpenAI standard library for TTS
294 const { OpenAI } = await import("https://esm.town/v/std/openai");
295 const openai = new OpenAI();
296
297 const mp3 = await openai.audio.speech.create({
298 model: "tts-1",
299 voice: voice || "alloy",
23## Voice Options
24
25The app uses OpenAI's Text-to-Speech API with these voices:
26
27- Alloy - Neutral, versatile voice
223 const { text, voice } = await request.json();
224
225 // Using the OpenAI standard library for TTS
226 const { OpenAI } = await import("https://esm.town/v/std/openai");
227 const openai = new OpenAI();
228
229 const mp3 = await openai.audio.speech.create({
230 model: "tts-1",
231 voice: voice || "alloy",
1// List of available voices for OpenAI TTS API
2export const voices = [
3 { id: "alloy", name: "Alloy", description: "Neutral, versatile voice" },
190 const { text } = await request.json();
191
192 // Using the OpenAI standard library for TTS
193 const { OpenAI } = await import("https://esm.town/v/std/openai");
194 const openai = new OpenAI();
195
196 const mp3 = await openai.audio.speech.create({
197 model: "tts-1",
198 voice: "alloy",
14const urls = [
15 "https://console.groq.com/docs/quickstart",
16 "https://console.groq.com/docs/openai",
17 "https://console.groq.com/docs/models",
18 "https://console.groq.com/docs/rate-limits",
128 if (url.pathname === "/generate-character") {
129 try {
130 const { OpenAI } = await import("https://esm.town/v/std/openai");
131 const openai = new OpenAI();
132
133 // Define the Italian Brainrot character templates based on popular examples
158Create a character that perfectly fits this absurd meme universe without mentioning any specific brands or companies in the description.`;
159
160 const nameCompletion = await openai.chat.completions.create({
161 messages: [
162 { role: "system", content: brainrotSystemPrompt },
169 const characterName = nameCompletion.choices[0].message.content.trim();
170
171 const descriptionCompletion = await openai.chat.completions.create({
172 messages: [
173 { role: "system", content: brainrotSystemPrompt },
187
188 // Get a viral catchphrase
189 const catchphraseCompletion = await openai.chat.completions.create({
190 messages: [
191 { role: "system", content: brainrotSystemPrompt },