13
14const clientCode = () => {
15 document.getElementById("input").addEventListener("submit", async function(event) {
16 event.preventDefault();
17
45 + `&assistantId=${input.getAttribute("data-assistant-id")}`,
46 );
47 eventSource.onmessage = function(event) {
48 console.log(event);
49 responseDiv.innerText += JSON.parse(event.data);
50 };
51
52 eventSource.onerror = function() {
53 eventSource.close();
54 };
121. **Random Joke Generator:** Fetch a random joke from an API and display it.
132. **Daily Weather Update:** Pull weather data for your location using an API and create a daily summary.
143. **Mini Todo List:** Create a simple to-do list app with add, edit, and delete functionalities.
154. **Chuck Norris Facts:** Display a random Chuck Norris fact sourced from an API.
165. **Motivational Quote of the Day:** Fetch and display a random motivational quote each day.
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") {
3import { Hono } from "npm:hono@3.11.8";
4
5const script = `Object.keys(self.webPackagePaths).map(function (key, index) {
6 self.webPackagePaths[
7 key
1import { states } from "https://esm.town/v/jordan/states";
2
3export default async function(req: Request): Promise<Response> {
4 const url = new URL(req.url);
5
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(
4const query = "\"val.town\" OR \"val town\" -_ValTown_ -is:retweet";
5
6export async function twitterAlert({ lastRunAt }: Interval) {
7 const results = await twitterSearch({
8 query,
27const openai = new OpenAI();
28
29export async function twitterAlert({ lastRunAt }: Interval) {
30 let results = [];
31 for (const username of usernames) {
36 }
37
38 async function filterTweets(tweets) {
39 const completion = await openai.chat.completions.create({
40 messages: [
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=5";
3
4export async function aqi(interval: Interval) {
5 const location = "narberth, pa"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });
1const JWT = Deno.env.get("PINATA_JWT");
2async function pinJSONToIPFS() {
3 try {
4 const data = JSON.stringify({
A helper function to build a file's email
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.