Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,26 @@ export const GetStartedNextSteps: React.FC<GetStartedProps> = (props) => {
};

const updateLuisSettings = (newLuisSettings) => {
setSettings(projectId, {
setSettings(rootBotProjectId, {
...mergedSettings,
luis: { ...mergedSettings.luis, ...newLuisSettings },
});
};

const updateQNASettings = (newQNASettings) => {
setSettings(projectId, {
setSettings(rootBotProjectId, {
...mergedSettings,
qna: { ...mergedSettings.qna, ...newQNASettings },
});
};

const linkToPackageManager = `/bot/${projectId}/plugin/package-manager/package-manager`;
const linkToConnections = `/bot/${projectId}/botProjectsSettings/#connections`;
const linkToPublishProfile = `/bot/${projectId}/botProjectsSettings/#addNewPublishProfile`;
const linkToLUISSettings = `/bot/${projectId}/botProjectsSettings/#luisKey`;
const linktoQNASettings = `/bot/${projectId}/botProjectsSettings/#qnaKey`;
const linkToLGEditor = `/bot/${projectId}/language-generation`;
const linkToLUEditor = `/bot/${projectId}/language-understanding`;
const linkToPackageManager = `/bot/${rootBotProjectId}/plugin/package-manager/package-manager`;
const linkToConnections = `/bot/${rootBotProjectId}/botProjectsSettings/#connections`;
const linkToPublishProfile = `/bot/${rootBotProjectId}/botProjectsSettings/#addNewPublishProfile`;
const linkToLUISSettings = `/bot/${rootBotProjectId}/botProjectsSettings/#luisKey`;
const linktoQNASettings = `/bot/${rootBotProjectId}/botProjectsSettings/#qnaKey`;
const linkToLGEditor = `/bot/${rootBotProjectId}/language-generation`;
const linkToLUEditor = `/bot/${rootBotProjectId}/language-understanding`;

useEffect(() => {
const newNextSteps: NextSteps[] = [];
Expand Down
17 changes: 7 additions & 10 deletions Composer/packages/client/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { NeutralColors, SharedColors, FontSizes, CommunicationColors } from '@ui
import { useRecoilValue } from 'recoil';
import { FontWeights } from 'office-ui-fabric-react/lib/Styling';
import { Panel, PanelType } from 'office-ui-fabric-react/lib/Panel';
import { BotIndexer } from '@bfc/indexers';
import { TeachingBubble } from 'office-ui-fabric-react/lib/TeachingBubble';

import { useLocation } from '../utils/hooks';
Expand All @@ -26,12 +25,11 @@ import {
botDisplayNameState,
localeState,
currentProjectIdState,
rootBotProjectIdSelector,
settingsState,
webChatEssentialsSelector,
isWebChatPanelVisibleState,
dialogsWithLuProviderSelectorFamily,
luFilesSelectorFamily,
qnaFilesSelectorFamily,
allRequiredRecognizersSelector,
} from '../recoilModel';
import composerIcon from '../images/composerIcon.svg';
import { AppUpdaterStatus } from '../constants';
Expand Down Expand Up @@ -155,6 +153,7 @@ const calloutDescription = css`
export const Header = () => {
const { setAppUpdateShowing, setLocale } = useRecoilValue(dispatcherState);
const projectId = useRecoilValue(currentProjectIdState);
const rootBotProjectId = useRecoilValue(rootBotProjectIdSelector) || projectId;
const projectName = useRecoilValue(botDisplayNameState(projectId));
const locale = useRecoilValue(localeState(projectId));
const appUpdate = useRecoilValue(appUpdateState);
Expand All @@ -176,11 +175,9 @@ export const Header = () => {
// These are needed to determine if the bot needs LUIS or QNA
// this data is passed into the GetStarted widget
// ... if the get started widget moves, this code should too!
const dialogs = useRecoilValue(dialogsWithLuProviderSelectorFamily(projectId));
const luFiles = useRecoilValue(luFilesSelectorFamily(projectId));
const qnaFiles = useRecoilValue(qnaFilesSelectorFamily(projectId));
const requiresLUIS = BotIndexer.shouldUseLuis(dialogs, luFiles);
const requiresQNA = BotIndexer.shouldUseQnA(dialogs, qnaFiles);
const requiredStuff = useRecoilValue(allRequiredRecognizersSelector);
const requiresLUIS = requiredStuff.filter((p) => p.requiresLUIS)?.length ? true : false;
Comment thread
benbrown marked this conversation as resolved.
Outdated
const requiresQNA = requiredStuff.filter((p) => p.requiresQNA)?.length ? true : false;
Comment thread
benbrown marked this conversation as resolved.
Outdated
// ... end of get started stuff

const isShow = useBotControllerBar();
Expand Down Expand Up @@ -413,7 +410,7 @@ export const Header = () => {
) : null}
<GetStarted
isOpen={showGetStarted}
projectId={projectId}
projectId={rootBotProjectId}
requiresLUIS={requiresLUIS}
requiresQNA={requiresQNA}
showTeachingBubble={showGetStartedTeachingBubble}
Expand Down
18 changes: 18 additions & 0 deletions Composer/packages/client/src/recoilModel/selectors/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
} from '../atoms';
import {
dialogsSelectorFamily,
botAssetsSelectFamily,
buildEssentialsSelector,
lgImportsSelectorFamily,
luImportsSelectorFamily,
Expand Down Expand Up @@ -370,3 +371,20 @@ export const webChatEssentialsSelector = selector({
};
},
});

export const allRequiredRecognizersSelector = selector({
key: 'allRequiredRecognizersSelector',
get: ({ get }) => {
const ids = get(botProjectIdsState);
return ids.reduce((result: { projectId: string; requiresLUIS: boolean; requiresQNA: boolean }[], id: string) => {
const botAssets = get(botAssetsSelectFamily(id));
if (botAssets) {
const { dialogs, luFiles, qnaFiles } = botAssets;
const requiresLUIS = BotIndexer.shouldUseLuis(dialogs, luFiles);
const requiresQNA = BotIndexer.shouldUseQnA(dialogs, qnaFiles);
result.push({ projectId: id, requiresLUIS, requiresQNA });
}
return result;
}, []);
},
});