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 6 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
577d22a
First pass to add OrchSkillDialog to local skills
taicchoumsft Apr 30, 2021
5c2bd6b
Merge branch 'main' into tachou/orchLocalSkillDialog
taicchoumsft Apr 30, 2021
5e182d7
Rename Orchestractor to Orchestrator
taicchoumsft Apr 30, 2021
4f5991f
Merge branch 'main' into tachou/orchLocalSkillDialog
taicchoumsft Apr 30, 2021
912419b
Merge branch 'main' into tachou/orchLocalSkillDialog
taicchoumsft Apr 30, 2021
0976f11
Merge branch 'main' into tachou/orchLocalSkillDialog
cwhitten Apr 30, 2021
f8d973d
update package to 4.13.1
taicchoumsft Apr 30, 2021
744d2ce
Merge branch 'tachou/orchLocalSkillDialog' of https://github.com/micr…
taicchoumsft Apr 30, 2021
ed9fe92
Address PR comments
taicchoumsft Apr 30, 2021
507b0e4
Use string constants where possible
taicchoumsft Apr 30, 2021
d980894
Rename Orchestrator component
taicchoumsft Apr 30, 2021
53df210
Fix another typo
taicchoumsft Apr 30, 2021
d86dcf1
Merge branch 'main' into tachou/orchLocalSkillDialog
taicchoumsft Apr 30, 2021
02063aa
Change link to bf-orchestrator
taicchoumsft Apr 30, 2021
3d6c7ba
Merge branch 'tachou/orchLocalSkillDialog' of https://github.com/micr…
taicchoumsft Apr 30, 2021
d41e3c5
Merge branch 'main' into tachou/orchLocalSkillDialog
taicchoumsft Apr 30, 2021
82558e5
Link and copy changes per PM and Design
taicchoumsft May 1, 2021
0a55178
add unit test
taicchoumsft May 2, 2021
9d35094
Merge branch 'main' into tachou/orchLocalSkillDialog
taicchoumsft May 2, 2021
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
@@ -1,62 +1,79 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import React, { useState } from 'react';
import formatMessage from 'format-message';
import { Link } from 'office-ui-fabric-react/lib/Link';
import { Checkbox } from 'office-ui-fabric-react/lib/Checkbox';
import { Stack, StackItem } from 'office-ui-fabric-react/lib/Stack';
import { PrimaryButton, DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { useRecoilValue } from 'recoil';

import { dispatcherState } from '../../recoilModel';
import { enableOrchestratorDialog } from '../../constants';

import { importOrchestractor } from './helper';

const learnMoreUrl = 'https://aka.ms/bf-composer-docs-publish-bot';

export const Orchestractor = (props) => {
const { projectId, onSubmit, onBack } = props;
const [enableOrchestrator, setEnableOrchestrator] = useState(true);
const { setApplicationLevelError, reloadProject } = useRecoilValue(dispatcherState);
const onChange = (ev, check) => {
setEnableOrchestrator(check);
};
return (
<Stack>
<StackItem styles={{ root: { height: 300, width: '60%' } }}>
<div style={{ marginBottom: '16px' }}>
{enableOrchestratorDialog.content}
<Link href={learnMoreUrl} target="_blank">
<div>{formatMessage('Learn more about Orchestractor')}</div>
</Link>
</div>
<Checkbox
defaultChecked
label={formatMessage('Make Orchestrator my preferred recognizer for multi-bot projects')}
styles={{ root: { margin: '20px 0' } }}
onChange={onChange}
/>
</StackItem>
<Stack horizontal horizontalAlign="space-between">
<DefaultButton text={formatMessage('Back')} onClick={onBack} />
<span>
<DefaultButton styles={{ root: { marginRight: '8px' } }} text={formatMessage('Skip')} onClick={onSubmit} />
<PrimaryButton
text={formatMessage('Continue')}
onClick={(event) => {
onSubmit(event, enableOrchestrator);
if (enableOrchestrator) {
// TODO. show notification
// download orchestrator first
importOrchestractor(projectId, reloadProject, setApplicationLevelError);
// TODO. update notification
}
}}
/>
</span>
</Stack>
</Stack>
);
};
// Copyright (c) Microsoft Corporation.
Comment thread
hatpick marked this conversation as resolved.
// Licensed under the MIT License.

import React, { useState } from 'react';
import formatMessage from 'format-message';
import { Link } from 'office-ui-fabric-react/lib/Link';
import { Checkbox } from 'office-ui-fabric-react/lib/Checkbox';
import { Stack, StackItem } from 'office-ui-fabric-react/lib/Stack';
import { PrimaryButton, DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { useRecoilValue } from 'recoil';

import { dispatcherState } from '../../recoilModel';
import { enableOrchestratorDialog } from '../../constants';

import { importOrchestrator } from './helper';

const learnMoreUrl = 'https://aka.ms/bf-composer-docs-publish-bot';
Comment thread
hatpick marked this conversation as resolved.
Outdated

interface OrchestratorProps {
Comment thread
hatpick marked this conversation as resolved.
Outdated
projectId: string;
onSubmit: (event: any, userSelected?: boolean) => Promise<void>;
onBack: (event: any) => void;
Comment thread
hatpick marked this conversation as resolved.
Outdated
hideBackButton?: boolean;
}

const Orchestrator: React.FC<OrchestratorProps> = (props) => {
const { projectId, onSubmit, onBack } = props;
const [enableOrchestrator, setEnableOrchestrator] = useState(true);
const { setApplicationLevelError, reloadProject } = useRecoilValue(dispatcherState);
const onChange = (ev, check) => {
setEnableOrchestrator(check);
};
return (
<Stack>
<StackItem styles={{ root: { height: 300, width: '60%' } }}>
<div style={{ marginBottom: '16px' }}>
{enableOrchestratorDialog.content}
<Link href={learnMoreUrl} target="_blank">
<div>{formatMessage('Learn more about Orchestractor')}</div>
</Link>
</div>
<Checkbox
defaultChecked
label={formatMessage('Make Orchestrator my preferred recognizer for multi-bot projects')}
styles={{ root: { margin: '20px 0' } }}
onChange={onChange}
/>
</StackItem>
<Stack horizontal horizontalAlign="space-between">
<Stack.Item>
{!props.hideBackButton && <DefaultButton text={formatMessage('Back')} onClick={onBack} />}
Comment thread
hatpick marked this conversation as resolved.
Outdated
</Stack.Item>
<Stack.Item align="end">
<span>
Comment thread
hatpick marked this conversation as resolved.
Outdated
<DefaultButton styles={{ root: { marginRight: '8px' } }} text={formatMessage('Skip')} onClick={onSubmit} />
<PrimaryButton
text={formatMessage('Continue')}
onClick={(event) => {
onSubmit(event, enableOrchestrator);
if (enableOrchestrator) {
// TODO. show notification
Comment thread
hatpick marked this conversation as resolved.
Outdated
// download orchestrator first
importOrchestrator(projectId, reloadProject, setApplicationLevelError);
// TODO. update notification
}
}}
/>
</span>
</Stack.Item>
</Stack>
</Stack>
);
};

Orchestrator.defaultProps = {
Comment thread
hatpick marked this conversation as resolved.
Outdated
hideBackButton: false,
};

export { OrchestratorProps, Orchestrator };
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import luWorker from '../../recoilModel/parsers/luWorker';
import { localeState, dispatcherState } from '../../recoilModel';
import { recognizersSelectorFamily } from '../../recoilModel/selectors/recognizers';

import { Orchestractor } from './Orchestractor';
import { Orchestrator } from './Orchestrator';

const detailListContainer = css`
width: 100%;
Expand Down Expand Up @@ -248,7 +248,7 @@ export const SelectIntent: React.FC<SelectIntentProps> = (props) => {
return (
<Fragment>
{showOrchestratorDialog ? (
<Orchestractor
<Orchestrator
projectId={projectId}
onBack={() => {
onUpdateTitle(selectIntentDialog.ADD_OR_EDIT_PHRASE(dialogId, manifest.name));
Expand Down Expand Up @@ -313,10 +313,10 @@ export const SelectIntent: React.FC<SelectIntentProps> = (props) => {
onClick={(ev) => {
if (pageIndex === 1) {
if (hasOrchestrator) {
// skip orchestractor modal
// skip orchestrator modal
handleSubmit(ev, true);
} else {
// show orchestractor
// show orchestrator
onUpdateTitle(enableOrchestratorDialog);
setShowOrchestratorDialog(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const conflictConfirmationPrompt = formatMessage(
'This operation will overwrite changes made to previously imported files. Do you want to proceed?'
);

export const importOrchestractor = async (projectId: string, reloadProject, setApplicationLevelError) => {
export const importOrchestrator = async (projectId: string, reloadProject, setApplicationLevelError) => {
const reqBody = {
package: 'Microsoft.Bot.Builder.AI.Orchestrator',
version: '4.13.0',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { DialogTypes, DialogWrapper } from '@bfc/ui-shared/lib/components/DialogWrapper';
import { SDKKinds } from '@botframework-composer/types';
import formatMessage from 'format-message';
import React, { useMemo } from 'react';
import { useRecoilState, useRecoilValue } from 'recoil';

import {
designPageLocationState,
dispatcherState,
localeState,
orchestratorForSkillsDialogState,
rootBotProjectIdSelector,
} from '../../recoilModel';
import { recognizersSelectorFamily } from '../../recoilModel/selectors/recognizers';
import { Orchestrator } from '../AddRemoteSkillModal/Orchestrator';

export const OrchestratorForSkillsDialog = (props) => {
Comment thread
hatpick marked this conversation as resolved.
Outdated
const [showOrchestratorDialog, setShowOrchestratorDialog] = useRecoilState(orchestratorForSkillsDialogState);
const rootProjectId = useRecoilValue(rootBotProjectIdSelector) || '';
const { dialogId } = useRecoilValue(designPageLocationState(rootProjectId));
const locale = useRecoilValue(localeState(rootProjectId));
const curRecognizers = useRecoilValue(recognizersSelectorFamily(rootProjectId));

const { updateRecognizer } = useRecoilValue(dispatcherState);

const hasOrchestrator = useMemo(() => {
const fileName = `${dialogId}.${locale}.lu.dialog`;
return curRecognizers.some((f) => f.id === fileName && f.content.$kind === SDKKinds.OrchestratorRecognizer);
}, [curRecognizers, dialogId, locale]);

const handleOrchestratorSubmit = async (event: any, enable?: boolean) => {
event.preventDefault();
if (enable) {
// update recognizor type to orchestrator
await updateRecognizer(rootProjectId, dialogId, SDKKinds.OrchestratorRecognizer);
}
setShowOrchestratorDialog(false);
};

const isVisible = () => {
Comment thread
hatpick marked this conversation as resolved.
Outdated
if (showOrchestratorDialog) {
if (hasOrchestrator) {
setShowOrchestratorDialog(false);
return false;
}
return true;
}
return false;
};

const onDismissHandler = (event: any) => {
setShowOrchestratorDialog(false);
};

return (
<DialogWrapper
dialogType={DialogTypes.CreateFlow}
isOpen={isVisible()}
subText={formatMessage('Enable Orchestrator as the recognizer at the root level to add this skill')}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: a better message to explain would be something like:
In order to add this skill, you must enable Orchestrator as the recognizer at the root level bot.
(check with UX folks)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will leave this to UX, but found that these strings were declared in constants for the remote skill flow, switched to those here.

title={formatMessage('Enable Orchestrator')}
onDismiss={onDismissHandler}
>
<Orchestrator
hideBackButton
projectId={rootProjectId}
onBack={() => {
Comment thread
hatpick marked this conversation as resolved.
Outdated
setShowOrchestratorDialog(false);
}}
onSubmit={handleOrchestratorSubmit}
/>
</DialogWrapper>
);
};
3 changes: 3 additions & 0 deletions Composer/packages/client/src/pages/design/Modals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { undoFunctionState } from '../../recoilModel/undo/history';
import { CreationFlowStatus } from '../../constants';
import { RepairSkillModalOptionKeys } from '../../components/RepairSkillModal';
import { createQnAOnState, exportSkillModalInfoState } from '../../recoilModel/atoms/appState';
import { OrchestratorForSkillsDialog } from '../../components/Orchestrator/OrchestratorForSkillsDialog';

import CreationModal from './creationModal';

Expand Down Expand Up @@ -170,6 +171,8 @@ const Modals: React.FC<ModalsProps> = ({ projectId = '' }) => {
onSubmit={handleCreateQnA}
/>

<OrchestratorForSkillsDialog />

{displaySkillManifestNameIdentifier && (
<DisplayManifestModal
skillNameIdentifier={displaySkillManifestNameIdentifier}
Expand Down
5 changes: 5 additions & 0 deletions Composer/packages/client/src/recoilModel/atoms/appState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ export const warnAboutDotNetState = atom<boolean>({
default: false,
});

export const orchestratorForSkillsDialogState = atom<boolean>({
key: getFullyQualifiedKey('orchestratorForSkillsDialogState'),
default: false,
});

export const warnAboutFunctionsState = atom<boolean>({
key: getFullyQualifiedKey('warnAboutFunctionsState'),
default: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
warnAboutDotNetState,
warnAboutFunctionsState,
settingsState,
orchestratorForSkillsDialogState,
} from '../atoms';
import { botRuntimeOperationsSelector, rootBotProjectIdSelector } from '../selectors';
import { mergePropertiesManagedByRootBot, postRootBotCreation } from '../../recoilModel/dispatchers/utils/project';
Expand Down Expand Up @@ -166,6 +167,7 @@ export const projectDispatcher = () => {
set(botProjectIdsState, (current) => [...current, projectId]);
await dispatcher.addLocalSkillToBotProjectFile(projectId);
navigateToSkillBot(rootBotProjectId, projectId, mainDialog);
callbackHelpers.set(orchestratorForSkillsDialogState, true);
} catch (ex) {
handleProjectFailure(callbackHelpers, ex);
} finally {
Expand Down