Skip to content

feat: implement native Stop Generation button using AbortController #364#398

Open
annukumar123 wants to merge 3 commits into
imDarshanGK:mainfrom
annukumar123:feature/stop-generation-button
Open

feat: implement native Stop Generation button using AbortController #364#398
annukumar123 wants to merge 3 commits into
imDarshanGK:mainfrom
annukumar123:feature/stop-generation-button

Conversation

@annukumar123

Copy link
Copy Markdown
Contributor

🚀 Overview

Addresses #364 by introducing a native client-side Stop Generation button to cleanly interrupt ongoing LLM streaming responses.

🛠️ Changes Implemented

  • utils/api.js: Updated the central fetch wrapper (req) and streamMessage to accept and handle a native browser AbortSignal token.
  • App.jsx: Introduced an abortControllerRef using useRef to track active asynchronous text streams dynamically. Added a unified stopGeneration callback handler to safely abort the network fetch request line and seamlessly clean up internal message states.
  • ChatWindow.jsx: Integrated a dynamic button state switch that swaps the traditional "Send" action out for an explicit "Stop" trigger button whenever an active generation layout sequence is detected.

🧪 Local Testing Results

Verified locally alongside the FastAPI backend module. Active response stream processes truncate instantly when clicked, printing the intended [Generation Stopped] fallback marker inside the active chat history viewport.
Screenshot 2026-06-13 210757

@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

@annukumar123 is attempting to deploy a commit to the Darshan's projects Team on Vercel.

A member of the Team first needs to authorize it.

@annukumar123

Copy link
Copy Markdown
Contributor Author

Hi @imDarshanGK,

I have manually resolved the merge conflicts with the main branch directly through the GitHub editor. I made sure to preserve the core template features and props while keeping the AbortController logic intact.

Both the Frontend (React) and Backend (Python) CI test and lint pipelines are now passing completely green! The Stop Generation feature is fully functional and ready for your final review and merge.

Let me know if you'd like me to adjust anything else!

@annukumar123

Copy link
Copy Markdown
Contributor Author

Hi @imDarshanGK
Both CI run properly. can you merge it

@imDarshanGK

Copy link
Copy Markdown
Owner

@annukumar123 resolve conflicts

@annukumar123

Copy link
Copy Markdown
Contributor Author

@imDarshanGK
Here we go. Both CI are working.
Now i want to work on more issues.Can you Assign it to me ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants