Skip to content

make copilot workflow image to rounded-circle border #658

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

Merged
merged 1 commit into from
May 12, 2025

Conversation

anish-work
Copy link
Contributor

@anish-work anish-work commented May 9, 2025

Q/A checklist

  • If you add new dependencies, did you update the lock file?
poetry lock --no-update
  • Run tests
ulimit -n unlimited && ./scripts/run-tests.sh
  • Do a self code review of the changes - Read the diff at least twice.
  • Carefully think about the stuff that might break because of this change - this sounds obvious but it's easy to forget to do "Go to references" on each function you're changing and see if it's used in a way you didn't expect.
  • The relevant pages still run when you press submit
  • The API for those pages still work (API tab)
  • The public API interface doesn't change if you didn't want it to (check API tab > docs page)
  • Do your UI changes (if applicable) look acceptable on mobile?
  • Ensure you have not regressed the import time unless you have a good reason to do so.
    You can visualize this using tuna:
python3 -X importtime -c 'import server' 2> out.log && tuna out.log

To measure import time for a specific library:

$ time python -c 'import pandas'

________________________________________________________
Executed in    1.15 secs    fish           external
   usr time    2.22 secs   86.00 micros    2.22 secs
   sys time    0.72 secs  613.00 micros    0.72 secs

To reduce import times, import libraries that take a long time inside the functions that use them instead of at the top of the file:

def my_function():
    import pandas as pd
    ...

Legal Boilerplate

Look, I get it. The entity doing business as “Gooey.AI” and/or “Dara.network” was incorporated in the State of Delaware in 2020 as Dara Network Inc. and is gonna need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Dara Network Inc can use, modify, copy, and redistribute my contributions, under its choice of terms.


Copy link

coderabbitai bot commented May 9, 2025

Walkthrough

The changes introduce a new mechanism for rendering images with either circular or rounded rectangular shapes based on workflow context. A constant list, CIRCLE_IMAGE_WORKFLOWS, is defined to specify workflows requiring circular images. The internal image rendering logic in the _render_header method of the BasePage class now checks if the current workflow is in this list and adjusts the image style accordingly by adding a borderRadius style. The function render_ai_generated_image_widget receives a new boolean parameter, is_circle_image, to determine the shape of the image container, and its CSS classes are set dynamically to either "rounded-circle" or "rounded". The helper function workflow_photo_div was removed. No public API signatures were otherwise altered.

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3bdde6 and fec6218.

📒 Files selected for processing (3)
  • daras_ai_v2/base.py (2 hunks)
  • widgets/workflow_image.py (2 hunks)
  • widgets/workflow_metadata_gen.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • widgets/workflow_metadata_gen.py
  • widgets/workflow_image.py
  • daras_ai_v2/base.py
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (python)
  • GitHub Check: test (3.10.12, 1.8.3)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@anish-work anish-work requested a review from devxpy May 9, 2025 11:11
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
widgets/workflow_image.py (1)

12-12: Add a blank line after import statement.

The import statement needs to be followed by a blank line to follow PEP 8 style guidelines.

from bots.models import Workflow
daras_ai_v2/base.py (2)

418-418: Remove trailing whitespace.

There is a trailing whitespace at the end of line 418 that needs to be removed.

-                ):  
+                ):
🧰 Tools
🪛 GitHub Actions: Python tests

[error] 418-418: Ruff formatting issue: trailing whitespace removed at line 418. Run 'ruff format' to fix.


422-431: Good implementation of conditional styling.

The code dynamically applies circular styling when appropriate. Consider using CSS classes instead of inline styles for better separation of concerns.

You could potentially refactor this to use CSS classes instead of inline styles, which would be more maintainable and consistent with how styling is applied in the render_ai_generated_image_widget function:

- imageStyles = dict(
-     maxWidth="150px",
-     height="150px",
-     margin=0,
-     minHeight="150px",
-     objectFit="cover",
- )
- if self.workflow in CIRCLE_IMAGE_WORKFLOWS:
-     imageStyles["borderRadius"] = "50%"
+ imageClasses = "workflow-image"
+ if self.workflow in CIRCLE_IMAGE_WORKFLOWS:
+     imageClasses += " rounded-circle"
+ else:
+     imageClasses += " rounded"

  gui.image(
      src=pr.photo_url,
-     style=imageStyles,
+     className=imageClasses,
  )

This would require adding appropriate CSS classes in your stylesheet.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd44b58 and bef900b.

📒 Files selected for processing (3)
  • daras_ai_v2/base.py (2 hunks)
  • widgets/workflow_image.py (2 hunks)
  • widgets/workflow_metadata_gen.py (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
widgets/workflow_image.py (1)
bots/models/workflow.py (1)
  • Workflow (189-252)
🪛 GitHub Actions: Python tests
widgets/workflow_image.py

[error] 13-13: Ruff formatting issue: extra blank line added at line 13. Run 'ruff format' to fix.

daras_ai_v2/base.py

[error] 418-418: Ruff formatting issue: trailing whitespace removed at line 418. Run 'ruff format' to fix.

🔇 Additional comments (7)
widgets/workflow_image.py (2)

14-14: Looks good - constant defining workflows with circular images.

Defining a constant for workflows requiring circular images is a clean approach.


35-35: Successfully implements conditional circular styling.

The code correctly passes the workflow context to determine image shape.

daras_ai_v2/base.py (2)

377-378: Good approach importing the constant.

Importing the constant from the workflow_image module ensures consistent styling.


434-435: Properly applies the styling to the image element.

The image now correctly uses the dynamic styling.

widgets/workflow_metadata_gen.py (3)

15-15: Good addition of the is_circle_image parameter.

Adding an optional boolean parameter with a default value maintains backward compatibility.


43-48: Excellent implementation of conditional CSS classes.

The code cleanly applies either "rounded-circle" or "rounded" classes based on the workflow type.


51-51: Successfully applies the dynamic class names.

The className attribute now correctly uses the conditional classes.

@devxpy
Copy link
Member

devxpy commented May 9, 2025

tests not passing

@anish-work anish-work force-pushed the rounded_worflow_image branch from bef900b to a3bdde6 Compare May 10, 2025 10:14
@anish-work anish-work force-pushed the rounded_worflow_image branch from a3bdde6 to fec6218 Compare May 12, 2025 11:19
@anish-work anish-work merged commit 9affacb into master May 12, 2025
8 checks passed
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.

2 participants