1import { fetch } from "https://esm.town/v/std/fetch";
2import { waterCSS } from "https://esm.town/v/stevekrouse/waterCSS?v=1";
3import { html as html2 } from "https://esm.town/v/stevekrouse/html?v=5";
6export let createAllHighLlightJsLanguages = async (req: Request) => {
7 if (req.method === "POST") {
8 const response = await fetch("https://highlightjs.org/demo");
9 const html = await response.text();
10 const { DOMParser } = await import(
8
9 useEffect(() => {
10 fetchItems();
11 }, []);
12
13 const fetchItems = async () => {
14 const response = await fetch("/items");
15 const data = await response.json();
16 setItems(data);
19 const handleAddItem = async () => {
20 if (newItem.trim() === "") return;
21 await fetch("/items", {
22 method: "POST",
23 headers: { "Content-Type": "application/json" },
25 });
26 setNewItem("");
27 fetchItems();
28 };
29
35
36 const removeItem = async (id) => {
37 await fetch(`/items/${id}`, { method: "DELETE" });
38 fetchItems();
39 };
40
41 const clearList = async () => {
42 await fetch("/items", { method: "DELETE" });
43 fetchItems();
44 };
45
16
17 useEffect(() => {
18 fetchCSV();
19 }, []);
20
25 }, [flashcards]);
26
27 const fetchCSV = async () => {
28 const response = await fetch("/csv");
29 const csvText = await response.text();
30 const result = Papa.parse(csvText, { header: false });
57 const formData = new FormData();
58 formData.append("csv", file);
59 const response = await fetch("/upload", {
60 method: "POST",
61 body: formData,
63 if (response.ok) {
64 alert("File uploaded successfully!");
65 fetchCSV();
66 } else {
67 alert("Error uploading file.");
1import { email } from "https://esm.town/v/std/email";
2
3async function fetchTweets(listId: string): Promise<any[]> {
4 const url = `https://news.ycombinator.com/`;
5 const response = await fetch(url);
6 const html = await response.text();
7 console.log(html);
27export default async function(interval: Interval) {
28 const listId = "1359390628841480192";
29 const tweets = await fetchTweets(listId);
30
31 // Sort tweets by likes and get top 10
11 const generateText = async () => {
12 setLoading(true);
13 const response = await fetch(`?paragraphs=${paragraphs}`);
14 const result = await response.text();
15 setText(result);
30 setLoading(prev => ({ ...prev, [operation]: true }));
31 try {
32 const response = await fetch(`/run?operation=${operation}`, {
33 method: "POST",
34 headers: {
138}
139
140async function fetchContent(): Promise<string> {
141 const response = await fetch("https://www.gutenberg.org/cache/epub/1342/pg1342.txt");
142 const text = await response.text();
143
151 const MODEL_NAME = "claude-3-5-sonnet-20240620";
152
153 const bookContent = await fetchContent();
154 const startTime = Date.now();
155
187 const MODEL_NAME = "claude-3-5-sonnet-20240620";
188
189 const bookContent = await fetchContent();
190 const startTime = Date.now();
191
226 const MODEL_NAME = "claude-3-5-sonnet-20240620";
227
228 const bookContent = await fetchContent();
229 const questions = [
230 "What is the title of this novel?",
30 setLoading(prev => ({ ...prev, [operation]: true }));
31 try {
32 const response = await fetch(`/run?operation=${operation}`, {
33 method: "POST",
34 headers: {
138}
139
140async function fetchContent(): Promise<string> {
141 const response = await fetch("https://www.gutenberg.org/cache/epub/1342/pg1342.txt");
142 const text = await response.text();
143
151 const MODEL_NAME = "claude-3-5-sonnet-20240620";
152
153 const bookContent = await fetchContent();
154 const startTime = Date.now();
155
187 const MODEL_NAME = "claude-3-5-sonnet-20240620";
188
189 const bookContent = await fetchContent();
190 const startTime = Date.now();
191
226 const MODEL_NAME = "claude-3-5-sonnet-20240620";
227
228 const bookContent = await fetchContent();
229 const questions = [
230 "What is the title of this novel?",
4
5 try {
6 const response = await fetch(url);
7
8 if (!response.ok) {
13 const firstImageUrl = "https://cn.bing.com" + data.images[0].url;
14 // 第三æ¥ï¼šè¯·æ±‚该图片的实际内容
15 const imageResponse = await fetch(firstImageUrl);
16
17 if (!imageResponse.ok) {
18 throw new Error(`Failed to fetch image! status: ${imageResponse.status}`);
19 }
20
26 });
27 } catch (error) {
28 console.error("Error fetching data:", error);
29 return new Response(JSON.stringify({ error: "Failed to fetch data" }), {
30 status: 500,
31 headers: {
94 tokenUrl.searchParams.set("state", store.state);
95
96 const tokenResp = await fetch(tokenUrl.toString());
97 if (!tokenResp.ok) {
98 throw new Error(await tokenResp.text());
103 };
104
105 const resp = await fetch("https://lastlogin.io/userinfo", {
106 headers: {
107 Authorization: `Bearer ${access_token}`,
314 if (iconChoice === 'default') {
315 const domain = new URL(url).hostname;
316 const response = await fetch(`/favicon?domain=${encodeURIComponent(domain)}`);
317 const blob = await response.blob();
318 iconBase64 = await convertToBase64(blob);
426 }
427
428 const response = await fetch(`https://www.google.com/s2/favicons?domain=${domain}&sz=256`);
429 const favicon = await response.arrayBuffer();
430
434});
435
436export default app.fetch;