mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-25 19:20:16 +00:00
fix: guard finalizeThinkingCard with session ID check (#1366)
Without this check, switching browser tabs while a stream is running causes finalizeThinkingCard() to operate on the wrong session's thinking card DOM — the card belongs to the stream that started it, not the session currently displayed in the tab. The guard ensures finalize only runs when the live assistant turn's session matches the current session. Co-authored-by: Josh <josh@fyul.link>
This commit is contained in:
@@ -4275,6 +4275,12 @@ function _thinkingMarkup(text=''){
|
||||
: `<div class="thinking"><div class="dot"></div><div class="dot"></div><div class="dot"></div></div>`;
|
||||
}
|
||||
function finalizeThinkingCard(){
|
||||
// Guard: only finalize thinking card if we're looking at the session that started it.
|
||||
// Without this check, switching tabs while a stream is running causes finalizeThinkingCard
|
||||
// to remove/modify the thinking card DOM of the wrong session — the card belongs to the
|
||||
// stream that started it, not the session currently displayed.
|
||||
const _guardTurn = $('liveAssistantTurn');
|
||||
if(_guardTurn && S.session && _guardTurn.dataset.sessionId !== S.session.session_id) return;
|
||||
if(!isSimplifiedToolCalling()){
|
||||
const row=$('thinkingRow');
|
||||
if(!row) return;
|
||||
|
||||
Reference in New Issue
Block a user