6 const encoded = encodeURIComponent(expr.toString());
7 try {
8 const res = await fetch(`https://api.val.town/eval/${encoded}`);
9 return (await res.json()).data;
10 } catch (e) {
1export let arbitraryFileRead = (req, res) => {
2 // A pretty simple arbitrary file read caused by the Express API
3 // discovered and patched on January 12th
4 res.sendFile("/etc/passwd");
1export let untitled_greenPlanarian = (() => {
2 throw new Error("API Error");
3});
2
3export let postWebhookTest5 = fetchJSON(
4 "https://api.val.town/express/@val.postWebhook4",
5 {
6 method: "POST",
5 options = {},
6) => {
7 // Initialize OpenAI API stub
8 const { Configuration, OpenAIApi } = await import("https://esm.sh/openai");
9 const configuration = new Configuration({
10 apiKey: process.env.OPENAI,
11 });
12 const openai = new OpenAIApi(configuration);
13 // Request chat completion
14 const messages = typeof prompt === "string"
19 a: a,
20 b: b,
21 ergebnis_link: `https://api.val.town/v1/eval/@valilo.eval_vec(${encodeURIComponent(
22 JSON.stringify(ret)
23 )})`,
1export function myApi(name) {
2 return "hi " + name;
3}
1export function myApi(name) {
2 return "hi " + name;
3}
2import { runVal } from "https://esm.town/v/std/runVal";
3
4// https://api.val.town/v1/express/zzz.ListenTo?val=stevekrouse.whatIsValTown
5export async function ListenTo(req, res) {
6 const { val = "zzz.demoOpenAIGPT4Summary" } = req.query;
7 const url = `https://api.val.town/v1/run/${val.replace("@", "")}`
8 const resp = await fetch(url);
9 const text = await resp.text();
7 const supportedLanguages = ["JavaScript", "TypeScript"];
8 let imported = [];
9 const headers = { "X-GitHub-Api-Version": "2022-11-28" };
10 const { Octokit } = await import("npm:@octokit/core");
11 const octokit = new Octokit({ auth: githubToken });