Skip to content

Conversation

@NatanTechofNY
Copy link

@NatanTechofNY NatanTechofNY commented Nov 10, 2025

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

This PR adds support for the new suggestedQuestions parameter introduced in DocSearch v4.3, which allows users to enable or disable suggested questions in the Ask AI interface. Additionally, it updates the DocSearch dependency from ^4.1.0 to ^4.3.2 to support this new feature while maintaining backward compatibility with DocSearch v3.9+.

The suggestedQuestions option provides users with pre-configured questions they can click to quickly get started with Ask AI, improving the user experience when using the Ask AI feature.

Test Plan

Code Changes

  1. Type Definitions (packages/docusaurus-theme-search-algolia/src/theme-search-algolia.d.ts):

    • Added suggestedQuestions?: boolean to the AskAiConfig type
    • Maintained backward compatibility with DocSearch v3.9+
  2. Validation Schema (packages/docusaurus-theme-search-algolia/src/validateThemeConfig.ts):

    • Added suggestedQuestions: Joi.boolean().optional() validation
    • Ensures type safety at runtime
  3. Unit Tests (packages/docusaurus-theme-search-algolia/src/__tests__/validateThemeConfig.test.ts):

    • ✅ Added test for suggestedQuestions: true
    • ✅ Added test for suggestedQuestions: false
    • ✅ Added test to reject invalid string type
    • ✅ Added test to reject invalid number type
  4. Component Updates:

    • Updated SearchBar/index.tsx and useAlgoliaAskAi.ts with proper type handling
    • Added type assertions to ensure compatibility across DocSearch versions
  5. Documentation (website/docs/search.mdx and website/versioned_docs/version-3.9.2/search.mdx):

    • Updated Ask AI configuration examples to show suggestedQuestions parameter
    • Added inline comments explaining the feature
  6. Dependency Update (packages/docusaurus-theme-search-algolia/package.json):

    • Updated from "@docsearch/react": "^3.9.0 || ^4.1.0"
    • Updated to "@docsearch/react": "^3.9.0 || ^4.3.2"

Manual Testing

To test the new feature:

export default {
  themeConfig: {
    algolia: {
      appId: 'YOUR_APP_ID',
      apiKey: 'YOUR_API_KEY',
      indexName: 'YOUR_INDEX_NAME',
      askAi: {
        assistantId: 'YOUR_ASSISTANT_ID',
        suggestedQuestions: true, // Enable suggested questions
      },
    },
  },
};

Backward Compatibility

Fully backward compatible with:

  • DocSearch v3.9 (without Ask AI)
  • DocSearch v4.0-4.2 (with Ask AI, without suggested questions)
  • DocSearch v4.3+ (with Ask AI and suggested questions)

Screenshots

v4.3.2 includes the following new features:

  • Stop a streaming answer
  • Fix for copy button
  • New kebab menu on Ask AI screen which includes 2 new options: Conversation History and Start New Conversation.
  • New screen for "Conversation History" from the Ask AI view
  • New screen for "Start New Conversation" from Ask AI view
  • This screen will show any suggested questions users might want to ask.
Screenshot 2025-11-10 at 12 42 57 PM Screenshot 2025-11-10 at 12 42 28 PM Screenshot 2025-11-10 at 12 42 23 PM Screenshot 2025-11-10 at 12 42 18 PM Screenshot 2025-11-11 at 12 26 33 PM

Test links

Deploy preview: https://deploy-preview-11541--docusaurus-2.netlify.app/

@meta-cla
Copy link

meta-cla bot commented Nov 10, 2025

Hi @NatanTechofNY!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@netlify
Copy link

netlify bot commented Nov 10, 2025

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 35a8683
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/69136ebdb539d800080adab4
😎 Deploy Preview https://deploy-preview-11541--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@meta-cla
Copy link

meta-cla bot commented Nov 10, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla bot added the CLA Signed Signed Facebook CLA label Nov 10, 2025
@NatanTechofNY NatanTechofNY changed the title feat(theme-search-algolia): add support for v4.3.1 of DocSearch and new Suggested Questions feat(theme-search-algolia): add support for DocSearch v4.3.2 and new Suggested Questions Nov 10, 2025
@NatanTechofNY NatanTechofNY marked this pull request as draft November 10, 2025 18:51
@NatanTechofNY NatanTechofNY marked this pull request as ready for review November 11, 2025 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant