Skip to content

Conversation

Subash-Mohan
Copy link
Contributor

Description

Replacing base64 data with the URL of the newly created file in the image tool result.

How Has This Been Tested?

From UI and confirmed in the DB.

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

@Subash-Mohan Subash-Mohan requested a review from a team as a code owner June 28, 2025 10:25
Copy link

vercel bot commented Jun 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 28, 2025 10:25am

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Optimizes image handling in chat responses by replacing base64 data storage with URL references to saved files.

  • Introduces IndexedData and IndexedResult in file_store/utils.py to maintain order while saving multiple files concurrently
  • Adds cleaned_image_responses field to AnswerPostInfo model for storing optimized image URLs
  • Centralizes tool name constants in new constants.py file for better maintainability
  • Modifies image_generation_tool.py to support both URL and base64 formats based on configuration
  • Implements helper functions in process_message.py for separate handling of URL and base64 content

7 files reviewed, 2 comments
Edit PR Review Bot Settings | Greptile

Comment on lines +415 to +416
# Store cleaned image responses with URLs for later tool_result cleaning
cleaned_image_responses: list[Any] | None = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: This field should use a more specific type than 'Any' to ensure type safety. Consider creating a dedicated type/class for image responses or at minimum use a type like 'list[dict[str, str]]' to better document the expected structure.

Comment on lines +396 to +405
# Combine all tasks with their indices
funcs: list[
tuple[
Callable[[IndexedData | None, IndexedData | None], IndexedResult],
tuple[IndexedData | None, IndexedData | None],
]
] = [(save_file_indexed, (indexed_url, None)) for indexed_url in indexed_urls] + [
(save_file_indexed, (None, indexed_base64))
for indexed_base64 in indexed_base64_files
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Type hints for funcs could be simplified with type alias to improve readability

Copy link

This PR is stale because it has been open 75 days with no activity. Remove stale label or comment or this will be closed in 15 days.

@github-actions github-actions bot added the Stale label Sep 11, 2025
Copy link

This PR was closed because it has been stalled for 90 days with no activity.

@github-actions github-actions bot closed this Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants