Search

Results include substring matches and semantically similar vals. Learn more
cyx avatar
get
@cyx
An interactive, runnable TypeScript val by cyx
Script
import { fetch } from "https://esm.town/v/std/fetch";
export async function get() {
let places = [
name: "MongoDB",
jeffreyyoung avatar
poeechobot
@jeffreyyoung
a simple poe bot
HTTP
async function getResponse(req: Query, send: Sender) {
send("meta", { content_type: "text/markdown" });
type Sender<EventName extends keyof Events = keyof Events> = (eventName: EventName, data: Events[EventName]) => void;
function encodeEvent(event: string, data: any = {}) {
return new TextEncoder().encode(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
export default async function(req: Request): Promise<Response> {
const body = new ReadableStream({
gigmx avatar
skilledCoffeePanther
@gigmx
An interactive, runnable TypeScript val by gigmx
HTTP
export default async function(req: Request): Promise<Response> {
return new Response(
const connectionStatus = document.querySelector("#connection-status");
function parseResponse(text) {
const parts = [];
connectionStatus.style.display = "block";
document.getElementById("input").addEventListener("submit", async function(event) {
event.preventDefault();
document.querySelectorAll(".suggestion-button").forEach((button)=>{
button.addEventListener("click", function() {
const input = document.querySelector("input[name=\\"message\\"]");
pps avatar
sqlitePublic
@pps
An interactive, runnable TypeScript val by pps
HTTP
const dumped = {};
async function database() {
const dump = await sqliteDump(dumped);
batch,
async function execute(statement: InStatement): Promise<ResultSet> {
const res = await fetch(`${ENDPOINT}/execute`, {
return res.json();
async function batch(statements: InStatement[]): Promise<ResultSet[]> {
const res = await fetch(`${ENDPOINT}/batch`, {
jeffreyyoung avatar
misleadingScarletMongoose
@jeffreyyoung
Shows a inline html and then says meow a few times https://poe.com/inline_html_test_bot
HTTP
* Returns a response to the user's query
async function getResponse(req: Query, send: SendEventFn) {
send("meta", { content_type: "text/markdown" });
* Returns your bot's settings
async function getBotSettings(): Promise<BotSettings> {
return {
) => void;
function encodeEvent(event: string, data: any = {}) {
return new TextEncoder().encode(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
export default async function(req: Request): Promise<Response> {
const reqBody = await req.json()
aquapi avatar
MaplBuild
@aquapi
An interactive, runnable TypeScript val by aquapi
HTTP
const fetch = jitc(app);
console.timeEnd("Startup 500 routes");
console.log("Fetch function", fetch.toString().length);
export default fetch;
rawwerks avatar
pythonHTTPVal
@rawwerks
pyodide 🤝 deno trick pyodide to execute python code in the deno runtime deno module source: py-town not all python packages are supported by pyodide
HTTP
let pyodide;
async function initializePyodide() {
if (!pyodide) {
await pyodide.loadPackage("numpy");
async function runPythonCode(code) {
await initializePyodide();
return await pyodide.runPythonAsync(code);
export default async function handler(req: Request): Promise<Response> {
const pythonCode = `
piyushbeli avatar
summariseNews
@piyushbeli
An interactive, runnable TypeScript val by piyushbeli
HTTP
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(request: Request) {
// Extract URL and languages from request
"Access-Control-Allow-Origin": "*",
const openai = new OpenAI();
const summaryPrompt = "This is a news link: " + inputUrl
try {
// Get the article summary from OpenAI
const summaryResponse = await openai.chat.completions.create({
model: "gpt-4o-mini",
JSON.stringify({
error: `OpenAI processing failed: ${error.message}`,
errorStack: error.stack,
"Access-Control-Allow-Origin": "*",
function arrayToString(arr: any[]) {
if (arr.length === 1) {
treb0r avatar
weatherGPT
@treb0r
If you fork this, you'll need to set OPENAI_API_KEY in your Val Town Secrets .
Cron
If you fork this, you'll need to set `OPENAI_API_KEY` in your [Val Town Secrets](https://www.val.town/settings/secrets).
import { fetch } from "https://esm.town/v/std/fetch";
import { OpenAI } from "npm:openai";
let location = "Halifax UK";
).then(r => r.json());
const openai = new OpenAI();
let chatCompletion = await openai.chat.completions.create({
messages: [{
console.log(text);
export async function weatherGPT() {
await email({ subject: "Weather Today", text });
codinginpublic avatar
myApi
@codinginpublic
An interactive, runnable TypeScript val by codinginpublic
Script
export function myApi(name) {
return "hi " + name;
dhvanil avatar
val_y3qNL6xyYE
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_y3qNL6xyYE(req) {
try {
// Execute the code directly and capture its result
R3D01NG1T avatar
myApi
@R3D01NG1T
An interactive, runnable TypeScript val by R3D01NG1T
Script
export function myApi(name) {
return "hi " + name;
xiaogenban avatar
myApi
@xiaogenban
An interactive, runnable TypeScript val by xiaogenban
Script
import { imgMin } from "https://esm.town/v/xiaogenban/imgMin";
export async function myApi(name) {
return imgMin(name);
// return `hi ${name}`;
danny_engelman avatar
myApi
@danny_engelman
An interactive, runnable TypeScript val by danny_engelman
Script
export function myApi(name) {
return "hi " + name;
u avatar
fetcher
@u
An interactive, runnable TypeScript val by u
Script
export async function fetcher() {}