princeton-nlp / SWE-agent

SWE-agent takes a GitHub issue and tries to automatically fix it, using GPT-4, or your LM of choice. It solves 12.47% of bugs in the SWE-bench evaluation set and takes just 1 minute to run.
https://princeton-nlp.github.io/SWE-agent/
MIT License
11.9k stars 1.19k forks source link

Web UI: Reset the user-entered source value after changing the problem source dropdown. #497

Open kwight opened 1 month ago

kwight commented 1 month ago

Reference Issues/PRs

Fixes https://github.com/princeton-nlp/SWE-agent/issues/362

What does this implement/fix? Explain your changes.

Use useEffect to monitor the problem source dropdown, and when it changes, reset the user value to empty (so that the default text appears for that field).

The textarea corresponding to the "Write" dropdown doesn't need changes since the actual markup is updated on switch (between inputs and textarea).

after

Testing Instructions

  1. On a fresh page load, enter something into the "GitHub issue URL" field.
  2. Switch the dropdown above it to "Local file", and verify the "Path to local .MD..." filed is empty (displaying the placeholder text).
  3. Enter data in that field again, and switch the dropdown back to its original value. Verify the "GitHub issue URL" field is empty again.
codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 75.85%. Comparing base (7050d85) to head (3b7c3a2). Report is 5 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #497 +/- ## ========================================== + Coverage 75.74% 75.85% +0.10% ========================================== Files 20 20 Lines 3134 3148 +14 ========================================== + Hits 2374 2388 +14 Misses 760 760 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

kwight commented 1 month ago

Side note, dumping this issue and the relevant file into GPT4o gave a near-perfect fix (I actually assumed refs would be needed, but that might be old pre-hooks thinking).

ofirpress commented 1 month ago

Cool, thanks!

ofirpress commented 2 weeks ago

@klieret can we merge this?