31console.log(text);
32
33export async function weatherGPT() {
34 await email({ subject: "Weather Today", text });
35}
1import Anthropic from "npm:@anthropic-ai/sdk";
2
3export default async function generatePoem() {
4 try {
5 // Retrieve the Anthropic API key from environment variables
74}
75
76// If this script is run directly, execute the function
77if (import.meta.main) {
78 console.log("🚀 Script Execution Started");
133. Adjust the if statement to detect changes and update your blob
14
154. Craft a message to be sent with `sendNotification()` function
7}
8
9export async function getGeminiModels(): Promise<GeminiModel[]> {
10 try {
11 const API_KEY = process.env.GEMINI_API_KEY;
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query
10import debounce from "https://esm.sh/lodash.debounce";
11
12function App() {
13 const [query, setQuery] = useState("");
14 const [suggestions, setSuggestions] = useState([]);
112}
113
114function client() {
115 createRoot(document.getElementById("root")).render(<App />);
116}
120}
121
122async function server(request: Request): Promise<Response> {
123 if (request.method === "POST" && new URL(request.url).pathname === "/geocode") {
124 const { query } = await request.json();
7import About from "https://esm.town/v/vawogbemi/whoIsHiringAbout";
8
9function App() {
10 const tabs = { "/": "Home", "/about": "About" };
11 const [activeTab, setActiveTab] = useState("/");
335}
336
337function ServerApp() {
338 return (
339 <html>
358}
359
360export default async function(req: Request): Promise<Response> {
361 const url = new URL(req.url);
362 if (url.pathname === "/api/stories") {
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function formatTime() {
7 const now = new Date();
8 const hours = now.getHours();
97];
98
99function getRandomPoem(time) {
100 const poem = POEMS[Math.floor(Math.random() * POEMS.length)];
101 return {
105}
106
107function SpanishTimePoemApp() {
108 const time = formatTime();
109 const { spanishPoem, englishPoem } = getRandomPoem(time);
139}
140
141function client() {
142 createRoot(document.getElementById("root")).render(<SpanishTimePoemApp />);
143}
144if (typeof document !== "undefined") { client(); }
145
146export default async function server(request: Request): Promise<Response> {
147 const { blob } = await import("https://esm.town/v/std/blob");
148 const time = formatTime();
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [query, setQuery] = useState("");
7 const [table, setTable] = useState("val_town_agent_specifications");
129}
130
131window.initClient = function() {
132 const rootElement = document.getElementById("root");
133 if (rootElement) {
141}
142
143export default async function server(request: Request): Promise<Response> {
144 // Handle GET requests by serving the HTML
145 if (request.method === 'GET') {
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query
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.