Skip to content

Commit bb1156c

Browse files
bamaboyNimJay
authored andcommitted
fix(samples/resource): fix intent creation (#104)
1 parent 5df6066 commit bb1156c

File tree

1 file changed

+45
-37
lines changed

1 file changed

+45
-37
lines changed

dialogflow/resource.js

Lines changed: 45 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -400,16 +400,18 @@ function createIntents(projectId) {
400400
];
401401

402402
// The intent to be created.
403-
const pizzaIntent = {
404-
displayName: 'Pizza',
405-
events: ['order_pizza'],
406-
// Webhook is disabled because we are not ready to call the webhook yet.
407-
webhookState: 'WEBHOOK_STATE_DISABLED',
408-
trainingPhrases: pizzaPhrases,
409-
mlEnabled: true,
410-
priority: 500000,
411-
result: pizzaResult,
412-
};
403+
const pizzaIntent = Object.assign(
404+
{
405+
displayName: 'Pizza',
406+
events: ['order_pizza'],
407+
// Webhook is disabled because we are not ready to call the webhook yet.
408+
webhookState: 'WEBHOOK_STATE_DISABLED',
409+
trainingPhrases: pizzaPhrases,
410+
mlEnabled: true,
411+
priority: 500000,
412+
},
413+
pizzaResult
414+
);
413415

414416
const pizzaRequest = {
415417
parent: agentPath,
@@ -520,15 +522,17 @@ function createIntents(projectId) {
520522
},
521523
];
522524

523-
const changeDeliveryAddressIntent = {
524-
displayName: 'ChangeDeliveryAddress',
525-
webhookState: 'WEBHOOK_STATE_DISABLED',
526-
trainingPhrases: changeDeliveryAddressPhrases,
527-
inputContexts: changeDeliveryAddressInputContexts,
528-
mlEnabled: true,
529-
priority: 500000,
530-
result: changeDeliveryAddressResult,
531-
};
525+
const changeDeliveryAddressIntent = Object.assign(
526+
{
527+
displayName: 'ChangeDeliveryAddress',
528+
webhookState: 'WEBHOOK_STATE_DISABLED',
529+
trainingPhrases: changeDeliveryAddressPhrases,
530+
inputContexts: changeDeliveryAddressInputContexts,
531+
mlEnabled: true,
532+
priority: 500000,
533+
},
534+
changeDeliveryAddressResult
535+
);
532536

533537
const changeDeliveryAddressRequest = {
534538
parent: agentPath,
@@ -598,15 +602,17 @@ function createIntents(projectId) {
598602
{type: 'EXAMPLE', parts: [{text: 'place order'}]},
599603
];
600604

601-
const placeOrderIntent = {
602-
displayName: 'PlaceOrder',
603-
webhookState: 'WEBHOOK_STATE_ENABLED',
604-
trainingPhrases: placeOrderPhrases,
605-
inputContexts: placeOrderInputContexts,
606-
mlEnabled: true,
607-
priority: 500000,
608-
result: placeOrderResult,
609-
};
605+
const placeOrderIntent = Object.assign(
606+
{
607+
displayName: 'PlaceOrder',
608+
webhookState: 'WEBHOOK_STATE_ENABLED',
609+
trainingPhrases: placeOrderPhrases,
610+
inputContexts: placeOrderInputContexts,
611+
mlEnabled: true,
612+
priority: 500000,
613+
},
614+
placeOrderResult
615+
);
610616

611617
const placeOrderRequest = {
612618
parent: agentPath,
@@ -642,15 +648,17 @@ function createIntents(projectId) {
642648
{type: 'EXAMPLE', parts: [{text: "I don't want it any more"}]},
643649
];
644650

645-
const cancelOrderIntent = {
646-
displayName: 'CancelOrder',
647-
webhookState: 'WEBHOOK_STATE_DISABLED',
648-
trainingPhrases: cancelOrderPhrases,
649-
inputContexts: cancelOrderInputContexts,
650-
mlEnabled: true,
651-
priority: 500000,
652-
result: cancelOrderResult,
653-
};
651+
const cancelOrderIntent = Object.assign(
652+
{
653+
displayName: 'CancelOrder',
654+
webhookState: 'WEBHOOK_STATE_DISABLED',
655+
trainingPhrases: cancelOrderPhrases,
656+
inputContexts: cancelOrderInputContexts,
657+
mlEnabled: true,
658+
priority: 500000,
659+
},
660+
cancelOrderResult
661+
);
654662

655663
const cancelOrderRequest = {
656664
parent: agentPath,

0 commit comments

Comments
 (0)