mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
fix: Clear previous thoughts when starting new prompts (#4966)
This commit is contained in:
@@ -414,8 +414,9 @@ export const useGeminiStream = (
|
||||
userMessageTimestamp,
|
||||
);
|
||||
setIsResponding(false);
|
||||
setThought(null); // Reset thought when user cancels
|
||||
},
|
||||
[addItem, pendingHistoryItemRef, setPendingHistoryItem],
|
||||
[addItem, pendingHistoryItemRef, setPendingHistoryItem, setThought],
|
||||
);
|
||||
|
||||
const handleErrorEvent = useCallback(
|
||||
@@ -437,8 +438,9 @@ export const useGeminiStream = (
|
||||
},
|
||||
userMessageTimestamp,
|
||||
);
|
||||
setThought(null); // Reset thought when there's an error
|
||||
},
|
||||
[addItem, pendingHistoryItemRef, setPendingHistoryItem, config],
|
||||
[addItem, pendingHistoryItemRef, setPendingHistoryItem, config, setThought],
|
||||
);
|
||||
|
||||
const handleFinishedEvent = useCallback(
|
||||
@@ -637,6 +639,7 @@ export const useGeminiStream = (
|
||||
|
||||
if (!options?.isContinuation) {
|
||||
startNewPrompt();
|
||||
setThought(null); // Reset thought when starting a new prompt
|
||||
}
|
||||
|
||||
setIsResponding(true);
|
||||
|
||||
Reference in New Issue
Block a user