Search
Code3,914
<a href="?q=function" className="example-link">function</a> <a href="?q=discord" className="example-link">discord</a> <a href="?q=openai" className="example-link">openai</a> <a href="?q=react" className="example-link">react</a> </div> <a href="?q=function" className="example-link">function</a> <a href="?q=discord" className="example-link">discord</a> <a href="?q=openai" className="example-link">openai</a> <a href="?q=react" className="example-link">react</a> </div>import { blob } from "https://esm.town/v/std/blob";import { OpenAI } from "https://esm.town/v/std/openai";import { dataToRSS } from "https://esm.town/v/mwalker/dataToRSS/main.tsx";}// Translate text from Japanese to English using OpenAIasync function translateToEnglish(text: string): Promise<string> { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ messages: [ {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" },import { blob } from "https://esm.town/v/std/blob";import { OpenAI } from "https://esm.town/v/std/openai";import { dataToRSS } from "https://esm.town/v/stevekrouse/dataToRSS";}// Translate text from Japanese to English using OpenAIasync function translateToEnglish(text: string): Promise<string> { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ messages: [ {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" },- `main.tsx` - Main cron function and Discord webhook- `fetch-vals.ts` - Fetches and filters new vals using Val Town SDK- `ai-summarizer.ts` - Generates OpenAI summaries for vals without READMEs## Additional logic- Filter out commonly remixed utility vals like Blob Admin, SQLiteExplorer- Skip shallow remixes (forks with ≤3 versions)- Prioritize `main.tsx` files for AI summaries and limit code sent to OpenAI to 5KB to avoid token limits## Setup1. Set `DISCORD_WEBHOOK` environment variable2. Set `OPENAI_API_KEY` environment variable3. Set `testMode = false` in main.tsx for productionimport { OpenAI } from "npm:openai";import ValTown from "npm:@valtown/sdk";const openai = new OpenAI();const client = new ValTown(); } const response = await openai.chat.completions.create({ model: "gpt-4o-mini", 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