diff --git a/langgraph/src/main.tsx b/langgraph/src/main.tsx index 1e0c391..8b45343 100644 --- a/langgraph/src/main.tsx +++ b/langgraph/src/main.tsx @@ -1112,12 +1112,28 @@ function App() { {thread.isLoading ? ( thread.stop()} + onClick={() => { + setConcurrentStatus("stopping"); + wasStoppedRef.current = true; + thread.stop(); + setTimeout(() => { + setConcurrentStatus("cancelling"); + const waitForStop = () => { + if (!thread.isLoading) { + wasStoppedRef.current = false; + setConcurrentStatus("idle"); + } else { + setTimeout(waitForStop, 200); + } + }; + waitForStop(); + }, 150); + }} className="rounded-xl bg-destructive text-destructive-foreground px-4 py-2.5 text-sm font-medium hover:opacity-90 transition-opacity flex items-center gap-1.5" title="点击停止生成" > - 停止 + {concurrentStatus === "stopping" ? "停止中..." : concurrentStatus === "cancelling" ? "等待停止..." : "停止"} ) : (