Search
Code3,914
import { Agent, run, webSearchTool } from "npm:@openai/agents@0.3.0";import { email } from "https://esm.town/v/std/email?v=11";import { blob } from "https://esm.town/v/std/blob"; } const apiKey = __secrets['OPENAI_API_KEY']; if (!apiKey) { return Response.json({ error: 'OpenAI API key not configured' }, { status: 500 }); } console.log('Generating image, prompt length:', prompt.length); const response = await fetch('https://api.openai.com/v1/images/generations', { method: 'POST', headers: { if (!response.ok) { const error = await response.json(); console.error('OpenAI API error status:', response.status); return Response.json({ error: error.error?.message || 'Failed to generate image' } const apiKey = __secrets['OPENAI_API_KEY']; if (!apiKey) { console.log("OpenAI API key not configured"); return Response.json({ reply: "I'm not fully set up yet! The admin needs to add an OpenAI API key to enable AI responses." }); } const response = await fetch("https://api.openai.com/v1/chat/completions", { method: "POST", headers: { if (!response.ok) { const errorText = await response.text(); console.log("OpenAI API error:", errorText); return Response.json({ reply: "Oops! I'm having trouble thinking right now. Please try again in a moment! ๐ค" 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" },_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" },_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" },_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 { sqlite } from "https://esm.town/v/std/sqlite";// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai";// --- THEME & DEFAULTS ---}// --- OPENAI PROMPTS ---const NARRATE_DONATION_PROMPT = `You are the Quest Chronicler AI. Narrate a supporter's action. // AI Narration const openai = new OpenAI(); let narrative = `${donor_name} hit for ${base_damage}!`; try { const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: NARRATE_DONATION_PROMPT }, {import { Hono } from "npm:hono";import { cors } from "npm:hono/cors";import { OpenAI } from "https://esm.town/v/std/openai?v=4";import { blob } from "https://esm.town/v/std/blob?v=11";import { nanoid } from "npm:nanoid";class AIService { private openai = new OpenAI(); // 1. Generate Dynamic Frameworks try { const completion = await this.openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "user", content: prompt }], try { const completion = await this.openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "user", content: prompt }], async selectTeam(textSample: string, agentPersonas: any) { try { const completion = await this.openai.chat.completions.create({ model: "gpt-4o-mini", messages: [ try { const completion = await this.openai.chat.completions.create({ model: "gpt-4o-mini", messages: [ async synthesizeReport(results: any[]) { try { const completion = await this.openai.chat.completions.create({ model: "gpt-4o", messages: [ ]; const completion = await this.openai.chat.completions.create({ model: "gpt-4o", messages: messages as any,import { sqlite } from "https://esm.town/v/std/sqlite?v=6";import { blob } from "https://esm.town/v/std/blob?v=12";import { OpenAI } from "https://esm.town/v/std/openai?v=5";// --- PERSISTENCE LAYER ---async function consultTheOracle(base64Image: string): Promise<string> { const openai = new OpenAI(); try { const completion = await openai.chat.completions.create({ model: "gpt-4o", 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