Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable pdf viewer and download to skyvern download folder #1363

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

LawyZheng
Copy link
Collaborator

@LawyZheng LawyZheng commented Dec 10, 2024

Important

PDF files are now downloaded to a specified Skyvern directory, with browser preferences updated to disable in-browser viewing.

  • Behavior:
    • PDF files are now downloaded to the Skyvern download folder instead of being viewed in the browser.
    • initialize_download_dir() in browser_factory.py sets the download directory based on workflow and task IDs.
    • update_chromium_browser_preferences() in browser_factory.py modifies Chromium preferences to set download directories.
  • Files:
    • Adds chromium_preferences.json to define default browser preferences, including external PDF handling.
  • Functions:
    • Modifies _create_headless_chromium() and _create_headful_chromium() in browser_factory.py to use the new download directory and preferences.

This description was created by Ellipsis for c5ff494. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to c5ff494 in 2 minutes and 0 seconds

More details
  • Looked at 115 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. skyvern/webeye/browser_factory.py:284
  • Draft comment:
    Ensure that temporary directories created for user_data_dir and downloads_path are cleaned up after use to prevent disk space issues.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. skyvern/webeye/chromium_preferences.json:1
  • Draft comment:
    Consider adding validation for the JSON structure to ensure it is well-formed and handle potential parsing errors.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The JSON file is likely to be read by a JSON parser, which inherently checks for well-formedness. Adding additional validation might be redundant unless there is a specific reason to suspect the file could be malformed outside of typical JSON parsing. The comment does not provide specific evidence or context that suggests additional validation is needed beyond what a JSON parser would provide.
    I might be underestimating the potential for non-syntax-related issues, such as logical errors in the JSON structure that a parser wouldn't catch. However, the comment does not specify any such issues.
    Without specific evidence or context indicating a need for additional validation beyond syntax checking, the comment seems unnecessary. JSON parsers are reliable for syntax validation.
    The comment should be deleted as it suggests redundant validation that is typically handled by JSON parsers. There is no strong evidence provided that additional validation is necessary.

Workflow ID: wflow_GvstE97marA12tLv


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

preference_template = f"{SKYVERN_DIR}/webeye/chromium_preferences.json"

preference_file_content = ""
with open(preference_template, "r") as f:
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding error handling for file I/O operations when reading and writing the preferences file to prevent unhandled exceptions.

@LawyZheng LawyZheng merged commit 761a21e into main Dec 10, 2024
2 checks passed
@LawyZheng LawyZheng deleted the lawy/disable-pdf-viewer branch December 10, 2024 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant