mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
refactor(copilot): convert stop to plain function declaration
Remove useCallback wrapper per project guidelines — stopRef.current captures the latest closure on every render regardless.
This commit is contained in:
@@ -112,7 +112,7 @@ export function useCopilotPage() {
|
||||
// Wrap AI SDK's stop() to also cancel the backend executor task.
|
||||
// sdkStop() aborts the SSE fetch instantly (UI feedback), then we fire
|
||||
// the cancel API to actually stop the executor and wait for confirmation.
|
||||
const stop = useCallback(async () => {
|
||||
async function stop() {
|
||||
sdkStop();
|
||||
|
||||
// Mark any in-progress tool parts as errored so spinners stop.
|
||||
@@ -138,7 +138,7 @@ export function useCopilotPage() {
|
||||
variant: "destructive",
|
||||
});
|
||||
}
|
||||
}, [sdkStop, sessionId, setMessages]);
|
||||
}
|
||||
|
||||
// Abort the stream if the backend doesn't start sending data within 12s.
|
||||
const stopRef = useRef(stop);
|
||||
|
||||
Reference in New Issue
Block a user