-
Notifications
You must be signed in to change notification settings - Fork 265
Bring in kapa ai widget to docs site #1305
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
Conversation
✅ Deploy Preview for docs-optimism ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
📝 WalkthroughWalkthroughThe pull request introduces changes to two files: Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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)
theme.config.tsx (1)
44-86
: Consider using CSS modules instead of inline styles.The footer implementation would be more maintainable using CSS modules or styled-components instead of inline styles. This would improve code readability and reusability.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
package.json
(1 hunks)theme.config.tsx
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Redirect rules - docs-optimism
- GitHub Check: Header rules - docs-optimism
- GitHub Check: Pages changed - docs-optimism
- GitHub Check: pr-workflow
🔇 Additional comments (3)
theme.config.tsx (2)
33-40
: LGTM! Well-structured navbar integration.The navbar implementation with the "Ask AI" button is clean and properly integrated with the Kapa widget configuration.
127-135
: LGTM! Comprehensive meta tags implementation.The meta tags implementation follows SEO best practices with proper OpenGraph and Twitter card integration.
package.json (1)
26-26
: Verify the @remixicon/react package version.Let's check for any security advisories and ensure we're using a stable version.
✅ Verification successful
@remixicon/react version is appropriate and secure
The package is using the latest available version (4.6.0) with no known security vulnerabilities.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for security advisories and latest version curl -s "https://registry.npmjs.org/@remixicon/react" | jq '.["dist-tags"].latest' # Check for known vulnerabilities gh api graphql -f query=' { securityVulnerabilities(first: 5, ecosystem: NPM, package: "@remixicon/react") { nodes { advisory { summary severity publishedAt } vulnerableVersionRange } } }'Length of output: 385
There was a problem hiding this 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)
theme.config.tsx (2)
149-149
: Consider increasing the max-tokens limit.The current max-tokens limit of 100 might be too restrictive for comprehensive responses, especially for complex technical questions about Optimism's documentation.
Consider increasing the limit to 500-1000 tokens for more detailed responses:
- data-max-tokens='100' + data-max-tokens='500'
144-145
: Consider enhancing the modal disclaimer and examples.The modal disclaimer and example questions could be more comprehensive to better guide users.
Consider updating the content:
- data-modal-disclaimer='This is a custom LLM for OPLabs with access to [all help center documentation](https://docs.optimism.io/).' - data-modal-example-questions='What is the OP Stack?, How do I get started with Supersim?, How do I create a SuperERC20 token?, How do I get faucet funds?' + data-modal-disclaimer='This AI assistant is trained on Optimism documentation and can help answer your technical questions. For the latest information, always refer to [our official documentation](https://docs.optimism.io/).' + data-modal-example-questions='What is the OP Stack and its components?, How do I deploy and test a contract on Optimism?, What are the steps to bridge assets to Optimism?, How do I integrate Optimism into my dApp?'
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
theme.config.tsx
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: pr-workflow
- GitHub Check: Redirect rules - docs-optimism
- GitHub Check: Header rules - docs-optimism
- GitHub Check: Pages changed - docs-optimism
🔇 Additional comments (2)
theme.config.tsx (2)
33-39
: LGTM! Well-structured AI button implementation.The custom Ask AI button is well-implemented with clear styling and proper icon integration.
136-151
:⚠️ Potential issueSecurity and configuration improvements needed.
Several configuration values in the Kapa.ai widget script should be moved to environment variables for better security and maintainability.
Apply this diff:
<script async src='https://widget.kapa.ai/kapa-widget.bundle.js' data-website-id={process.env.NEXT_PUBLIC_KAPA_WEBSITE_ID} - data-project-name='OP Labs' - data-project-color='#FF0420' - data-modal-title='Optimism Docs Assistant ✨' - data-project-logo='https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR8nhCmw7cu6jVQI01JFtMAV5tkTNLJXMSAOg&s' + data-project-name={process.env.NEXT_PUBLIC_KAPA_PROJECT_NAME} + data-project-color={process.env.NEXT_PUBLIC_KAPA_PROJECT_COLOR} + data-modal-title={process.env.NEXT_PUBLIC_KAPA_MODAL_TITLE} + data-project-logo={process.env.NEXT_PUBLIC_KAPA_PROJECT_LOGO} data-modal-disclaimer='This is a custom LLM for OPLabs with access to [all help center documentation](https://docs.optimism.io/).' data-modal-example-questions='What is the OP Stack?, How do I get started with Supersim?, How do I create a SuperERC20 token?, How do I get faucet funds?' data-user-analytics-fingerprint-enabled='true' data-modal-override-open-id='custom-ask-ai-button' data-button-hide='true' - data-max-tokens='100' + data-max-tokens={process.env.NEXT_PUBLIC_KAPA_MAX_TOKENS || '100'} data-modal-theme='dark' ></script>Likely invalid or redundant comment.
There was a problem hiding this 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
♻️ Duplicate comments (1)
theme.config.tsx (1)
136-149
:⚠️ Potential issueEnhance security and privacy compliance of the Kapa.ai widget.
Several improvements are needed:
- Move more configuration values to environment variables
- Consider privacy implications of fingerprinting
Apply these changes:
<script async src='https://widget.kapa.ai/kapa-widget.bundle.js' data-website-id={process.env.NEXT_PUBLIC_KAPA_WEBSITE_ID} - data-project-name='OP Labs' - data-project-color='#FF0420' + data-project-name={process.env.NEXT_PUBLIC_KAPA_PROJECT_NAME} + data-project-color={process.env.NEXT_PUBLIC_KAPA_PROJECT_COLOR} data-modal-title='Optimism Docs Assistant ✨' - data-project-logo='https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR8nhCmw7cu6jVQI01JFtMAV5tkTNLJXMSAOg&s' + data-project-logo={process.env.NEXT_PUBLIC_KAPA_PROJECT_LOGO} data-modal-example-questions='What is the OP Stack?, How do I get started with Supersim?, How do I create a SuperERC20 token?, How do I get faucet funds?' - data-user-analytics-fingerprint-enabled='true' + data-user-analytics-fingerprint-enabled={process.env.NEXT_PUBLIC_KAPA_ANALYTICS_ENABLED} data-modal-override-open-id='custom-ask-ai-button' data-button-hide='true' - data-max-tokens='100' + data-max-tokens={process.env.NEXT_PUBLIC_KAPA_MAX_TOKENS || '100'} ></script>
🧹 Nitpick comments (3)
theme.config.tsx (3)
35-38
: Enhance accessibility and maintainability of the Ask AI button.Consider these improvements:
- Add aria-label for screen readers
- Extract inline styles to maintain consistency
- <button id='custom-ask-ai-button' className='nx-flex nx-gap-2 nx-items-center nx-py-1.5 nx-px-3 nx-rounded-lg nx-text-sm nx-font-semibold' style={{ backgroundColor: '#FF0420', color: 'white', display: 'flex', alignItems: 'center', gap: '4px' }}> + <button + id='custom-ask-ai-button' + aria-label="Open AI Assistant" + className='nx-flex nx-gap-2 nx-items-center nx-py-1.5 nx-px-3 nx-rounded-lg nx-text-sm nx-font-semibold ask-ai-button'> <span>Ask AI</span> <RiSparkling2Fill size={14} /> </button>
127-134
: Enhance social sharing metadata.The default description "Optimism Docs for developers" could be more specific and engaging.
<meta property='og:url' content={url} /> <meta property='og:title' content={frontMatter.title || 'Optimism Docs'} /> - <meta property='og:description' content={frontMatter.description || 'Optimism Docs for developers'} /> + <meta property='og:description' content={frontMatter.description || 'Learn how to build and deploy on Optimism - comprehensive guides, tutorials, and API references for developers.'} /> <meta property='og:image' content='https://docs.optimism.io/logos/docs-header.png' /> <meta name='twitter:card' content='summary_large_image' /> <meta name='twitter:title' content={frontMatter.title || 'Optimism Docs'} /> - <meta name='twitter:description' content={frontMatter.description || 'Optimism Docs for developers'} /> + <meta name='twitter:description' content={frontMatter.description || 'Learn how to build and deploy on Optimism - comprehensive guides, tutorials, and API references for developers.'} />
28-28
: Enhance the SDK deprecation announcement banner.The banner could benefit from better styling and accessibility.
- text: <a href='/builders/notices/sdk-deprecation'>🎉 We are deprecating the Optimism SDK and migrating all tutorials to use viem/op-stack. Read more →</a> + text: ( + <a + href='/builders/notices/sdk-deprecation' + className="nx-flex nx-items-center nx-gap-2 hover:nx-underline" + aria-label="Read more about SDK deprecation" + > + <span role="img" aria-label="Celebration">🎉</span> + We are deprecating the Optimism SDK and migrating all tutorials to use viem/op-stack. Read more → + </a> + )
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
theme.config.tsx
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Redirect rules - docs-optimism
- GitHub Check: Header rules - docs-optimism
- GitHub Check: Pages changed - docs-optimism
- GitHub Check: pr-workflow
Bringing in Kapa.ai to the docs site