private async Task ValidStateTransition(ConversationalAgentState newState)
        {
            var response = await agentSession.RequestAgentStateChangeAsync(newState);

            Assert.AreEqual(newState, agentSession.AgentState);
            Assert.AreEqual(ConversationalAgentSessionUpdateResponse.Success, response);
        }
 /// <summary>
 /// Fires rejected event if state change to inactive occurs during verification.
 /// </summary>
 /// <param name="oldState"> The old session state. </param>
 /// <param name="newState"> The new session state. </param>
 public void DialogStateChangeDuringSignalVerification(ConversationalAgentState oldState, ConversationalAgentState newState)
 {
     if (this.signalNeedsVerification &&
         oldState == ConversationalAgentState.Detecting &&
         newState == ConversationalAgentState.Inactive)
     {
         this.OnSessionSignalRejected(this.LastDetectedSignalOrigin);
     }
 }
예제 #3
0
        /// <summary>
        /// Instructs the manager to update the current ConversationalAgentSessionState to the
        /// requested value and inform consumers of the change.
        /// Indicates ConversationalSessionState changes based on requests and responses to and from the Bot.
        /// </summary>
        /// <param name="newState"> The new, requested conversational agent state. </param>
        /// <returns> A task that completes once the state is updated and consumers are notified. </returns>
        private async Task ChangeAgentStateAsync(ConversationalAgentState newState)
        {
            var session = await this.agentSessionManager.GetSessionAsync();

            var oldState = session.AgentState;

            this.logger.Log($"Changing agent state: [{oldState.ToString()}] -> [{newState.ToString()}]");
            await session.RequestAgentStateChangeAsync(newState);

            this.DialogStateChanged?.Invoke(oldState, newState);
        }
        /// <summary>
        /// Instructs the manager to update the current ConversationalAgentSessionState to the
        /// requested value and inform consumers of the change.
        /// Indicates ConversationalSessionState changes based on requests and responses to and from the Bot.
        /// </summary>
        /// <param name="newState"> The new, requested conversational agent state. </param>
        /// <returns> A task that completes once the state is updated and consumers are notified. </returns>
        private async Task ChangeAgentStateAsync(ConversationalAgentState newState)
        {
            var session = await this.agentSessionManager.GetSessionAsync();

            var oldState = session.AgentState;

            Debug.WriteLine($"Changing agent state: [{oldState.ToString()}] -> [{newState.ToString()}]");
            await session.RequestAgentStateChangeAsync(newState);

            this.signalDetectionHelper.DialogStateChangeDuringSignalVerification(oldState, newState);
            this.DialogStateChanged?.Invoke(oldState, newState);
        }
 /// <summary>
 /// Synchronously requests a state change for the current ConversationalAgentSession.
 /// </summary>
 /// <param name="state">The AgentState requested.</param>
 /// <returns>A ConversationalAgentSessionUpdateResponse.</returns>
 public ConversationalAgentSessionUpdateResponse RequestAgentStateChange(ConversationalAgentState state)
 {
     return(this.session.RequestAgentStateChange(state));
 }
 /// <summary>
 /// Asynchronously requests a state change for the current ConversationalAgentSession.
 /// </summary>
 /// <param name="state">The AgentState requested.</param>
 /// <returns>The result of the asynchronous operation as a ConversationalAgentSessionUpdateResponse.</returns>
 public IAsyncOperation <ConversationalAgentSessionUpdateResponse> RequestAgentStateChangeAsync(ConversationalAgentState state)
 {
     return(this.session.RequestAgentStateChangeAsync(state));
 }
예제 #7
0
 public IAsyncOperation <ConversationalAgentSessionUpdateResponse> RequestAgentStateChangeAsync(ConversationalAgentState state)
 {
     this.AgentState = state;
     return(Task.FromResult(ConversationalAgentSessionUpdateResponse.Success).AsAsyncOperation());
 }
예제 #8
0
 public ConversationalAgentSessionUpdateResponse RequestAgentStateChange(ConversationalAgentState state)
 {
     this.AgentState = state;
     return(ConversationalAgentSessionUpdateResponse.Success);
 }