我的春季Bot框架未在Azure Webbapp和Skype上显示机器人响应

时间:2018-10-15 21:44:32

标签: spring-boot botframework

在bot框架模拟器上,正常显示愚蠢的消息

print 但是,当我在Bot Channels Registration上使用相同的url时,它会发送消息并进行处理,但不会显示响应

print 也许响应的结构不正确,我不知道:

public List<ResourceResponse> create(@RequestBody @Valid @JsonDeserialize(using = DateTimeDeserializer.class) Activity activity,HttpServletResponse response ) {
  response.setStatus(HttpServletResponse.SC_ACCEPTED);

  System.out.println("Recebendo Mensagem");

  if (activity.type().equals(ActivityTypes.MESSAGE)){
      //preenche os dados da conversa.
      Conversa conversa = new Conversa();

      //processa a mensagem
      ConversaController conversaWatson = new ConversaController();
      conversa = conversaWatson.conversaWatson(conversa);

      //prepara activity de resposta 
      ConnectorClient connector = new ConnectorClientImpl(activity.serviceUrl(), credentials);
      Activity watsonActivity = SkypeActivityCreator.createWatsonActivity(activity,conversa.getRespostaWatson());
      Conversations conversation = SkypeConversationCreator.createResponseConversation(connector);
      try{
          ResourceResponse resposta =SkypeResourceResponseSender.send(conversation, activity, watsonActivity);
          responses.add(resposta);
      }catch(Exception e) {
          System.out.println("falha ao enviar a resposta ao usuário final:" + e.getMessage());
      }
  }
  return responses;

}

我的发件人是

@Component
public class SkypeResourceResponseSender {

  public static ResourceResponse send(Conversations conversations,
      Activity requestActivity, Activity responseActivity) {
    return conversations.
        sendToConversation(requestActivity.conversation().id(), responseActivity);
  }
}

我的pom.xml具有依赖项:

<dependency>
  <groupId>com.microsoft.bot.connector</groupId>
  <artifactId>bot-connector</artifactId>
  <version>4.0.0-a1</version>
</dependency>

<dependency>
  <groupId>com.microsoft.bot.schema</groupId>
  <artifactId>botbuilder-schema</artifactId>
  <version>4.0.0-a1</version>
</dependency>

0 个答案:

没有答案