Search
Code3,247
import { sqlite } from "https://esm.town/v/std/sqlite?v=4";// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// --- TYPE DEFINITIONS ---app.post("/submit", async (c) => { const openai = new OpenAI(); const body = await c.req.json(); const { text, style } = body; try { const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// --- AI BEHAVIORAL GUIDELINES --- if (req.method === "POST" && action === "getPhrase") { try { const openai = new OpenAI(); const body = await req.json(); const theme = body.theme; } const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [
import { Hono } from "npm:hono@4.4.12";import type { Context } from "npm:hono@4.4.12";import { OpenAI } from "npm:openai@4.52.7";// --- TYPE DEFINITIONS --- if (!industry) return c.json({ error: "Industry is a required field." }, 400); try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: DYNAMIC_LIST_GENERATOR_PROMPT }, { if (!occupation) return c.json({ error: "Occupation is a required field." }, 400); try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: DYNAMIC_LIST_GENERATOR_PROMPT }, { const userInput = `Occupation: ${occupation_title}, Task: ${task}`; try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: PROMPT_REFINER_SYSTEM_PROMPT }, { role: "user", content: userInput }], if (!refined_prompt) return c.json({ error: "refined_prompt is required" }, 400); try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: INPUT_EXTRACTOR_SYSTEM_PROMPT }, { try { const openai = new OpenAI(); const agentCompletion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: finalUserPrompt }, { if (!agentOutput) throw new Error("The agent returned no content."); const htmlCompletion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: HTML_FORMATTER_SYSTEM_PROMPT }, { role: "user", content: agentOutput }],
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// --- AI BEHAVIORAL GUIDELINES --- if (req.method === "POST") { try { const openai = new OpenAI(); const { message, history, persona } = await req.json(); ]; const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: messages,
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// --- TYPE DEFINITIONS ---}export default async function(req: Request): Promise<Response> { const openai = new OpenAI(); const url = new URL(req.url); const CORS_HEADERS = { conversation.splice(conversation.length - 1, 0, contextMessage); } const completion = await openai.chat.completions.create({ model, messages: [{ role: "system", content: CHAT_PROMPT }, ...conversation],
}, ], provider: "openai", maxTokens: 250, temperature: 0.3,
// It uses the Hono web framework to serve a Single-Page Application (SPA).import { OpenAI } from "https://esm.town/v/std/openai";import { Hono } from "npm:hono@4.4.12";import type { Context } from "npm:hono@4.4.12"; if (!industry) return c.json({ error: "Industry is a required field." }, 400); try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: DYNAMIC_LIST_GENERATOR_PROMPT }, { if (!occupation) return c.json({ error: "Occupation is a required field." }, 400); try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: DYNAMIC_LIST_GENERATOR_PROMPT }, { try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: PROMPT_REFINER_SYSTEM_PROMPT }, { role: "user", content: userInput }], if (!refined_prompt) return c.json({ error: "refined_prompt is required" }, 400); try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: INPUT_EXTRACTOR_SYSTEM_PROMPT }, { try { const openai = new OpenAI(); const agentCompletion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: systemPromptWithContext }, { if (!agentOutput) throw new Error("The agent returned no content."); const htmlCompletion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: HTML_FORMATTER_SYSTEM_PROMPT }, { role: "user", content: agentOutput }],
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";import { Hono } from "npm:hono@4.4.12";// --- BACKEND LOGIC (ADAPTED FOR NEW DOMAIN) ---const app = new Hono();const openai = new OpenAI();// This function is domain-agnostic and reusable.async function generatePersonaPrompt(occupation: string, task: string) { const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [ error: "Quota Exceeded", message: "The application's OpenAI quota has been exceeded. Please check the account dashboard on the OpenAI platform.", }, 429); } const { image } = await c.req.json(); if (!image) return c.json({ error: "Image is required." }, 400); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [ } const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: history,
import { Hono } from "npm:hono@4.4.12";import type { Context } from "npm:hono@4.4.12";import { OpenAI } from "npm:openai@4.52.7";// --- TYPE DEFINITIONS --- try { const openai = new OpenAI(); 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