2import { generateText } from "npm:ai";
3
4export default async function generateTurtleName(req: Request): Promise<Response> {
5 if (req.method !== "POST") {
6 return Response.json({ message: "This function responds to POST requests." }, {
7 status: 400,
8 });
15];
16
17function generateTurtleName(baseIdea?: string): { name: string; explanation: string } {
18 const randomElement = (arr: string[]) => arr[Math.floor(Math.random() * arr.length)];
19
50}
51
52export default async function(req: Request): Promise<Response> {
53 if (req.method !== "POST") {
54 return new Response(JSON.stringify({ message: "This function responds to POST requests." }), {
55 status: 400,
56 headers: { "Content-Type": "application/json" }
2import { generateText } from "npm:ai";
3
4export default async function(req: Request): Promise<Response> {
5 if (req.method !== "POST") {
6 return Response.json({ message: "This function responds to POST requests." }, {
7 status: 400,
8 });
2import { generateText } from "npm:ai";
3
4export default async function(req: Request): Promise<Response> {
5 if (req.method !== "POST") {
6 return Response.json({ message: "This function responds to POST requests only." }, {
7 status: 400,
8 });
2import { generateText } from "npm:ai";
3
4export default async function(req: Request): Promise<Response> {
5 if (req.method !== "POST") {
6 return Response.json({ message: "This function responds to POST requests only." }, {
7 status: 400,
8 });
1import { openai } from "npm:@ai-sdk/openai"; // Ensure OPENAI_API_KEY environment variable is set
2
3export default async function(req: Request): Promise<Response> {
4 if (req.method !== "POST") {
5 return Response.json({ message: "This function responds to POST requests." }, {
6 status: 400,
7 });
4const thisURL = parseProject(import.meta.url).links.self.latest;
5
6export async function notify(message: string) {
7 await email({ subject: message, text: `Email sent from ${thisURL}` });
8}
5// Rest of the existing game code remains the same...
6
7function App() {
8 const [isInstallable, setIsInstallable] = useState(false);
9 const [deferredPrompt, setDeferredPrompt] = useState(null);
88}
89
90function client() {
91 createRoot(document.getElementById("root")).render(<App />);
92
107if (typeof document !== "undefined") { client(); }
108
109export default async function server(request: Request): Promise<Response> {
110 return new Response(`
111 <html>
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function App() {
5 const [clicked, setClicked] = useState(0);
6 return (
37 }
38
39 // Import the converter function dynamically
40 const { convertValToProject } = await import("./converter.ts");
41
Helper function to send Discord messages
Simple functional CSS library for Val Town
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": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.