234
235 try {
236 const response = await fetch("/", {
237 method: "POST",
238 body: JSON.stringify({
187
188 try {
189 const response = await fetch("/", {
190 method: "POST",
191 body: JSON.stringify({
17 setIsLoading(true);
18 try {
19 const response = await fetch('/extract', {
20 method: 'POST',
21 body: JSON.stringify({ text })
133})
134
135export default app.fetch;
48async function uploadImage(agent: AtpAgent, imageUrl: string) {
49 try {
50 // Fetch the image
51 const response = await fetch(imageUrl);
52 if (!response.ok) {
53 console.error(`Failed to fetch image: ${imageUrl}`);
54 return null;
55 }
187
188 try {
189 const response = await fetch("/", {
190 method: "POST",
191 body: JSON.stringify({
218 });
219 } catch (error) {
220 console.error("Error fetching messages:", error);
221 return new Response(
222 JSON.stringify({ error: "Failed to fetch messages" }),
223 { status: 500 },
224 );
379 const loadMessages = async () => {
380 try {
381 const response = await fetch("/messages");
382 if (!response.ok) {
383 throw new Error("Failed to fetch messages");
384 }
385 const data = await response.json();
386 setMessages(data);
387 } catch (error) {
388 console.error("Error fetching messages:", error);
389 setMessages([
390 {
406
407 try {
408 const response = await fetch("/chat", {
409 method: "POST",
410 headers: { "Content-Type": "application/json" },
14 // const imageUrl = "https://charlypoly-httpapiscreenshotpageexample.web.val.run/?url=" + url.origin;
15 // return Response.redirect(imageUrl, 302)
16 const res = await fetch(imageUrl);
17 const blob = await res.blob();
18 return new Response(blob, { headers: { "Content-Type": "image/png" } });
20 try {
21 // Use a more reliable GeoJSON source
22 const response = await fetch(
23 `https://raw.githubusercontent.com/datasets/geo-countries/master/data/countries.geojson`,
24 );
24 const fontUrl = "https://github.com/googlefonts/roboto/raw/main/src/hinted/Roboto-Regular.ttf";
25
26 // Fetch and parse the font
27 const fontResponse = await fetch(fontUrl);
28 const fontArrayBuffer = await fontResponse.arrayBuffer();
29