Search
Code3,203
* Paste this whole file into a new Val and hit save. * It renders an endlessly swirling radial vortex with shifting colours. * – ChatGPT (OpenAI o3) 2025‑04‑17 */
console.log("🎤 Sending request to Groq Whisper API"); const start = Date.now(); const response = await fetch("https://api.groq.com/openai/v1/audio/transcriptions", { method: "POST", headers: { console.log("🔵 Sending request to Groq API"); const start = Date.now(); const response = await fetch("https://api.groq.com/openai/v1/chat/completions", { method: "POST", headers: { console.log("🔊 Sending request to Groq Speech API"); const start = Date.now(); const response = await fetch("https://api.groq.com/openai/v1/audio/speech", { method: "POST", headers: {
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" },
console.log("🎤 Sending request to Groq Whisper API"); const start = Date.now(); const response = await fetch("https://api.groq.com/openai/v1/audio/transcriptions", { method: "POST", headers: { console.log("🔵 Sending request to Groq API"); const start = Date.now(); const response = await fetch("https://api.groq.com/openai/v1/chat/completions", { method: "POST", headers: { console.log("🔊 Sending request to Groq Speech API"); const start = Date.now(); const response = await fetch("https://api.groq.com/openai/v1/audio/speech", { method: "POST", headers: {
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" },
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" },
{ "emoji": "Single emoji summarizing the text", "fullResponse": "JSON string containing the full OpenAI API response", "fromCache": "Boolean indicating whether the response was retrieved from cache"}{ "emoji": "🍕", "fullResponse": "{ ... full OpenAI API response ... }", "fromCache": false}Note: The fullResponse field contains the complete OpenAI API response as a JSON string.You may want to parse this JSON string to access specific details of the API response.Caching:The API now uses SQLite to cache responses. If a request for the same text is made again,the cached emoji will be returned without calling the OpenAI API. This reduces API callsand improves response times for repeated queries.`} </pre>export default async function server(request: Request): Promise<Response> { const { OpenAI } = await import("https://esm.town/v/std/openai"); const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite"); const openai = new OpenAI(); const url = new URL(request.url); } // If not in cache, call OpenAI API const completion = await openai.chat.completions.create({ messages: [ { role: "system", content: "You are an emoji summarizer. Given a text, respond with exactly one emoji that best summarizes the content. Only respond with the single emoji, nothing else." },
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" },
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