searchTweetsmain.tsx1 match
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
23export async function searchTweets({ accessToken, query, params }: {
4accessToken: string;
5query: string;
analysisTransactionmain.tsx1 match
1export function analysisTransaction(req: express.Request, res: express.Response) {
2console.log(req.body);
3res.end("Handle Webhook Success");
postToMastodonmain.tsx1 match
1import { fetch } from "https://esm.town/v/std/fetch";
23export function postToMastodon(mastodonApiUrl, mastodonAccessToken, status) {
4return fetch(
5`${mastodonApiUrl}/statuses?access_token=${mastodonAccessToken}`,
kaiterra_prometheusmain.tsx2 matches
23// Fetches air quality sensor data from Kaiterra in prometheus line format
4export async function kaiterra_prometheus(
5req: express.Request,
6res: express.Response,
13let prometheus_data = kiosk_data.indoor.flatMap((indoor_data) =>
14indoor_data.data.flatMap((data) =>
15data.points.flatMap(function (point) {
16let timestamp = new Date(point.ts).getTime();
17let param_name = data.param.replace("-", "_");
chatSampleFunctionSinglemain.tsx14 matches
2import { schemasWeather } from "https://esm.town/v/webup/schemasWeather";
34export const chatSampleFunctionSingle = (async () => {
5// Example dummy function hard coded to return the same weather
6// In production, this could be your backend API or an external API
7const getCurrentWeather = (location, unit = "fahrenheit") => ({
11forecast: ["sunny", "windy"],
12});
13// Step 1: send the conversation and available functions to GPT
14const messages = [{
15"role": "user",
17"What's the weather like in Boston, and what's the weather in Huston?",
18}];
19const functions = [schemasWeather[0]];
20const response = await chat(messages, {
21functions,
22function_call: "auto", // auto is default, but we'll be explicit
23});
24console.log(response);
25// Step 2: Check if GPT wanted to call a function
26if (typeof response !== "object")
27return;
28// Step 3: Call the function
29// Note: The JSON response may not always be valid; be sure to handle errors
30const { name } = response;
34args?.unit,
35);
36if (!functions)
37return;
38// Step 4: Send the info on the function call and function response to GPT
39// Extend conversation with assistant's reply
40messages.push({
41role: "assistant",
42function_call: response,
43content: "",
44});
45// Extend conversation with function response
46messages.push({
47role: "function",
48name,
49content: JSON.stringify(funcResponse),
50});
51// Get a new response from GPT where it can see the function response
52return await chat(messages);
53})();
22});
23const message = data.choices[0].message;
24return message.function_call ? message.function_call : message.content;
25};
5import { getHome } from "https://esm.town/v/dedes/getHome";
67export async function home(req: express.Request, res: express.Response) {
8try {
9const currentPage = req.query.page || "home";
1import { fetchXML } from "https://esm.town/v/stevekrouse/fetchXML?v=3";
23export async function usgsSite(site) {
4const result = await fetchXML(
5`http://waterservices.usgs.gov/nwis/iv/?site=${site}`