[PR #31955] fix: dynamically update image URLs in agent_thoughts with valid signatures #33485

Open
opened 2026-02-21 20:53:22 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/31955

State: open
Merged: No


Fixes #31907.

Description

Currently, image URLs in agent_thoughts.thought and agent_thoughts.observation have static signatures that expire after ~10 minutes. This PR adds dynamic re-signing logic to these fields, consistent with how the answer field is handled in the Message model.

Changes

  • Added _re_sign_file_url helper and related properties (re_sign_file_url_thought, re_sign_file_url_observation) to MessageAgentThought model.
  • Updated AgentThought Pydantic schema to use these properties via validation_alias.

This is a more lightweight approach compared to other proposed fixes, focusing on the core issue of signature expiration in API responses.

Fixes #31907

**Original Pull Request:** https://github.com/langgenius/dify/pull/31955 **State:** open **Merged:** No --- Fixes #31907. ### Description Currently, image URLs in `agent_thoughts.thought` and `agent_thoughts.observation` have static signatures that expire after ~10 minutes. This PR adds dynamic re-signing logic to these fields, consistent with how the `answer` field is handled in the `Message` model. ### Changes - Added `_re_sign_file_url` helper and related properties (`re_sign_file_url_thought`, `re_sign_file_url_observation`) to `MessageAgentThought` model. - Updated `AgentThought` Pydantic schema to use these properties via `validation_alias`. This is a more lightweight approach compared to other proposed fixes, focusing on the core issue of signature expiration in API responses. Fixes #31907
yindo added the pull-request label 2026-02-21 20:53:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33485