43
44// This is the entry point for HTTP vals
45export default app.fetch;
18// State
19let username = localStorage.getItem('username') || '';
20let lastChatFetch = 0;
21let chatPollingInterval;
22
138 `;
139
140 const response = await fetch('/api/jobs');
141 const result = await response.json();
142
210 };
211
212 const response = await fetch('/api/jobs', {
213 method: 'POST',
214 headers: {
255async function loadChatMessages() {
256 try {
257 const response = await fetch('/api/chat');
258 const result = await response.json();
259
260 if (result.success && result.data) {
261 displayChatMessages(result.data);
262 lastChatFetch = Date.now();
263 } else {
264 throw new Error(result.error || 'Failed to load chat messages');
320
321 try {
322 const response = await fetch('/api/chat', {
323 method: 'POST',
324 headers: {
13 return c.json({ success: true, data: messages.reverse() });
14 } catch (error) {
15 console.error("Error fetching chat messages:", error);
16 return c.json({ success: false, error: "Failed to fetch chat messages" }, 500);
17 }
18});
10 return c.json({ success: true, data: jobPostings });
11 } catch (error) {
12 console.error("Error fetching job postings:", error);
13 return c.json({ success: false, error: "Failed to fetch job postings" }, 500);
14 }
15});
30 return c.json({ success: true, data: jobPosting });
31 } catch (error) {
32 console.error("Error fetching job posting:", error);
33 return c.json({ success: false, error: "Failed to fetch job posting" }, 500);
34 }
35});
28
29 useEffect(() => {
30 const fetchPackageDetails = async () => {
31 try {
32 // Fetch package details
33 const response = await client.package
34 .$get({ query: { name: packageName } });
37 setReadme(marked(data.readme || ""));
38 } catch (error) {
39 console.error("Error fetching package details:", error);
40 } finally {
41 setLoading(false);
43 };
44
45 fetchPackageDetails();
46 }, [packageName]);
47
33 });
34
35export default app.fetch;
36
24 );
25
26 const fetchPackages = async (
27 searchQuery: string,
28 pageNum: number,
73 setLoading(false);
74 } catch (error) {
75 console.error("Error fetching packages:", error);
76 setLoading(false);
77 }
82 setItems([]);
83 setQuery(searchQuery);
84 fetchPackages(searchQuery, 1);
85 };
86
89 const nextPage = page + 1;
90 setPage(nextPage);
91 fetchPackages(query, nextPage, true);
92 };
93
94 useEffect(() => {
95 fetchPackages(query, 1);
96 }, []);
97
14): Promise<string> => {
15 try {
16 const response = await fetch(
17 "https://stevekrouse--411c225025f011f0ad23569c3dd06744.web.val.run/api/fal/proxy",
18 {
56
57 useEffect(() => {
58 // If we already have an image URL, don't fetch a new one
59 if (imageUrl) {
60 setProfileImage(imageUrl);
63 }
64
65 // If we're already loading or have an image, don't fetch again
66 if (!isLoading || profileImage) return;
67
68 // Generate a profile picture if we don't have one
69 const fetchProfilePicture = async () => {
70 const prompt = `${packageId} ${avatarText} profile picture`;
71 const url = await generateProfilePicture(prompt);
76 };
77
78 fetchProfilePicture();
79 }, [imageUrl, packageId, avatarText, isLoading, profileImage]);
80
553
554// Export the Hono app
555export default app.fetch;
418 formData.append('file', currentLdocFile);
419
420 const response = await fetch('/api/view', {
421 method: 'POST',
422 body: formData
452 formData.append('file', currentLdocFile);
453
454 const response = await fetch('/api/extract', {
455 method: 'POST',
456 body: formData
485 formData.append('file', currentLdocFile);
486
487 const response = await fetch('/api/info', {
488 method: 'POST',
489 body: formData
521 }
522
523 const response = await fetch('/api/encode', {
524 method: 'POST',
525 body: formData
622 formData.append('path', file.path);
623
624 const response = await fetch('/api/view/file', {
625 method: 'POST',
626 body: formData
658 fileViewer.appendChild(loading);
659
660 // Fetch file content
661 const formData = new FormData();
662 formData.append('file', currentLdocFile);
663 formData.append('path', file.path);
664
665 const response = await fetch('/api/view/file', {
666 method: 'POST',
667 body: formData