Public
Versions
- Open: VersionChanges from v0 to v1+81-2
export default async function (req: Request): Promise<Response> {return Response.json({ ok: true })}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": "*","Access-Control-Allow-Headers": "*",},status: 204,});}const openai = new OpenAI();try {var body = await req.json();} catch (e) {var search = (new URL(req.url)).searchParams;body = {"messages": [{ "role": "user", "content": search.get("q") || "hello" }],"temperature": 0.5,"presence_penalty": 0,"frequency_penalty": 0,"top_p": 1,stream: true,model: "gpt-4-turbo",};}const stream = await openai.chat.completions.create(body);if (!body.stream) {return new Response(JSON.stringify(body), {headers: {"Access-Control-Allow-Origin": "*","Access-Control-Allow-Headers": "*", - Open: Version+3-0export default async function (req: Request): Promise<Response> {return Response.json({ ok: true })}
l2046a-oddtanroundworm.web.val.run
Updated: September 11, 2024