234
235 try {
236 const response = await fetch("/", {
237 method: "POST",
238 body: JSON.stringify({
234
235 try {
236 const response = await fetch("/", {
237 method: "POST",
238 body: JSON.stringify({
234
235 try {
236 const response = await fetch("/", {
237 method: "POST",
238 body: JSON.stringify({
234
235 try {
236 const response = await fetch("/", {
237 method: "POST",
238 body: JSON.stringify({
13 useEffect(() => {
14 if (url) {
15 fetch(`/extract?url=${encodeURIComponent(url)}`)
16 .then((response) => response.json())
17 .then((data) => {
21 })
22 .catch((error) => {
23 console.error("Error fetching data:", error);
24 setResultText("Error fetching data");
25 setResultImage("");
26 });
141 // If the 'image' parameter is present, proxy the image
142 if (url.searchParams.get("image") === "true") {
143 const imageResponse = await fetch(imageUrl);
144 return new Response(imageResponse.body, {
145 headers: {
25
26 try {
27 const response = await fetch("/generate-content", {
28 method: "POST",
29 body: JSON.stringify({ prompt, mode }),
258 });
259
260 return app.fetch(request);
261}
20
21 try {
22 const response = await fetch("/chat", {
23 method: "POST",
24 headers: { "Content-Type": "application/json" },
20
21 try {
22 const response = await fetch("/chat", {
23 method: "POST",
24 headers: { "Content-Type": "application/json" },
33 : [];
34
35 const response = await fetch(
36 `/ai?direction=${direction}&conversation=${encodeURIComponent(JSON.stringify(conversation))}`,
37 );
47 window.history.replaceState({}, "", `${window.location.pathname}?${urlParams}`);
48 } catch (error) {
49 setMessage("Error fetching AI response");
50 } finally {
51 setIsLoading(false);
57
58 try {
59 const response = await fetch("/generate-api", {
60 method: "POST",
61 headers: { "Content-Type": "application/json" },