shadowaxe99 / wiki-tldr

https://wiki-tldr.vercel.app
1 stars 0 forks source link

Sweep: fix up site and delete as needed #11

Closed shadowaxe99 closed 10 months ago

shadowaxe99 commented 10 months ago
Checklist - [X] Modify `public/index.html` ✓ https://github.com/shadowaxe99/wiki-tldr/commit/de8130daaba8f59523ede0e7107111081ba3beb6 [Edit](https://github.com/shadowaxe99/wiki-tldr/edit/sweep/cleanup/public/index.html) ![Flowchart](https://raw.githubusercontent.com/shadowaxe99/wiki-tldr/sweep/assets/d9c10821bfa4a2707174e5eabc5bf3f8457a1586b36fb8095aacecb92f6d0afa_11_flowchart.svg)
sweep-ai[bot] commented 10 months ago

Here's the PR! https://github.com/shadowaxe99/wiki-tldr/pull/15. See Sweep's process at dashboard.

💎 Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets. (tracking ID: 0169e1dd9f)

Actions (click)

Sandbox execution failed

The sandbox appears to be unavailable or down.


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/shadowaxe99/wiki-tldr/blob/b7046f7bc25d132117cd6a5b0d14b7e648af51b6/README.md#L1-L8 https://github.com/shadowaxe99/wiki-tldr/blob/b7046f7bc25d132117cd6a5b0d14b7e648af51b6/package.json#L1-L15 https://github.com/shadowaxe99/wiki-tldr/blob/b7046f7bc25d132117cd6a5b0d14b7e648af51b6/package.json#L15-L22 https://github.com/shadowaxe99/wiki-tldr/blob/b7046f7bc25d132117cd6a5b0d14b7e648af51b6/public/index.html#L1-L26 https://github.com/shadowaxe99/wiki-tldr/blob/b7046f7bc25d132117cd6a5b0d14b7e648af51b6/public/index.html#L26-L60 https://github.com/shadowaxe99/wiki-tldr/blob/b7046f7bc25d132117cd6a5b0d14b7e648af51b6/public/index.html#L60-L74 https://github.com/shadowaxe99/wiki-tldr/blob/b7046f7bc25d132117cd6a5b0d14b7e648af51b6/public/index.html#L74-L104

Step 2: ⌨️ Coding


+++ @@ -27,13 +27,16 @@

+ // App component function App() { - const [wikiName, setWikiName] = React.useState(''); - const [summary, setSummary] = React.useState(''); - const [loading, setLoading] = React.useState(false); -const [errorMessage, setErrorMessage] = React.useState(''); - - const handleSummarize = async () => { + // State variables + const [wikiName, setWikiName] = React.useState(''); // Name of the Wikipedia page to summarize + const [summary, setSummary] = React.useState(''); // Summary of the Wikipedia page + const [loading, setLoading] = React.useState(false); // Loading state + const [errorMessage, setErrorMessage] = React.useState(''); // Error message + + // Function to fetch summary from server + const fetchSummary = async (pageName) => { setLoading(true); try { const response = await fetch('http://localhost:5000/summarize', { @@ -42,37 +45,42 @@ 'Content-Type': 'application/json' }, body: JSON.stringify({ - pageName: wikiName + pageName: pageName }) }); if (response.ok) { const data = await response.json(); setSummary(data.summary); } else { - setErrorMessage(response.statusText); - console.error('Error fetching summary'); + throw new Error(response.statusText); } - } catch (error) {console.error('Error:', error); - setErrorMessage(error.message);} + } catch (error) { + console.error('Error fetching summary:', error); + setErrorMessage(error.message); + } setLoading(false); }; - - return ( -
-
-

Wiki TLDR

-

- Get a TLDR summary of any Wikipedia page. -

- {errorMessage && ( -
-
- Error: - {errorMessage} -
-
-)} -
+ + // Function to handle the Summarize button click + const handleSummarize = () => { + fetchSummary(wikiName); + }; +return ( +
+
+

Wiki TLDR

+

+ Get a TLDR summary of any Wikipedia page. +

+ {errorMessage && ( +
+
+ Error: + {errorMessage} +
+
+ )} +
--- ## Step 3: 🔁 Code Review I have finished reviewing the code for completeness. I did not find errors for [`sweep/cleanup`](https://github.com/shadowaxe99/wiki-tldr/commits/sweep/cleanup). --- ### 🎉 Latest improvements to Sweep: * We just released a [dashboard](https://progress.sweep.dev) to track Sweep's progress on your issue in real-time, showing every stage of the process – from search to planning and coding. * Sweep uses OpenAI's latest Assistant API to **plan code changes** and **modify code**! This is 3x faster and *significantly* more reliable as it allows Sweep to edit code and validate the changes in tight iterations, the same way as a human would. --- 💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. [Join Our Discord](https://discord.com/invite/sweep)