Skip to content
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

[#3571] update dialogflow configuration form #3576

Merged
merged 6 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion docs/docs/api/endpoints/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Uninstall an existing component.

```json
{
"name": "airy-enterprise/dialogflow-connector"
"name": "airy-enterprise/enterprise-dialogflow-connector"
}
```

Copy link
Contributor Author

Choose a reason for hiding this comment

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

docs fix

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export const getSourcesInfo = (): SourceInfo[] => {
componentName: 'enterprise-dialogflow-connector',
repository: 'airy-enterprise',
itemInfoString: 'connectors',
docs: 'https://dialogflow.cloud.google.com/cx/projects',
docs: 'https://airy.co/docs/enterprise/apps/dialogflow/deployment',
},
{
type: Source.zendesk,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this docs link would more useful to the user for the integration with airy

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,15 @@ const ConnectorConfig = (props: ConnectorConfigProps) => {
let payload: UpdateComponentConfigurationRequestPayload;

if (connector === Source.dialogflow) {
const [projectId, appCredentials, suggestionConfidenceLevel, replyConfidenceLevel] = args;
const [
projectId,
appCredentials,
suggestionConfidenceLevel,
replyConfidenceLevel,
processorWaitingTime,
processorCheckPeriod,
defaultLanguage,
] = args;

payload = {
components: [
Expand All @@ -137,6 +145,9 @@ const ConnectorConfig = (props: ConnectorConfigProps) => {
dialogflowCredentials: appCredentials,
suggestionConfidenceLevel: suggestionConfidenceLevel,
replyConfidenceLevel: replyConfidenceLevel,
connectorStoreMessagesProcessorMaxWaitMillis: processorWaitingTime,
connectorStoreMessagesProcessorCheckPeriodMillis: processorCheckPeriod,
connectorDefaultLanguage: defaultLanguage,
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ type ConnectNewDialogflowProps = {
projectId: string,
appCredentials: string,
suggestionConfidenceLevel: string,
replyConfidenceLevel: string
replyConfidenceLevel: string,
processorWaitingTime: string,
processorCheckPeriod: string,
defaultLanguage: string
) => void;
isEnabled: boolean;
isConfigured: boolean;
Expand All @@ -26,6 +29,13 @@ export const ConnectNewDialogflow = ({createNewConnection, isEnabled, isConfigur
);
const [replyConfidenceLevel, setReplyConfidenceLevel] = useState(componentInfo?.replyConfidenceLevel || '');
const [isUpdateModalVisible, setIsUpdateModalVisible] = useState(false);
const [processorWaitingTime, setProcessorWaitingTime] = useState(
componentInfo?.connectorStoreMessagesProcessorMaxWaitMillis || '5000'
);
const [processorCheckPeriod, setProcessorCheckPeriod] = useState(
componentInfo?.connectorStoreMessagesProcessorCheckPeriodMillis || '2500'
);
const [defaultLanguage, setDefaultLanguage] = useState(componentInfo?.connectorDefaultLanguage || 'en');

const {t} = useTranslation();

Expand All @@ -39,7 +49,15 @@ export const ConnectNewDialogflow = ({createNewConnection, isEnabled, isConfigur
};

const enableSubmitConfigData = () => {
createNewConnection(projectID, appCredentials, suggestionConfidenceLevel, replyConfidenceLevel);
createNewConnection(
projectID,
appCredentials,
suggestionConfidenceLevel,
replyConfidenceLevel,
processorWaitingTime,
processorCheckPeriod,
defaultLanguage
);
};

return (
Expand All @@ -48,7 +66,15 @@ export const ConnectNewDialogflow = ({createNewConnection, isEnabled, isConfigur
isUpdateModalVisible={isUpdateModalVisible}
setIsUpdateModalVisible={setIsUpdateModalVisible}
enableSubmitConfigData={enableSubmitConfigData}
disabled={!projectID || !appCredentials || !suggestionConfidenceLevel || !replyConfidenceLevel}
disabled={
!projectID ||
!appCredentials ||
!suggestionConfidenceLevel ||
!replyConfidenceLevel ||
!processorWaitingTime ||
!processorCheckPeriod ||
!defaultLanguage
}
isConfigured={isConfigured}
updateConfig={updateConfig}
>
Expand Down Expand Up @@ -119,6 +145,51 @@ export const ConnectNewDialogflow = ({createNewConnection, isEnabled, isConfigur
fontClass="font-base"
/>
</div>
<div className={styles.formRow}>
<Input
type="number"
name="ProcessorWaitingTime"
value={processorWaitingTime}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setProcessorWaitingTime(e.target.value)}
label={t('processorWaitingTime')}
placeholder={t('processorWaitingTime')}
showLabelIcon
tooltipText={t('waitingDefault')}
required
height={32}
fontClass="font-base"
/>
</div>
<div className={styles.formRow}>
<Input
type="number"
name="processorCheckPeriod"
value={processorCheckPeriod}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setProcessorCheckPeriod(e.target.value)}
label={t('processorCheckPeriod')}
placeholder={t('processorCheckPeriod')}
showLabelIcon
tooltipText={t('checkDefault')}
required
height={32}
fontClass="font-base"
/>
</div>
<div className={styles.formRow}>
<Input
type="text"
name="DefaultLanguage"
value={defaultLanguage}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setDefaultLanguage(e.target.value)}
label={t('defaultLanguage')}
placeholder={t('defaultLanguage')}
showLabelIcon
tooltipText={t('defaultLanguageTooltip')}
required
height={32}
fontClass="font-base"
/>
</div>
</ConnectNewForm>
);
};
24 changes: 24 additions & 0 deletions lib/typescript/translations/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,12 @@ const resources = {
amountSuggestions: 'amount for suggestions',
amountReplies: 'amount for replies',
to: 'to',
processorWaitingTime: 'Processor waiting time',
processorCheckPeriod: 'Processor check period',
waitingDefault: 'Default value: 5000',
checkDefault: 'Default value: 2500',
defaultLanguage: 'Default language',
defaultLanguageTooltip: 'Default value: en',

//Salesforce
salesforceDescription:
Expand Down Expand Up @@ -723,6 +729,12 @@ const resources = {
fromCloudConsole: 'gegeben von der Cloud Console',
amountSuggestions: 'Anzahl der Vorschläge',
amountReplies: 'Anzahl der Antworten',
processorWaitingTime: 'Prozessor Wartezeit',
processorCheckPeriod: 'Prozessorprüfungszeitraum',
waitingDefault: 'Standardwert: 5000',
checkDefault: 'Standardwert: 2500',
defaultLanguage: 'Standardsprache',
defaultLanguageTooltip: 'Standardwert: en',

//Salesforce
salesforceDescription:
Expand Down Expand Up @@ -1125,6 +1137,12 @@ const resources = {
amountSuggestions: 'niveau pour les suggestions',
amountReplies: 'niveau pour les réponses',
to: 'à',
processorWaitingTime: 'Délai du processeur',
processorCheckPeriod: 'Délai de vérification du processeur',
waitingDefault: 'valeur par défaut: 5000',
checkDefault: 'valeur par défaut: 2500',
defaultLanguage: 'Langue utilisée',
defaultLanguageTooltip: 'valeur par défaut: en',

//Salesforce
salesforceDescription: 'Augmentez vos performances commerciales avec la plateforme CRM n° 1 au monde.',
Expand Down Expand Up @@ -1562,6 +1580,12 @@ const resources = {
fromCloudConsole: 'dado por la Cloud Console',
amountSuggestions: 'nivel para sugerencias',
amountReplies: 'nivel para respuestas',
processorWaitingTime: 'Tiempo de espera del procesador',
processorCheckPeriod: 'Período de verificación del procesador',
waitingDefault: 'valor por defecto: 5000',
checkDefault: 'valor por defecto: 2500',
defaultLanguage: 'Idioma por defecto',
defaultLanguageTooltip: 'valor por defecto: en',

//Salesforce
salesforceDescription: 'Aumente sus resultados de ventas con la plataforma de CRM n.º 1 del mundo.',
Expand Down