This repository was archived by the owner on Jun 30, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-16
lines changed
templates/Virtual-Assistant-Template/typescript
generator-botbuilder-assistant/generators/skill/templates/sample-skill/src/dialogs
samples/sample-skill/src/dialogs Expand file tree Collapse file tree 2 files changed +19
-16
lines changed Original file line number Diff line number Diff line change @@ -249,15 +249,16 @@ export class MainDialog extends RouterDialog {
249249 protected async populateStateFromSemanticAction ( context : TurnContext ) : Promise < void > {
250250 // Example of populating local state with data passed through semanticAction out of Activity
251251 // const activity: Activity = context.activity;
252- // const semanticAction: SemanticAction | undefined = activity.semanticAction;
253-
254- // if (semanticAction != null && semanticAction.Entities.ContainsKey("location"))
255- // {
256- // var location = semanticAction.Entities["location"];
257- // var locationObj = location.Properties["location"].ToString();
258- // // Add to your local state
259- // var state = await _stateAccessor.GetAsync(context, () => new SkillState());
260- // state.CurrentCoordinates = locationObj;
252+ // const semanticAction: SemanticAction | undefined = activity.semanticAction;
253+
254+ // if (semanticAction !== undefined && Object.keys(semanticAction.entities)
255+ // .find((key: string) => key === "location")) {
256+ // // tslint:disable-next-line: no-explicit-any
257+ // const location: any = semanticAction.entities["location"];
258+ // const locationObj = location.properties["location"];
259+ // const state: SkillState = await this.stateAccessor.get(context, new SkillState());
260+ // state.location = locationObj !== undefined ? locationObj : location;
261+ // await this.stateAccessor.set(context, state);
261262 // }
262263 }
263264}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import {
1111 RecognizerResult ,
1212 // SemanticAction,
1313 StatePropertyAccessor ,
14- TurnContext } from 'botbuilder' ;
14+ TurnContext } from 'botbuilder' ;
1515import { LuisRecognizer , LuisRecognizerTelemetryClient } from 'botbuilder-ai' ;
1616import {
1717 Dialog ,
@@ -251,12 +251,14 @@ export class MainDialog extends RouterDialog {
251251 // const activity: Activity = context.activity;
252252 // const semanticAction: SemanticAction | undefined = activity.semanticAction;
253253
254- // if (semanticAction != null && semanticAction.Entities.ContainsKey("location"))
255- // {
256- // var location = semanticAction.Entities["location"];
257- // var locationObj = location.Properties["location"].ToString();
258- // var state = await _stateAccessor.GetAsync(context, () => new SkillState());
259- // state.CurrentCoordinates = locationObj;
254+ // if (semanticAction !== undefined && Object.keys(semanticAction.entities)
255+ // .find((key: string) => key === "location")) {
256+ // // tslint:disable-next-line: no-explicit-any
257+ // const location: any = semanticAction.entities["location"];
258+ // const locationObj = location.properties["location"];
259+ // const state: SkillState = await this.stateAccessor.get(context, new SkillState());
260+ // state.location = locationObj !== undefined ? locationObj : location;
261+ // await this.stateAccessor.set(context, state);
260262 // }
261263 }
262264}
You can’t perform that action at this time.
0 commit comments