fix(frontend): next step impossible if no knowledge when creating brain if no onboarded (#2688)

# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
This commit is contained in:
Antoine Dewez 2024-06-18 17:40:58 +02:00 committed by GitHub
parent faaf9b6dba
commit b1684312eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View File

@ -124,11 +124,6 @@ export const BrainRecapStep = (): JSX.Element => {
await feed();
setIsBrainCreated(true);
}}
disabled={
knowledgeToFeed.length === 0 &&
!userIdentityData?.onboarded &&
!openedConnections.length
}
isLoading={creating}
important={true}
/>

View File

@ -5,6 +5,7 @@ import { useFromConnectionsContext } from "@/app/chat/[chatId]/components/Action
import { OpenedConnection } from "@/lib/api/sync/types";
import { MessageInfoBox } from "@/lib/components/ui/MessageInfoBox/MessageInfoBox";
import QuivrButton from "@/lib/components/ui/QuivrButton/QuivrButton";
import { useKnowledgeToFeedContext } from "@/lib/context/KnowledgeToFeedProvider/hooks/useKnowledgeToFeedContext";
import { createHandleGetButtonProps } from "@/lib/helpers/handleConnectionButtons";
import { useUserData } from "@/lib/hooks/useUserData";
@ -25,6 +26,7 @@ export const FeedBrainStep = (): JSX.Element => {
const [currentConnection, setCurrentConnection] = useState<
OpenedConnection | undefined
>(undefined);
const { knowledgeToFeed } = useKnowledgeToFeedContext();
useEffect(() => {
setCurrentConnection(
@ -96,6 +98,11 @@ export const FeedBrainStep = (): JSX.Element => {
iconName="chevronRight"
onClick={goToNextStep}
important={true}
disabled={
knowledgeToFeed.length === 0 &&
!userIdentityData?.onboarded &&
!openedConnections.length
}
/>
)}
</div>