mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
fix(gateway): preserve explicit send-image requests from session-wide MEDIA dedup
Closes #73771 The session-wide MEDIA dedup in (base.py) filtered ALL media paths against prior-turn history, including explicit MEDIA: tags the model deliberately included in its response text. When a user asked the agent to resend an image, the dedup silently swallowed it because that path already existed in the session transcript. The dedup is already handled correctly by the auto-append path in (run.py), which scopes its scan to the current turn and filters against via . The base.py filter was redundant for auto-appended tags and harmful for explicit ones. Fix: remove the dedup filter on in base.py while preserving the variable for the dedup (bare file paths, which lack run.py protection).
This commit is contained in:
parent
36f885573c
commit
7a83f44c4a
1 changed files with 8 additions and 10 deletions
|
|
@ -5859,17 +5859,15 @@ class BasePlatformAdapter(ABC):
|
|||
media_files, response = self.extract_media(response)
|
||||
media_files = self.filter_media_delivery_paths(media_files)
|
||||
|
||||
# Deduplicate against media already delivered in prior turns.
|
||||
# The model may echo a previous MEDIA: tag or bare file path in
|
||||
# a later response; without this guard the same file is sent
|
||||
# repeatedly.
|
||||
# Do NOT deduplicate MEDIA tags against prior turns here.
|
||||
# The auto-append path in GatewayRunner._run_agent_inner already
|
||||
# deduplicates auto-appended tags via _collect_auto_append_media_tags
|
||||
# with history_media_paths, so this filter would only catch explicit
|
||||
# MEDIA tags the model deliberately included in its response — which
|
||||
# must be preserved (user asked to resend an image, the model echoed
|
||||
# a path intentionally, etc.). Bare-file-path dedup still applies
|
||||
# to local_files below via the same _history_media_paths set.
|
||||
_history_media_paths = self._history_media_paths_for_session(session_key)
|
||||
if _history_media_paths:
|
||||
media_files = [
|
||||
(path, is_voice)
|
||||
for path, is_voice in media_files
|
||||
if path not in _history_media_paths
|
||||
]
|
||||
|
||||
# Extract image URLs and send them as native platform attachments
|
||||
images, text_content = self.extract_images(response)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue