5const URL = "https://thatskyshop.com/products/manatee-plush";
6
7export default async function () {
8 const html = await fetchText(URL);
9 const $ = cheerio.load(html);
21}
22
23async function fetchText(url: string, options?: any) {
24 const response = await fetch(url, {
25 redirect: "follow",
4const openai = new OpenAI();
5
6export default async function (req: Request): Promise<Response> {
7 const { question } = await req.json();
8
683};
684
685function App() {
686 return (
687 <>
691}
692
693function client() {
694 createRoot(document.getElementById("root")).render(<App />);
695}
699}
700
701export default async function server(request: Request): Promise<Response> {
702 return new Response(
703 `
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function App() {
6 const [url, setUrl] = useState("");
7 const [result, setResult] = useState<any>(null);
15 }, []);
16
17 function saveKey() {
18 localStorage.setItem("manifoldApiKey", apiKey);
19 alert("API key saved locally");
20 }
21
22 async function handleSubmit(e: React.FormEvent) {
23 e.preventDefault();
24 setResult(null);
33 }
34
35 async function handleBetTest() {
36 if (!result || !apiKey || betAmount <= 0) return;
37 setStatus("Placing test bet on first option...");
117}
118
119function client() {
120 createRoot(document.getElementById("root")!).render(<App />);
121}
123export { client };
124
125export default async function server(req: Request): Promise<Response> {
126 const { pathname } = new URL(req.url);
127
1export default async function manifoldSum(url: string) {
2 // Extract slug from manifold URL
3 const parts = url.split("/");
42const openai = new OpenAI();
43
44async function callAI(
45 fact: string,
46 prompt: string,
104}
105
106async function buildTreeInBackground(jobId: string, rootNode: FactNode) {
107 const normalize = (p: Prerequisite) => ({
108 fact: String(p.fact || "").trim(),
178
179// --- HTML & FRONTEND ---
180function generateHtml(sourceUrl: string) {
181 return `<!DOCTYPE html>
182<html lang="en">
398 const MAX_DEPTH = 5;
399
400 function TreeNode({ node, isLive }) {
401 const [isCollapsed, setIsCollapsed] = useState(false);
402
427 }
428
429 function App() {
430 const [view, setView] = useState("input");
431 const [jobId, setJobId] = useState(null);
547
548// --- MAIN VAL HANDLER ---
549export default async function (req: Request) {
550 const url = new URL(req.url);
551 const action = url.searchParams.get("action");
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2
3export function ValTownLogo () {
4 return (
5 <svg
5 * Get usage data for a specific val
6 */
7export async function getValSummary(valId: string) {
8 // Get summary data for the val from the usage table
9 const usageSummaryResult = await sqlite.execute(`
36}
37
38export function renderValDetail(valId: string, summary: ValSummary, requests: UsageRequest[] = []): string {
39 // Generate the content
40 const content = `
3const USER_ENDPOINT = "/api/user";
4
5export function useUser() {
6 const [data, setData] = useState<any>(null);
7 const [loading, setLoading] = useState(true);
Rate limit your serverless functions
Helper function to send Discord messages
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.