2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(
9 "latLngOfCity": {
10 openAiTool: {
11 type: "function",
12 function: {
13 name: "latLngOfCity",
14 description: "Get the latitude and longitude of a city",
34 "weatherOfLatLon": {
35 openAiTool: {
36 type: "function",
37 function: {
38 name: "weatherOfLatLon",
39 description: "Get the latitude and longitude of a city",
61 "fetchWebpage": {
62 openAiTool: {
63 type: "function",
64 function: {
65 name: "fetchWebpage",
66 description: "Fetch the weather forecast from the contents of a forecast URL",
91];
92
93function truncate(response: string | object) {
94 const TRUNCATE_LEN = 60;
95 const responseStr = typeof response === "string" ? response : JSON.stringify(response);
99}
100
101async function runConversation() {
102 const response = await openai.chat.completions.create({
103 messages: transcript,
111 if (message.tool_calls) {
112 for (let i = 0; i < message.tool_calls.length; i++) {
113 console.log("[CALLING]", message.tool_calls[i].function);
114 const tool = toolbox[message.tool_calls[i].function.name];
115 if (tool) {
116 const result = await tool.call(JSON.parse(message.tool_calls[i].function.arguments));
117 console.log("[RESULT]", truncate(result));
118 transcript.push({
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=5";
3
4export async function aqi(interval: Interval) {
5 const location = "downtown brooklyn"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });
3import process from "node:process";
4
5export async function sailingNotifyCron({ lastRunAt }) {
6 const result = await sailingNotify("Fair Oaks, CA", 10);
7}
1import { powderNotify } from "https://esm.town/v/chet/powderNotify";
2
3export default async function(interval: Interval) {
4 await Promise.all([
5 powderNotify("Truckee, CA"),
31console.log(text);
32
33export async function weatherGPT() {
34 await email({ subject: "Weather Today", text });
35}
2import { getWeather } from "https://esm.town/v/stevekrouse/getWeather?v=2";
3
4export default async function(interval: Interval) {
5 let weather = await getWeather("Brooklyn, NY");
6 let temperature = weather.current_condition[0].FeelsLikeF;
2import { getWeather } from "https://esm.town/v/stevekrouse/getWeather";
3
4export default async function(interval: Interval) {
5 let weather = await getWeather("Brooklyn, NY");
6 let feelsLike = weather.current_condition[0].FeelsLikeF;