regexWordSearchPagemain.tsx4 matches
1516useEffect(() => {
17async function fetchWords() {
18try {
19const response = await fetch('https://raw.githubusercontent.com/dwyl/english-words/refs/heads/master/words.txt');
20if (!response.ok) throw new Error('Failed to fetch words');
21const text = await response.text();
22const wordList = text.split('\n')
38}
39}
40fetchWords();
41}, []);
42
githubParsermain.tsx23 matches
243244245async function fetchFileTypes(repoUrl) {
246const response = await fetch('/file-types', {
247method: 'POST',
248headers: { 'Content-Type': 'application/json' },
375try {
376console.log('Sending request to /parse endpoint...');
377const response = await fetch('/parse', {
378method: 'POST',
379headers: {
444try {
445const ignoredPatterns = parseIgnoredPatterns();
446const fileTypes = await fetchFileTypes(repoUrl);
447displayFileTypeSelector(fileTypes, ignoredPatterns);
448} catch (error) {
500}
501502console.log(`Fetching content for ${owner}/${repo}`);
503const content = await fetchRepositoryContent(owner, repo, branch, ignoredPatterns, selectedTypes);
504const tokenCounts = await countTokens(content);
505
587}
588589async function fetchRepositoryContent(owner, repo, specifiedBranch = null, ignoredPatterns, selectedTypes = null) {
590// First, try to get the default branch or use the specified branch
591const repoInfoUrl = `https://api.github.com/repos/${owner}/${repo}`;
592const repoInfoResponse = await fetch(repoInfoUrl, {
593headers: {
594'Authorization': `token ${Deno.env.get("GITHUB_API_KEY")}`,
601throw new Error(`Repository not found or not accessible: ${owner}/${repo}`);
602}
603throw new Error(`Failed to fetch repository info: ${repoInfoResponse.statusText}`);
604}
605608609const apiUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${defaultBranch}?recursive=1`;
610const response = await fetch(apiUrl, {
611headers: {
612'Authorization': `token ${Deno.env.get("GITHUB_API_KEY")}`,
617if (!response.ok) {
618if (response.status === 404) {
619throw new Error(`Failed to fetch repository content. The ${defaultBranch} branch might not exist.`);
620}
621throw new Error(`GitHub API request failed: ${response.statusText}`);
645for (const file of files) {
646try {
647const fileContent = await fetchFileContent(owner, repo, file.path, defaultBranch);
648content += `File: ${file.path}\n\n${fileContent}\n\n`;
649} catch (error) {
650console.error(`Failed to fetch content for ${file.path}: ${error.message}`);
651content += `File: ${file.path}\n\nError: Failed to fetch content\n\n`;
652}
653}
661}
662663async function fetchFileContent(owner, repo, path, branch) {
664const apiUrl = `https://api.github.com/repos/${owner}/${repo}/contents/${path}`;
665const response = await fetch(apiUrl, {
666headers: {
667'Authorization': `token ${Deno.env.get("GITHUB_API_KEY")}`,
671672if (!response.ok) {
673throw new Error(`Failed to fetch file content: ${response.statusText}`);
674}
675792}
793794// Add new endpoint to handle file type fetching
795app.post("/file-types", async (c) => {
796try {
822async function getRepositoryFileTypes(owner, repo, specifiedBranch = null) {
823const repoInfoUrl = `https://api.github.com/repos/${owner}/${repo}`;
824const repoInfoResponse = await fetch(repoInfoUrl, {
825headers: {
826'Authorization': `token ${Deno.env.get("GITHUB_API_KEY")}`,
830
831if (!repoInfoResponse.ok) {
832throw new Error(`Failed to fetch repository info: ${repoInfoResponse.statusText}`);
833}
834
837
838const apiUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${defaultBranch}?recursive=1`;
839const response = await fetch(apiUrl, {
840headers: {
841'Authorization': `token ${Deno.env.get("GITHUB_API_KEY")}`,
863}
864865// Export app.fetch for Val Town, otherwise export app — this is only for hono apps
866export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;
867
1314useEffect(() => {
15fetch("/likes")
16.then(async (res) => await res.json() as Like)
17.then(data => setLikes(data.likes));
22confetti();
23setLikes((prev) => prev + 1);
24fetch("/like", { method: "POST" }).catch(console.error);
25});
26
URLReceiverurlCrawlerComponent4 matches
75try {
76console.log(`Checking URL: ${url}`);
77const response = await fetch(url, {
78method: "GET",
79headers: {
137private async extractUrlsFromPage(url: string): Promise<string[]> {
138try {
139const response = await fetch(url);
140if (!response.ok) {
141console.log(`Failed to fetch ${url}: ${response.status} ${response.statusText}`);
142return [];
143}
193return uniqueUrls;
194} catch (error) {
195console.error(`Error fetching ${url}:`, error);
196return [];
197}
1112try {
13const CompletionResponse = await fetch('https://rozek-openrouterchatcompletion.web.val.run/', {
14method: 'POST',
15headers:{ 'Content-Type':'application/json' },
cerebras_codermain.tsx1 match
182183try {
184const response = await fetch("/", {
185method: "POST",
186body: JSON.stringify({
imageUploadPerMinuteWebsitemain.tsx13 matches
31}, []);
3233// Fetch images and comments when the component first loads or page changes
34useEffect(() => {
35fetchImages();
36fetchComments();
37}, [currentPage]);
3839// Function to retrieve images from the server with pagination
40const fetchImages = async () => {
41try {
42const response = await fetch(`/images?page=${currentPage}`);
43const data = await response.json();
44setImages(data.images);
45setTotalPages(data.totalPages);
46} catch (err) {
47setError("Could not fetch images");
48console.error("Image fetch error:", err);
49}
50};
5152// Function to retrieve comments from the server
53const fetchComments = async () => {
54try {
55const response = await fetch('/comments');
56const data = await response.json();
57setComments(data);
58} catch (err) {
59setError("Could not fetch comments");
60console.error("Comments fetch error:", err);
61}
62};
111formData.append('username', username);
112113const response = await fetch('/upload', {
114method: 'POST',
115body: formData
128129// Refresh images after upload
130await fetchImages();
131
132// Reset upload states
jarvisPrototypemain.tsx1 match
96if (status === "Jarvis activated. How can I help?") {
97try {
98const response = await fetch("/chat", {
99method: "POST",
100body: JSON.stringify({
OpenRouterChatCompletionmain.tsx2 matches
6667if (stream == true) {
68const OpenRouterStream = await fetch(
69'https://openrouter.ai/api/v1/chat/completions',{
70method:'POST',
88})
89} else {
90const OpenRouterCompletion = await fetch(
91'https://openrouter.ai/api/v1/chat/completions',{
92method:'POST',
94tokenUrl.searchParams.set("state", store.state);
9596const tokenResp = await fetch(tokenUrl.toString());
97if (!tokenResp.ok) {
98throw new Error(await tokenResp.text());
103};
104105const resp = await fetch("https://lastlogin.net/userinfo", {
106headers: {
107Authorization: `Bearer ${access_token}`,