Dialogflow PHP v2 API дает сбой при ответах batchUpdate - PullRequest
0 голосов
/ 25 октября 2019

Я пытаюсь обучать сущности с помощью PHP Dialogflow V2 API

API создания и удаления работает нормально, но когда я вызываю сущности batchUpdate, кажется, что вызов имеет эффект (вНа самом деле я вижу объекты на панели Dialoflow), но во время синтаксического анализа ответа у меня всегда возникает одна и та же ошибка из протокола Google.

Вот мой код:

use Google\Cloud\Dialogflow\V2\EntityTypesClient;
use Google\Cloud\Dialogflow\V2\EntityType;
use Google\Cloud\Dialogflow\V2\EntityTypeBatch;
use Google\Cloud\Dialogflow\V2\EntityType\Kind;

// assume $credentialsFilePath and $dialogFlowProjectId is correct

try {
            $entityTypesClient = new EntityTypesClient([
                'credentials' => $credentialsFilePath
            ]);

            // prepare entity type
            $parent = $entityTypesClient->projectAgentName($dialogFlowProjectId);

$entityType = new EntityType();
            $entityType->setDisplayName("entityExample");
            $entityType->setKind(Kind::KIND_MAP);

            $entityTypeBatch = new EntityTypeBatch();
            $entityTypeBatch->setEntityTypes([$entityType]);

            // create entity type
            $response = $entityTypesClient->batchUpdateEntityTypes($parent, [
                'entityTypeBatchInline' => $entityTypeBatch
            ]);

            $entityTypesClient->close();

        } catch (Exception $e) {
            // do stuff
        }

иошибка при разборе ответа:

Fatal error: Uncaught Google\Protobuf\Internal\GPBDecodeException: Error occurred during parsing: Class google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse hasn't been added to descriptor pool in /Applications/XAMPP/xamppfiles/htdocs/imflow-server/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php on line 1256

Расследование Я заметил, что ответ Google содержит типы версии v2beta1, которые синтаксический анализатор, по-видимому, не может найти, таким образом вызывая исключение.

Как Google может отвечать типами v2beta1, когда я использую API V2?

Если это правильно, почему протокол google protobuf не содержит таких определений?

Я что-то упустил?

...