5import Wiki from "npm:wikijs";
6
7function parseNightbotHeader(headerValue: string): Record<string, string> | null {
8 if (!headerValue) return null;
9 return headerValue.split("&").reduce((acc, param) => {
14}
15
16// map of built-in handler functions (e.g. weather)
17const commands: Record<
18 string,
201};
202
203export default async function server(request: Request): Promise<Response> {
204 console.log("incoming request:", request.url);
205 if (request.method !== "GET") {
46 * @returns Response with feedback
47 */
48async function handleDailyLog(content) {
49 try {
50 // Prepare log data
103 * @returns Response with status
104 */
105async function handleProgressMetrics(content) {
106 try {
107 // Prepare metrics data
142 * @returns Response with status
143 */
144async function handleTodoUpdate(content) {
145 try {
146 // Validate required fields
48const cacheKey = (location: string) => "easyAQI_v3_" + encodeURIComponent(location);
49
50export async function openAqNowcastAQI(location) {
51 const sensorID = location.sensors.find(s => s.parameter.name === "pm25").id;
52 const data = await fetchJSON(
64}
65
66export async function easyAQI({ location }: {
67 location: string;
68}) {
1const TARGET_URL = "https://api.openaq.org";
2
3export default async function(req: Request): Promise<Response> {
4 const url = new URL(req.url);
5 return fetch(TARGET_URL + url.pathname + url.search, {
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function nominatimSearch(params: Search): Promise<Place[]> {
4 return fetchJSON(
5 "https://nominatim.openstreetmap.org/search?"
4const location = "prospect heights, brooklyn"; // <-- change to place, city, or zip code
5
6export async function aqi(interval: Interval) {
7 const data = await easyAQI({ location });
8 if (!interval.lastRunAt) {
68});
69
70/** Sample Function Listener */
71app.function("sample_step", async ({ client, inputs, fail, logger }) => {
72 try {
73 const { user_id } = inputs;
135})();
136
137export default async function handleGetRequest(): Promise<Response> {
138 const html = `
139 <html>
7}
8
9export function CommitList({ commits }: CommitListProps) {
10 const [expandedCommit, setExpandedCommit] = useState<string | null>(null);
11
13}
14
15export function RepoSelector({
16 owner,
17 repo,
13}
14
15export function UserProfile({ user, onUpdate }: UserProfileProps) {
16 const [username, setUsername] = useState(user.username || "");
17 const [isEditing, setIsEditing] = useState(false);
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.