34});
35
36export function App() {
37 const example = examples[Math.floor(Math.random() * examples.length)];
38 const description = /* c.req.query("description") || */ example.user;
92 user: "website that shows the current time",
93 content: `/** @jsxImportSource npm:react */
94export default function() {
95 return <h1>{new Date().toLocaleTimeString()}</h1>;
96}`,
108];
109
110export async function compile(description: string) {
111 const messages = [
112 {
1export default async function(req: Request) {
2 const body = (await fetch("https://live.staticflickr.com/65535/53782948438_9b85e57a6c_o_d.png")).body
3 return new Response(body, {headers: {"Content-Type": "image/png"}});
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(
6);
7
8export async function uptimeCheck(url: string) {
9 let ok = true;
10 let reason: string;
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 };
16const sema = new Sema(5); // Adjust the number based on your desired concurrency
17
18export async function addLinksToSheet(links) {
19 let counter = 0;
20 for (const link of links) {
43}
44
45export async function getSidebar(limit = 1, start = 0) {
46 const gql = {
47 "operationName": "posts",
112
113
114// Function to escape double quotes in a CSV field
115function escapeCSVField(field) {
116 if(!field) return '""';
117 return `"${field.replace(/"/g, '""')}"`;
118}
119
120// Function to convert links to CSV
121function convertToCSV(links) {
122 const header = ["Title", "Body", "URL", "PostedAt", "CreatedAt", "Data"];
123 const rows = links.map(link => [
132}
133
134async function getAllLinks(totalLimit, offset=0) {
135 let allLinks = [];
136 const limit = 1000; // Adjust this according to the server's limit
9
10const clientCode = () => {
11 document.getElementById("input").addEventListener("submit", function(event) {
12 event.preventDefault();
13
33 + `&assistantId=${input.getAttribute("data-assistant-id")}`,
34 );
35 eventSource.onmessage = function(event) {
36 console.log(event);
37 responseDiv.innerText += JSON.parse(event.data);
38 };
39
40 eventSource.onerror = function() {
41 eventSource.close();
42 };
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: [
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: [
1import lunr from 'https://cdn.skypack.dev/lunr';
2
3const idx = lunr(function () {
4 this.field('content');
5 this.add({ id: 1, content: 'Banana Apples and Oranges' });
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",