Skip to content

Conversation

@anish-work
Copy link
Contributor

@anish-work anish-work commented Jul 4, 2025

Q/A checklist

  • I have tested my UI changes on mobile and they look acceptable
  • I have tested changes to the workflows in both the API and the UI
  • I have done a code review of my changes and looked at each line of the diff + the references of each function I have changed
  • My changes have not increased the import time of the server
How to check import time?

time python -c 'import server'

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.


@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 4, 2025

📝 Walkthrough

Walkthrough

Adds a new RecipeTabs.preview tab and a preview_route, registers PREVIEW_ROUTE_WORKFLOWS, and integrates preview into routing and UI. daras_ai_v2/base.py: introduces NAV_TABS_CSS and INPUT_OUTPUT_COLS_CSS, updates tab rendering/styling (responsive scrolling, active-lg indicator), treats preview like run for two-column input/output layout, conditionally hides input or output on large screens, adjusts header/social button logic, and redirects submits to preview for workflows in PREVIEW_ROUTE_WORKFLOWS. daras_ai_v2/meta_content.py: refactors robots_tag_for_page to a match on page.tab and adds explicit handling for RecipeTabs.preview. recipes/VideoBots.py: inserts the Preview tab, shows demo header buttons on Run and Preview, and updates running-output scroll target. routers/root.py: adds preview_route, PREVIEW_ROUTE_WORKFLOWS, and a RecipeTabs.preview enum member; adjusts some tab titles.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–25 minutes

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch preview_tab_mobile

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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 force-pushed the preview_tab_mobile branch from ad0ea84 to 72ff56c Compare July 4, 2025 14:48
Copy link
Contributor

@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)
recipes/VideoBots.py (1)

1482-1483: Refactor the comparison for better readability.

The logic is correct but can be improved as suggested by static analysis.

Apply this diff to use the in operator:

-        if self.tab == RecipeTabs.run or self.tab == RecipeTabs.preview:
+        if self.tab in (RecipeTabs.run, RecipeTabs.preview):
daras_ai_v2/base.py (2)

480-480: Refactor to use 'in' operator for better readability.

Consider using the in operator for cleaner code:

-            if self.tab != RecipeTabs.run and self.tab != RecipeTabs.preview:
+            if self.tab not in (RecipeTabs.run, RecipeTabs.preview):

1839-1844: Good implementation with minor style improvement needed.

The conditional styling logic correctly implements the preview functionality. Consider using a dict literal for better performance:

-            style=dict(position="sticky", top="0.5rem"),
+            style={"position": "sticky", "top": "0.5rem"},
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0ffb603 and 72ff56c.

📒 Files selected for processing (4)
  • daras_ai_v2/base.py (6 hunks)
  • daras_ai_v2/meta_content.py (1 hunks)
  • recipes/VideoBots.py (1 hunks)
  • routers/root.py (3 hunks)
🧰 Additional context used
🪛 Pylint (3.3.7)
recipes/VideoBots.py

[refactor] 1482-1482: Consider merging these comparisons with 'in' by using 'self.tab in (RecipeTabs.run, RecipeTabs.preview)'. Use a set instead if elements are hashable.

(R1714)

daras_ai_v2/base.py

[refactor] 480-480: Consider merging these comparisons with 'in' by using 'self.tab not in (RecipeTabs.run, RecipeTabs.preview)'. Use a set instead if elements are hashable.

(R1714)


[refactor] 1840-1840: Consider using '{"position": 'sticky', "top": '0.5rem'}' instead of a call to 'dict'.

(R1735)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test (3.10.12, 1.8.3)
🔇 Additional comments (11)
daras_ai_v2/meta_content.py (1)

223-228: LGTM! Consistent implementation of preview tab meta tag logic.

The new preview tab cases correctly mirror the existing run tab logic, maintaining consistency in SEO handling between the two tabs.

recipes/VideoBots.py (1)

1487-1487: LGTM! Preview tab correctly inserted into tabs list.

The preview tab is properly positioned as the second tab after run, which makes logical sense for the user experience.

routers/root.py (3)

595-605: LGTM! Preview route correctly implemented.

The new preview route follows the established pattern for tab routes and properly delegates to render_recipe_page with the preview tab.


842-842: LGTM! Title simplifications improve consistency.

Removing the responsive span wrappers simplifies the tab titles and maintains consistency with the new preview tab implementation.

Also applies to: 862-862


836-840: No action required: ‘mobile-only-recipe-tab’ CSS rules are present

The mobile-only-recipe-tab selector is already defined in daras_ai_v2/base.py around lines 383 and 399, toggling its display on mobile vs. desktop:

  • Lines 383–385:
    & a:has(span.mobile-only-recipe-tab) {
      display: block !important;
    }
  • Lines 399–401:
    @media (min-width: 768px) {
      & a:has(span.mobile-only-recipe-tab) {
        display: none !important;
      }
    }
daras_ai_v2/base.py (6)

382-412: LGTM! Well-implemented responsive CSS for preview tab functionality.

The CSS additions properly handle the responsive behavior for the new preview tab, including mobile-only visibility controls, horizontal scrollable tabs, and special active state styling for large screens.


420-430: LGTM! Correct implementation of conditional tab styling.

The tab rendering logic properly adds the "active-lg" class to the run tab when the current tab is preview, enabling the CSS styling for the preview mode visual feedback.


1204-1204: LGTM! Correct pattern matching for preview and run tabs.

The update properly handles both run and preview tabs with the same rendering logic, which is appropriate for the preview functionality.


1766-1787: LGTM! Proper implementation of input form hiding in preview mode.

The conditional visibility logic correctly hides the input form on large screens when the current tab is preview, maintaining the appropriate responsive behavior for the preview functionality.


2536-2536: LGTM! Well-defined constant for preview route workflows.

The constant is properly defined and allows for easy extension to other workflows that should support preview route behavior.


2537-2548: LGTM! Simplified and focused CSS styling.

The OUTPUT_TABS_CSS has been appropriately simplified and updated to support the new preview tab functionality with proper responsive styling.

@anish-work anish-work requested a review from devxpy July 7, 2025 14:29
@anish-work anish-work force-pushed the preview_tab_mobile branch from ca313bd to c653f47 Compare July 9, 2025 08:35
Comment on lines 1955 to 1958
if self.workflow in PREVIEW_ROUTE_WORKFLOWS:
raise gui.RedirectException(pr.get_app_url())
else:
raise gui.RedirectException(pr.get_app_url())
Copy link
Member

Choose a reason for hiding this comment

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

???

Copy link
Contributor Author

Choose a reason for hiding this comment

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

was unintended, removed now..

@devxpy devxpy self-assigned this Jul 13, 2025
@anish-work anish-work requested a review from devxpy July 14, 2025 06:09
@anish-work anish-work force-pushed the preview_tab_mobile branch from 806e9f5 to 5e89f66 Compare July 17, 2025 07:04
@devxpy
Copy link
Member

devxpy commented Aug 8, 2025

can you merge pls

@devxpy devxpy assigned anish-work and unassigned devxpy Aug 8, 2025
@anish-work
Copy link
Contributor Author

can you merge pls

@devxpy done

Copy link
Contributor

@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: 1

🧹 Nitpick comments (1)
routers/root.py (1)

891-892: Consider making PREVIEW_ROUTE_WORKFLOWS immutable.

Since this is a module-level constant that shouldn't be modified at runtime, consider using a tuple instead of a list for immutability.

-PREVIEW_ROUTE_WORKFLOWS = [Workflow.VIDEO_BOTS]
+PREVIEW_ROUTE_WORKFLOWS = (Workflow.VIDEO_BOTS,)
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5e89f66 and 42abe9e.

📒 Files selected for processing (4)
  • daras_ai_v2/base.py (10 hunks)
  • daras_ai_v2/meta_content.py (1 hunks)
  • recipes/VideoBots.py (2 hunks)
  • routers/root.py (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • recipes/VideoBots.py
  • daras_ai_v2/meta_content.py
🧰 Additional context used
🧬 Code Graph Analysis (2)
daras_ai_v2/base.py (2)
recipes/VideoBotsStats.py (1)
  • current_app_url (75-81)
routers/root.py (1)
  • RecipeTabs (894-938)
routers/root.py (2)
bots/models/workflow.py (1)
  • Workflow (189-257)
routers/account.py (1)
  • TabData (246-248)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test (3.10.12, 1.8.3)
  • GitHub Check: Analyze (python)
🔇 Additional comments (6)
routers/root.py (1)

586-596: LGTM! Preview route follows established patterns.

The new preview route is well-implemented and consistent with other route handlers in the file.

daras_ai_v2/base.py (5)

451-456: Consider clarifying the active tab UI logic.

The current implementation shows the Run tab as active on large screens when the Preview tab is selected. This could be confusing for users as it creates an inconsistency between what's actually active and what appears active.

Consider either:

  1. Making the Preview tab visible on all screen sizes when it's active
  2. Adding a comment explaining why this UX pattern was chosen
  3. Using a different visual indicator for this special case

1962-1967: LGTM! Clean implementation of preview route redirect.

The conditional redirect logic properly routes workflows to the preview tab when they're in PREVIEW_ROUTE_WORKFLOWS.


410-443: Well-structured responsive CSS for tab navigation.

The CSS properly handles:

  • Horizontal scrolling for tabs on mobile
  • Hiding mobile-only tabs on larger screens
  • Active state styling for the preview/run tab relationship

1812-1813: LGTM! Proper conditional visibility for preview mode.

The conditional CSS classes correctly hide/show input and output columns based on the preview tab state and workflow membership in PREVIEW_ROUTE_WORKFLOWS.

Also applies to: 1884-1889


2617-2639: Cleaner and more maintainable CSS structure.

The simplified OUTPUT_TABS_CSS with proper responsive breakpoints and clearer padding/margin rules improves maintainability.

Copy link
Contributor

@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 (1)
daras_ai_v2/base.py (1)

395-407: Improve the tab rendering logic for better maintainability.

The logic for determining when to show the active-lg indicator is complex and could be simplified. The current implementation creates a conditional force_active_lg element based on whether the current tab is preview and the loop tab is run.

Consider refactoring this logic for better readability:

-                if tab == RecipeTabs.run and self.tab == RecipeTabs.preview:
-                    force_active_lg = gui.tag("span", className="active-lg")
-                else:
-                    force_active_lg = gui.dummy()
-                with force_active_lg, gui.nav_item(url, active=tab == self.tab):
+                should_force_active = tab == RecipeTabs.run and self.tab == RecipeTabs.preview
+                with gui.nav_item(url, active=tab == self.tab):
+                    if should_force_active:
+                        with gui.tag("span", className="active-lg"):
+                            gui.html(tab.title)
+                    else:
+                        gui.html(tab.title)
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 42abe9e and 71a4e29.

📒 Files selected for processing (2)
  • daras_ai_v2/base.py (10 hunks)
  • routers/root.py (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • routers/root.py
🧰 Additional context used
🧬 Code Graph Analysis (1)
daras_ai_v2/base.py (2)
recipes/VideoBotsStats.py (1)
  • current_app_url (75-81)
routers/root.py (1)
  • RecipeTabs (894-938)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (python)
  • GitHub Check: test (3.10.12, 1.8.3)
🔇 Additional comments (9)
daras_ai_v2/base.py (9)

92-93: LGTM!

The import of PREVIEW_ROUTE_WORKFLOWS is correctly placed and follows proper import organization.


425-425: LGTM!

The condition correctly excludes both run and preview tabs from the zero-margin title block, maintaining consistent UI behavior.


602-602: LGTM!

The extension of social button rendering to include the preview tab maintains UI consistency between run and preview modes.


1166-1166: LGTM!

Using pattern matching with the union operator correctly treats both run and preview tabs the same way for the two-column layout.


1753-1776: LGTM!

The conditional hiding of the input column on large screens when the tab is preview provides a clean responsive design. The logic correctly preserves all other functionality while adding the responsive behavior.


1828-1834: LGTM!

The responsive hiding logic for the output column correctly shows/hides based on the tab and workflow type, maintaining a good user experience across different screen sizes.


1907-1911: LGTM!

The redirect logic correctly routes to the preview tab for workflows in PREVIEW_ROUTE_WORKFLOWS, providing a seamless user experience for preview-enabled workflows.


2561-2633: LGTM!

The CSS definitions are well-structured and provide good responsive behavior:

  1. INPUT_OUTPUT_COLS_CSS properly handles the two-column layout with appropriate padding and background styling
  2. NAV_TABS_CSS includes comprehensive responsive navigation styling with horizontal scrolling on mobile and proper active state indicators

The CSS follows best practices with proper media queries and maintains visual consistency across devices.


1194-1199: Consistent CSS class naming verified

All OUTPUT_TABS_CSS references have been removed and replaced with INPUT_OUTPUT_COLS_CSS, and no occurrences of the old constant remain in the codebase. No further changes are needed.

@anish-work anish-work merged commit 20877f3 into master Aug 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.

3 participants