mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
test(gateway): cover current-turn TTS media dedup
This commit is contained in:
parent
4dc9fb8008
commit
8f4122efd2
1 changed files with 39 additions and 0 deletions
|
|
@ -199,6 +199,45 @@ caption
|
|||
)
|
||||
assert paths == {old_path}
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"current_path",
|
||||
["/tmp/tts/current.ogg", "/tmp/tts/already-delivered.ogg"],
|
||||
)
|
||||
def test_non_streaming_dedup_scopes_tts_paths_to_prior_turns(
|
||||
self, current_path
|
||||
):
|
||||
from gateway.platforms.base import BasePlatformAdapter
|
||||
|
||||
old_path = "/tmp/tts/already-delivered.ogg"
|
||||
transcript = [
|
||||
{"role": "user", "content": "say the old message"},
|
||||
{"role": "assistant", "content": f"MEDIA:{old_path}"},
|
||||
{"role": "user", "content": "say the current message"},
|
||||
{
|
||||
"role": "assistant",
|
||||
"tool_calls": [
|
||||
{"id": "tts", "function": {"name": "text_to_speech"}}
|
||||
],
|
||||
},
|
||||
{
|
||||
"role": "tool",
|
||||
"tool_call_id": "tts",
|
||||
"content": f"[[audio_as_voice]]\\nMEDIA:{current_path}",
|
||||
},
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": f"[[audio_as_voice]]\\nMEDIA:{current_path}",
|
||||
},
|
||||
]
|
||||
adapter = MagicMock()
|
||||
adapter._session_store.peek_session_id.return_value = "session-id"
|
||||
adapter._session_store.load_transcript.return_value = transcript
|
||||
|
||||
paths = BasePlatformAdapter._history_media_paths_for_session(
|
||||
adapter, "session-key"
|
||||
)
|
||||
assert paths == {old_path}
|
||||
|
||||
def test_image_generate_not_reemitted_after_compression(self):
|
||||
"""End-to-end of the #46627 fix: collect history paths, then the
|
||||
compression-fallback rescan (history_offset stale) must dedup the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue