38 model: openai("gpt-4o", {
39 baseURL: "https://std-openaiproxy.web.val.run/v1",
40 apiKey: Deno.env.get("valtown"),
41 } as any),
42 messages: [
1/**
2 * This val creates a Postman-like interface for testing HTTP requests directly in the browser.
3 * It uses React for the UI and the Fetch API to make requests.
4 * The server function serves the HTML and handles the API requests.
5 */
6
1/**
2 * This is a minimalist to-do list app using server-side rendering without any client-side JavaScript.
3 * It uses Val Town's SQLite for data persistence, Deno's standard library for HTML escaping,
4 * and custom SVG icons for a cohesive design.
5 */
84 <meta name="viewport" content="width=device-width, initial-scale=1.0">
85 <title>To Do List</title>
86 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
87 <style>
88 body {
9[](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
10
11It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
12
13# TODO
67
68export const getFirecrawlContent = async (url, opts = {}) => {
69 const apiKey = Deno.env.get("FIRECRAWL_API_KEY");
70 if (!apiKey) {
71 throw new Error("API key not found. Please set FIRECRAWL_API_KEY in your environment.");
72 }
73
97
98 try {
99 const response = await fetch("https://api.firecrawl.dev/v0/scrape", {
100 method: 'POST',
101 headers: {
102 "Authorization": `Bearer ${apiKey}`,
103 "Content-Type": "application/json"
104 },
2 * This app allows users to drop an image onto the canvas, add text to it, move the text around,
3 * edit the text directly on the canvas, and save the result to their local disk.
4 * We'll use the HTML5 Canvas API for image manipulation and the File System Access API for saving files.
5 * The app is styled with a playful and colorful design, using the Caveat font for a handwritten feel.
6 */
191 <head>
192 <title>CZARKOWY EDYTOR DAT NA OBRAZKACH</title>
193 <link href="https://fonts.googleapis.com/css2?family=Caveat&display=swap" rel="stylesheet">
194 <style>${css}</style>
195 </head>
1This Val will proxy anthropic HTTP requests from some frontend client, like langchain, so that you can utilize anthropic apis from the browser.
2
3Convert it to an HTTP val in order to use it (you may want to setup an ENV var / header to protect the endpoint with a secret key)
13 }
14
15 // Check that your valtown API key is sent in the 'x-authorization' header
16 // Delete this line if you don't mind other parties hitting this endpoint
17 if (req.headers.get("x-authorization") !== Deno.env.get("valtown")) {
24 try {
25 const body = await req.json();
26 const apiKey = req.headers.get("x-api-key");
27
28 if (!body) {
30 }
31
32 if (!apiKey) {
33 throw new Error("No API key provided");
34 }
35
36 const anthropic = new Anthropic({ apiKey });
37
38 if (body?.stream) {
57 }
58 } catch (e) {
59 if (e instanceof Anthropic.APIError) {
60 return Response.json(e.error, { status: e.status });
61 }
1# gsheet_call
2Wrapper around Google Sheets API v4.
3
4## Parameters
6- sheet_id: Google Sheet ID
7- method: HTTP method to use
8- action: Full URL with `https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/` removed
9- data: HTTP request body
10
11## Requirements
12- a Google Cloud service account
13- the Google Sheets API v4 enabled in your Google Cloud project
14- the spreadsheet ID (provide it in the sheet_id parameter)
15
6 );
7 const googleAuthOptions = {
8 scope: ["https://www.googleapis.com/auth/spreadsheets"],
9 };
10 const token = await getToken(service_account, googleAuthOptions);
11 const result = fetchJSON(
12 `https://sheets.googleapis.com/v4/spreadsheets/${sheet_id}/${action}`,
13 {
14 method,