-
Notifications
You must be signed in to change notification settings - Fork 4k
Implement basic URL scheme for Assistant & AI Search #3503
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 54c0db1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
This reverts commit 6d99b32.
So that the case of `q=` and `ask=` is handled correctly
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.
Code looks good to me. Maybe we should add couple more E2E tests for the behavior. for ex - type in search bar -> click Assistant icon -> should open the AI chat etc
@@ -5,6 +5,7 @@ import * as zustand from 'zustand'; | |||
import { AIMessageRole } from '@gitbook/api'; | |||
import * as React from 'react'; | |||
import { useTrackEvent } from '../Insights'; | |||
import { useSearch } from '../Search/useSearch'; |
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.
We should avoid nested imports. Export it from an index.ts
// Close the pop-over when we switch to “ask” mode | ||
React.useEffect(() => { | ||
if (state?.ask && open && aiMode === CustomizationAIMode.Assistant) { | ||
setSearchState((prev) => (prev ? { ...prev, open: false } : prev)); |
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.
Why do you need a conditional? Why can't it be just setSearchState(prev => ({ ...prev, open: false })
?q=
always dictates the search state?ask=
always dictates the AI Search / AI Assistant state.q=query&ask=true
→ask=query&q=null