57 const outputDiv = document.getElementById('output');
58
59 function getResponse() {
60 const prompt = document.getElementById('prompt').value;
61 const url = "${SOURCE_URL}/chat?p=" + encodeURIComponent(prompt);
125 const outputDiv = document.getElementById('output');
126
127 function testStream() {
128 const url = "${SOURCE_URL}/chat/test";
129 outputDiv.textContent = 'Loading...';
3import { json2csv } from "npm:json-2-csv";
4
5export default async function(interval: Interval) {
6 const complete_play_history = await db.select().from(play_history).all();
7
4
5const scale = 0.15;
6export default async function(req: Request) {
7 let timerId: number | undefined;
8 const body = new ReadableStream({
10
11const clientCode = () => {
12 document.getElementById("input").addEventListener("submit", function(event) {
13 event.preventDefault();
14
34 + `&assistantId=${input.getAttribute("data-assistant-id")}`,
35 );
36 eventSource.onmessage = function(event) {
37 console.log(event);
38 responseDiv.innerText += JSON.parse(event.data);
39 };
40
41 eventSource.onerror = function() {
42 eventSource.close();
43 };
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=5";
3
4export async function aqi(interval: Interval) {
5 const location = "japanese prespretarian church, seattle, wa, 98144"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });
4const query = "\"val.town\" OR \"val town\" -_ValTown_";
5
6export async function twitterAlert({ lastRunAt }: Interval) {
7 const results = await twitterSearch({
8 query,
19const messages = ["What should I build today?", "Very cool. Can you make it even cooler?"];
20
21export default async function(req: Request): Promise<Response> {
22 const url = new URL(req.url);
23 if (url.pathname === "/favicon.ico") {
29const asyncProgram = Effect.promise(() => Promise.resolve(42));
30
31// just like functions, effects themselves are just values
32// they don't do anything until you 'run' them
33
65// });
66
67// as an alternative to simply throwing the error, the run*Exit functions
68// provide a `Exit` type that represents either a success or a number of possible failure types
69
1import { getRandomEmoji } from "https://esm.town/v/maxm/getRandomEmoji";
2
3export default async function(req: Request): Promise<Response> {
4 let timer: number | undefined = undefined;
5 const body = new ReadableStream({
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",