qualityGrayPikemain.tsx1 match
180181try {
182const response = await fetch("/", {
183method: "POST",
184body: JSON.stringify({
lovableVioletPeafowlmain.tsx1 match
181try {
182throw new Error("Generation Error: " + await response.text());
183const response = await fetch("/", {
184method: "POST",
185body: JSON.stringify({
cerebras_codermain.tsx1 match
180181try {
182const response = await fetch("/", {
183method: "POST",
184body: JSON.stringify({
neatBlackSwiftmain.tsx1 match
183184try {
185const response = await fetch("/", {
186method: "POST",
187body: JSON.stringify({
summarizeHnmain.tsx19 matches
90}, []);
9192const fetchAndSummarize = async () => {
93if (!postId) {
94setError("Please enter a valid Hacker News post ID");
101setPostDetails(null);
102setProgress(10);
103console.log("Starting fetchAndSummarize");
104105try {
106// Fetch post details
107setProgress(30);
108console.log("Fetching HN post details");
109const postResponse = await fetch(`/post-details?id=${postId}`);
110if (!postResponse.ok) {
111throw new Error(`Failed to fetch post details: ${postResponse.statusText}`);
112}
113const postData = await postResponse.json();
114setPostDetails(postData);
115console.log("Post details fetched", postData);
116117// Fetch comments and generate summary
118setProgress(60);
119console.log("Sending summary request");
120const summaryResponse = await fetch("/summarize", {
121method: "POST",
122headers: {
143console.log("Summarization complete");
144} catch (err) {
145console.error("Fetch Error:", err);
146setError(`Error: ${err.message}`);
147setLoading(false);
152const handleKeyDown = (event) => {
153if (event.key === "Enter" && !loading) {
154fetchAndSummarize();
155}
156};
179/>
180<button
181onClick={fetchAndSummarize}
182disabled={loading}
183className="bg-orange-500 text-white p-3 rounded-r-lg hover:bg-orange-600 disabled:opacity-50 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-orange-500"
304}
305306// Handle post details fetch
307if (request.method === "GET" && new URL(request.url).pathname === "/post-details") {
308const url = new URL(request.url);
316317try {
318const response = await fetch(`https://hacker-news.firebaseio.com/v0/item/${postId}.json`);
319if (!response.ok) {
320throw new Error(`Failed to fetch post details: ${response.statusText}`);
321}
322const postData = await response.json();
325});
326} catch (error) {
327console.error("Error fetching post details:", error);
328return new Response(JSON.stringify({ error: "Failed to fetch post details" }), {
329status: 500,
330headers: { "Content-Type": "application/json" },
357const { postId, postDetails } = requestBody;
358359// Fetch comments
360const commentsResponse = await fetch(`https://hn.algolia.com/api/v1/items/${postId}`);
361const commentsData = await commentsResponse.json();
362
186187try {
188const response = await fetch("/", {
189method: "POST",
190body: JSON.stringify({
1import { dataToRSS } from "https://esm.town/v/Glench/dataToRSS";
2import { fetch } from "https://esm.town/v/std/fetch";
3import process from "node:process";
424const show_id = TV_SHOWS_WATCHED[i];
25const url = `https://api.themoviedb.org/3/tv/${show_id}?api_key=${process.env.tmdb_api_key}`;
26const resp = await fetch(url);
27const show = await resp.json();
28data.push(show);
blob_adminmain.tsx23 matches
234const [isDragging, setIsDragging] = useState(false);
235236const fetchBlobs = useCallback(async () => {
237setLoading(true);
238try {
239const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
240const data = await response.json();
241setBlobs(data);
242} catch (error) {
243console.error("Error fetching blobs:", error);
244} finally {
245setLoading(false);
248249useEffect(() => {
250fetchBlobs();
251}, [fetchBlobs]);
252253const handleSearch = (e) => {
264setBlobContentLoading(true);
265try {
266const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
267const content = await response.text();
268setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
269setEditContent(content);
270} catch (error) {
271console.error("Error fetching blob content:", error);
272} finally {
273setBlobContentLoading(false);
278const handleSave = async () => {
279try {
280await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
281method: "PUT",
282body: editContent,
290const handleDelete = async (key) => {
291try {
292await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
293setBlobs(blobs.filter(b => b.key !== key));
294if (selectedBlob && selectedBlob.key === key) {
307const key = `${searchPrefix}${file.name}`;
308formData.append("key", encodeKey(key));
309await fetch("/api/blob", { method: "POST", body: formData });
310const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
311setBlobs([newBlob, ...blobs]);
315}
316}
317fetchBlobs();
318};
319329try {
330const fullKey = `${searchPrefix}${key}`;
331await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
332method: "PUT",
333body: "",
344const handleDownload = async (key) => {
345try {
346const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
347const blob = await response.blob();
348const url = window.URL.createObjectURL(blob);
363if (newKey && newKey !== oldKey) {
364try {
365const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
366const content = await response.blob();
367await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
368method: "PUT",
369body: content,
370});
371await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
372setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
373if (selectedBlob && selectedBlob.key === oldKey) {
383const newKey = `__public/${key}`;
384try {
385const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
386const content = await response.blob();
387await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
388method: "PUT",
389body: content,
390});
391await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
392setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
393if (selectedBlob && selectedBlob.key === key) {
402const newKey = key.slice(9); // Remove "__public/" prefix
403try {
404const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
405const content = await response.blob();
406await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
407method: "PUT",
408body: content,
409});
410await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
411setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
412if (selectedBlob && selectedBlob.key === key) {
826});
827828export default lastlogin((request: Request) => app.fetch(request));
cerebras_codermain.tsx4 matches
3637useEffect(() => {
38async function fetchStats() {
39const response = await fetch("/dashboard-stats");
40const data = await response.json();
41setStats(data);
42}
43fetchStats();
44}, []);
45146147try {
148const response = await fetch("/", {
149method: "POST",
150body: JSON.stringify({