Skip to content

[WEB-4440] Add Open in ChatGPT button to right sidebar #2654

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 2 commits into from
Jun 13, 2025

Conversation

jamiehenson
Copy link
Member

@jamiehenson jamiehenson commented Jun 9, 2025

Adds an "Open in ChatGPT" button to the right-hand nav sidebar in docs with the prompt "Tell me more about Ably's X feature from Y for Z" where

  • X is the name of the feature
  • Y is the docs page describing the feature (we can update this to a Markdown resource later when that functionality is ready - currently in the works by @kennethkalmer)
  • Z is the targeted programming language, only appended if applicable (it wouldn't be on the Chat index page, for instance)

Review link (with example page): https://ably-docs-web-4440-gpt--8g8gqj.herokuapp.com/docs/chat/rooms/message-reactions

Screenshot 2025-06-11 at 17 40 25

Summary by CodeRabbit

  • New Features

    • Added an "Open in ChatGPT" external link in the sidebar, allowing users to quickly generate prompts based on the current page.
  • Style

    • Updated the border styling for sidebar external links for improved visual consistency.

Copy link

coderabbitai bot commented Jun 9, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes update the "@ably/ui" dependency version in package.json and refactor the externalLinks function in RightSidebar.tsx. The refactor simplifies conditional logic, updates language extraction, adjusts border rendering for external links, and adds a new "Open in ChatGPT" external link.

Changes

File(s) Change Summary
package.json Updated "@ably/ui" dependency from version 17.1.0 to 17.2.1.
src/components/Layout/RightSidebar.tsx Refactored externalLinks function, changed language extraction, updated border logic, and added "Open in ChatGPT" external link.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant RightSidebar
    participant ExternalLinks

    User->>RightSidebar: Render sidebar
    RightSidebar->>ExternalLinks: Call externalLinks(activePage)
    ExternalLinks-->>RightSidebar: Return array of links (includes "Open in ChatGPT")
    RightSidebar->>User: Render external links with updated borders
Loading

Assessment against linked issues

Objective Addressed Explanation
Miscellaneous chores & fixes for June 2025 (WEB-4440)

Poem

In June, the code received a tweak,
A sidebar link for those who seek,
ChatGPT now joins the crew,
With borders fresh and logic new.
Dependencies hopped to the latest,
This rabbit’s work is never the greatest—
But always swift and neat! 🐇✨


🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

@ably-ci ably-ci temporarily deployed to ably-docs-web-4440-gpt--8g8gqj June 9, 2025 09:53 Inactive
@jamiehenson jamiehenson temporarily deployed to ably-docs-web-4440-gpt--8g8gqj June 11, 2025 16:40 Inactive
@jamiehenson jamiehenson changed the title [WEB-4440] temp: experiment with open chatgpt button in docs sidebar [WEB-4440] Add Open in ChatGPT button to right sidebar Jun 11, 2025
@jamiehenson jamiehenson marked this pull request as ready for review June 11, 2025 16:43
@jamiehenson jamiehenson temporarily deployed to ably-docs-web-4440-gpt--8g8gqj June 11, 2025 16:44 Inactive
@jamiehenson
Copy link
Member Author

@coderabbitai review

Copy link

coderabbitai bot commented Jun 11, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

🧹 Nitpick comments (2)
src/components/Layout/RightSidebar.tsx (2)

35-38: Early return is 👍 – but drop the now-unused variable

githubEditPath is declared before the guard but never used when activePage is falsy.
Declare it after the guard to avoid an unnecessary binding (and satisfy strict-lint rules like @typescript-eslint/no-unnecessary-init).


51-52: Guard against undefined languages

activePage.languages is assumed to exist. If the type allows undefined, this will throw. Consider a safer check:

const hasLanguages = Array.isArray(activePage.languages) && activePage.languages.length > 0;
const language = hasLanguages ? activePage.language : null;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f08e00b and 0dda364.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • package.json (1 hunks)
  • src/components/Layout/RightSidebar.tsx (3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/components/Layout/RightSidebar.tsx (1)
src/data/languages/index.ts (1)
  • languageInfo (16-16)
🔇 Additional comments (3)
package.json (1)

42-45: Verify that the @ably/ui minor bump has no breaking side-effects

@ably/ui jumped from 17.1.017.2.1.
Even minor releases can introduce changed exports or stricter peer-dependency ranges. Before merging, run the visual regression tests / Storybook and a production build to ensure components (especially Icon, cn, heights utils) still tree-shake correctly and no styling regressions slip in.

src/components/Layout/RightSidebar.tsx (2)

62-64: Double-check the ChatGPT deep-link format

The link uses https://chatgpt.com/?q=…. The public interface commonly expects https://chat.openai.com/?q= (or prompt= depending on A/B experiments). A quick manual test is recommended to confirm the URL pre-fills the prompt as intended.


258-260: Border switch is correct

Switching from “bottom border on first item” to “top border on subsequent items” aligns with the surrounding card pattern and fixes the missing divider when items overflow. Looks good.

@jamiehenson jamiehenson temporarily deployed to ably-docs-web-4440-gpt--8g8gqj June 11, 2025 16:53 Inactive
@jamiehenson jamiehenson requested review from m-hulbert and a team June 11, 2025 16:58
Copy link
Contributor

@aralovelace aralovelace left a comment

Choose a reason for hiding this comment

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

yey! more AI-integrated experience 🚀

Copy link
Contributor

@m-hulbert m-hulbert left a comment

Choose a reason for hiding this comment

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

This is a really nice quick addition!

I saw you added the language that was being viewed, but In the interest of providing additional context, I think it might be worth including the product as well (e.g. Tell me more about Ably Chat's X). I had some slightly confusing results viewing history in Chat as it was pulling some info from Pub/Sub for example that wasn't relevant.

You can also get some weird results if you navigate to a page with a query param set for a language that doesn't support that feature, but I think that's potentially unavoidable.

@jamiehenson
Copy link
Member Author

Thanks @m-hulbert - we have access to a page's product so can work that in.

As for the query param, I think we can do something around that - the query param overrides the language, but we also know the languages supported by a page, so we can adjust the condition so that we only include the language part of the prompt if the param either isn't there or lines up with a valid lang on the page.

@jamiehenson jamiehenson temporarily deployed to ably-docs-web-4440-gpt--8g8gqj June 13, 2025 11:11 Inactive
@jamiehenson jamiehenson temporarily deployed to ably-docs-web-4440-gpt--8g8gqj June 13, 2025 13:42 Inactive
@jamiehenson jamiehenson merged commit a1ffa12 into main Jun 13, 2025
6 checks passed
@jamiehenson jamiehenson deleted the web-4440-gpt-link branch June 13, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants