laudableFuchsiaMastodonmain.tsx5 matches
1718try {
19const response = await fetch(window.location.href, {
20method: "POST",
21headers: { "Content-Type": "application/json" },
102103console.log("Sending initial request to Replicate...");
104const response = await fetch(`https://api.replicate.com/v1/models/${modelVersion}/predictions`, {
105method: "POST",
106headers: {
125while (true) {
126console.log("Checking result...");
127const resultResponse = await fetch(prediction.urls.get, {
128headers: {
129"Authorization": `Token ${REPLICATE_API_KEY}`,
155const imageName = `generated-image-${timestamp}.jpg`;
156157const imageResponse = await fetch(imageUrl);
158if (!imageResponse.ok) throw new Error("Failed to download image");
159174const imageName = `generated-image-${timestamp}.jpg`;
175176const imageResponse = await fetch(imageUrl);
177if (!imageResponse.ok) throw new Error("Failed to generate image");
178
shirtGenScriptmain.tsx4 matches
2425console.log("Sending initial request to Replicate...");
26const response = await fetch(`https://api.replicate.com/v1/models/${modelVersion}/predictions`, {
27method: "POST",
28headers: {
47while (true) {
48console.log("Checking result...");
49const resultResponse = await fetch(prediction.urls.get, {
50headers: {
51"Authorization": `Token ${REPLICATE_API_KEY}`,
77const imageName = `generated-image-${timestamp}.jpg`;
7879const imageResponse = await fetch(imageUrl);
80if (!imageResponse.ok) throw new Error("Failed to download image");
8196const imageName = `generated-image-${timestamp}.jpg`;
9798const imageResponse = await fetch(imageUrl);
99if (!imageResponse.ok) throw new Error("Failed to generate image");
100
shirtGenScriptmain.tsx4 matches
2425console.log("Sending initial request to Replicate...");
26const response = await fetch(`https://api.replicate.com/v1/models/${modelVersion}/predictions`, {
27method: "POST",
28headers: {
47while (true) {
48console.log("Checking result...");
49const resultResponse = await fetch(prediction.urls.get, {
50headers: {
51"Authorization": `Token ${REPLICATE_API_KEY}`,
77const imageName = `generated-image-${timestamp}.jpg`;
7879const imageResponse = await fetch(imageUrl);
80if (!imageResponse.ok) throw new Error("Failed to download image");
8196const imageName = `generated-image-${timestamp}.jpg`;
9798const imageResponse = await fetch(imageUrl);
99if (!imageResponse.ok) throw new Error("Failed to generate image");
100
shirtGenScriptmain.tsx4 matches
2425console.log("Sending initial request to Replicate...");
26const response = await fetch(`https://api.replicate.com/v1/models/${modelVersion}/predictions`, {
27method: "POST",
28headers: {
47while (true) {
48console.log("Checking result...");
49const resultResponse = await fetch(prediction.urls.get, {
50headers: {
51"Authorization": `Token ${REPLICATE_API_KEY}`,
77const imageName = `generated-image-${timestamp}.jpg`;
7879const imageResponse = await fetch(imageUrl);
80if (!imageResponse.ok) throw new Error("Failed to download image");
8196const imageName = `generated-image-${timestamp}.jpg`;
9798const imageResponse = await fetch(imageUrl);
99if (!imageResponse.ok) throw new Error("Failed to generate image");
100
3536async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38method: "POST",
39headers: {
5051async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53method: "POST",
54headers: {
handleDiscordNewUsermain.tsx2 matches
2324try {
25const response = await fetch(`https://www.shovel.report/api/domains/${domain}`);
26if (!response.ok) {
27throw new Error(`HTTP error! status: ${response.status}`);
33};
34} catch (error) {
35console.error("Error fetching technologies:", error);
36return { services: [], social_media: {} };
37}
giftSuggestionAppmain.tsx6 matches
27useEffect(() => {
28if ((age.length > 0 && budget.length > 0) || buttonPressed) {
29fetchSuggestions();
30setButtonPressed(false);
31}
32}, [age, budget, buttonPressed]);
3334const fetchSuggestions = async (isMoreSuggestions: boolean = false) => {
35setLoading(true);
36setError(null);
4041try {
42const response = await fetch("/api/shopping-assistant", {
43method: "POST",
44headers: { "Content-Type": "application/json" },
60setShownSuggestions(prevShown => [...prevShown, ...data.suggestions.map(s => s.text)]);
61} catch (err) {
62console.error("Error in fetchSuggestions:", err);
63setError(`An error occurred while fetching suggestions: ${err.message}`);
64} finally {
65setLoading(false);
7374const handleMoreSuggestions = async () => {
75await fetchSuggestions(true);
76};
77
sanguineCyanMastodonREADME.md16 matches
9Fun fact generation about the text (e.g., average word length)
10Summary generation
11The tool is implemented in JavaScript using Hono as a lightweight framework and integrates web APIs for fetching external content and analyzing it in real-time.
1213Code Structure
16Hono: Used for routing and handling API requests.
17encode (from JS Base64): Utility for encoding data.
18parse (from Node HTML Parser): Parses HTML content, used in fetchUrlContent to clean and extract text.
19Core Modules
2062Usage: Included in /analyse for quick overviews.
63cleanText(text)
64Purpose: Cleans HTML and unwanted characters from the fetched content.
65Parameters:
6667text (string): Raw HTML/text. Returns: Cleaned text string.
68Usage: Essential for preprocessing content in fetchUrlContent.
69fetchUrlContent(url)
70Purpose: Fetches HTML content from a URL, removes unwanted elements, and extracts main text.
71Parameters:
7273url (string): URL to fetch and clean content from. Returns: Cleaned text string or an error message.
74Usage: This function powers the URL input functionality.
75Core Functionalities
76Text Analysis Form (HTML)
77The form on the main page allows users to submit either raw text or a URL. The client-side JavaScript processes the form submission and, if needed, triggers a URL fetch to obtain content.
7879Backend Processing (Routes)
81GET /: Serves the main HTML page.
82POST /analyse: Analyzes submitted text and returns word count, sentiment, summary, TF-IDF, and word frequency results.
83POST /fetch-url: Retrieves and cleans content from a URL, then prepares it for analysis.
84Dark Mode and Interactivity
8590Testing
9192Integration Tests: Ensure calculateTFIDF, calculateWordFrequency, and fetchUrlContent produce consistent outputs.
93Client-Side Testing: Regularly test URL fetching functionality to ensure robustness, particularly with dynamic sites.
94Error Handling
9596Maintain try/catch blocks in asynchronous functions like fetchUrlContent to capture network issues.
97Update error messages to be user-friendly and provide feedback if inputs are invalid or exceed size limits.
98Data Sanitization
99100Verify that cleanText removes sensitive information from fetched URLs to prevent accidental disclosure.
101Rate Limits and API Usage
102119The Radical Text Analyser code primarily uses the following APIs:
1201. Hono Framework API
121* Purpose: Used to set up routing and serve responses for different endpoints (GET /, POST /analyse, and POST /fetch-url).
122* Usage: The Hono framework handles HTTP requests and responses, forming the backbone of the server-side API.
1232. External Content Fetching API (via fetch)
124* Purpose: Retrieves HTML content from external URLs when users input a URL for analysis.
125* Usage: The fetchUrlContent function uses fetch to make a GET request to the user-provided URL, which allows the application to process content from web pages.
126* Error Handling: Includes logic to check response status and handle various network errors.
1273. Google Fonts API
scraper_templatemain.tsx1 match
9const variable: string = await blob.getJSON(blobKey) ?? "";
1011const response = await fetch(scrapeURL);
12const body = await response.text();
13const $ = cheerio.load(body);
71# Long-term memory
7273At some point the user might ask you to do something with "memory". Things like "remember", "save to memory", "forget", "update memory", etc. Please use corresponding actions to achieve those tasks. User might also ask you to perform some task with the context of your "memory" - in that case fetch all memories before proceeding with the task. The memories should be formed in a clear and purely informative language, void of unnecessary adjectives or decorative language forms. An exception to that rule might be a case when the language itself is the integral part of information (snippet of writing to remember for later, examples of some specific language forms, quotes, etc.).
7475Structure of a memory: