Пример #1
0
 /**
  * @param string $sessionId
  * @param string|null $message
  * @param Context $context
  *
  * @return Step Step object
  *
  * @throws BadResponseException
  * @throws ConversationException
  */
 private function getNextStep($sessionId, $message, Context $context)
 {
     $stepData = $this->converseApi->converse($sessionId, $message, $context);
     if (null === $stepData) {
         $stepData = [];
     }
     if (isset($stepData['error'])) {
         throw new ConversationException($stepData['error'], $sessionId, $context, $stepData);
     }
     try {
         $step = StepFactory::create($stepData);
     } catch (InvalidStepException $e) {
         throw new ConversationException($e->getMessage(), $sessionId, $context, $e->getStepData());
     }
     return $step;
 }
Пример #2
0
 /**
  * @deprecated This method is deprecated as of 0.1 and will be removed in 1.0.
  *             You should use the ConverseApi::converse() instead
  *
  * @param string $sessionId
  * @param string $text
  * @param Context|null $context
  *
  * @return array|null
  */
 public function getConverseNextStep($sessionId, $text, Context $context = null)
 {
     return $this->converseApi->converse($sessionId, $text, $context);
 }