27 try {
28 // First API call - Get search results
29 const searchResult = await fetch("/api/search", {
30 method: "POST",
31 headers: { "Content-Type": "application/json" },
38 // Second API call - Get summary
39 setSummaryLoading(true);
40 const summaryResult = await fetch("/api/summarize", {
41 method: "POST",
42 headers: { "Content-Type": "application/json" },
149 // Search using SerpApi
150 try {
151 const searchResponse = await fetch(
152 `https://serpapi.com/search.json?q=${encodeURIComponent(query)}&api_key=${Deno.env.get("SERP_API_KEY")}`,
153 );
20
21 try {
22 const response = await fetch("/chat", {
23 method: "POST",
24 headers: { "Content-Type": "application/json" },
20 const useSeed = seed ?? Date.now().toString();
21
22 // Fetch and cache the word list if not already done
23 if (!wordListCache) {
24 const response = await fetch("https://raw.githubusercontent.com/wordnik/wordlist/main/wordlist-20210729.txt");
25 const text = await response.text();
26 wordListCache = text.trim().split("\n")
46
47 try {
48 const response = await fetch("/generate-component", {
49 method: "POST",
50 headers: { "Content-Type": "application/json" },
236
237 try {
238 const response = await fetch("/", {
239 method: "POST",
240 body: JSON.stringify({
113
114 useEffect(() => {
115 fetchSubscriptions();
116 }, []);
117
118 const fetchSubscriptions = async () => {
119 try {
120 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
128 setSubscriptions(result.rows);
129 } catch (error) {
130 console.error("Error fetching subscriptions:", error);
131 }
132 };
151 ]);
152
153 fetchSubscriptions();
154 } catch (error) {
155 console.error("Error adding subscription:", error);
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" },
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({