mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-07-16 12:40:18 +00:00
fix: clear fallback smd media tail
This commit is contained in:
committed by
nesquena-hermes
parent
ca3a1ac04d
commit
547c218ddf
+3
-3
@@ -4094,9 +4094,9 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
|
||||
_smdParser=null;
|
||||
_smdWrittenLen=0;
|
||||
_smdWrittenText='';
|
||||
// Clear the per-parser MEDIA tail buffer — any incomplete MEDIA
|
||||
// prefix the parser was holding is no longer relevant.
|
||||
if(typeof _smdMediaTailClear==='function') _smdMediaTailClear(null);
|
||||
// Clear the fallback MEDIA tail buffer too; fallback chunks are keyed
|
||||
// by __SMD_PARSER_FALLBACK, not null.
|
||||
if(typeof _smdMediaTailClear==='function') _smdMediaTailClear(__SMD_PARSER_FALLBACK);
|
||||
}
|
||||
function _scheduleStreamingKatex(){
|
||||
if(_streamingKatexTimer) return;
|
||||
|
||||
@@ -247,6 +247,15 @@ class TestSmdMediaInStream(unittest.TestCase):
|
||||
"concurrent streams don't cross-pollinate",
|
||||
)
|
||||
|
||||
def test_smd_end_parser_clears_fallback_media_tail(self):
|
||||
# Greptile re-review: parserFor falls back to __SMD_PARSER_FALLBACK,
|
||||
# so stream-end cleanup must clear that sentinel key, not null.
|
||||
idx = MESSAGES_JS.index("function _smdEndParser")
|
||||
block = MESSAGES_JS[idx:idx + 1200]
|
||||
self.assertIn("_smdMediaTailClear(_smdParser)", block)
|
||||
self.assertIn("_smdMediaTailClear(__SMD_PARSER_FALLBACK)", block)
|
||||
self.assertNotIn("_smdMediaTailClear(null)", block)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import unittest
|
||||
|
||||
Reference in New Issue
Block a user