简体   繁体   English

会话实体未在dialogflow实体中更新

[英]session entities not updating in dialogflow entities

Using createSessionEntityTypes I have created a session entity which is added to already existing entity type if I make use of listSessionEntityTypes I can view the created new entity but if I try with my DialogFlow it's not recognized by it. 使用createSessionEntityTypes我创建了一个会话实体,如果我使用listSessionEntityTypes可以添加到已经存在的实体类型中,我可以查看创建的新实体,但是如果我尝试使用DialogFlow,它将无法识别该实体。

As an example: I created an entity named kitchen and now if I try to access it saying "Turn on kitchen light" kitchen is not recognized by the light entitytype. 例如:我创建了一个名为kitchen的实体,现在如果尝试访问它说“打开厨房灯”,light实体类型无法识别kitchen。

It is weird because when I use listSessionEntitytypes I see kitchen in that list but my DialogFlow is not recognizing it as Entity when I speak. 这很奇怪,因为当我使用listSessionEntitytypes时,我在该列表中看到了Kitchen,但是当我讲话时,我的DialogFlow并未将其识别为Entity。 Here is the code that I am working on: 这是我正在处理的代码:

function createSessionEntityType() {
    const sessionEntityTypesClient = new 
    dialogflow.SessionEntityTypesClient();
    const entityType = 'any';

    const sessionPath = `sessionpath`;
    const sessionEntityTypePath = `sessionentitypath`;
    const entities = [{
       "value": "Library",
       "synonyms": ["Study room"]
    }];
    const entityOverrideMode = "ENTITY_OVERRIDE_MODE_OVERRIDE";

    const sessionEntityTypeRequest = {
        parent: sessionPath,
        sessionEntityType: {
            name: sessionEntityTypePath,
            entityOverrideMode: entityOverrideMode,
            entities: entities,
        },
    };

    sessionEntityTypesClient
    .createSessionEntityType(sessionEntityTypeRequest)
    .then(responses => {
        console.log('SessionEntityType created:', responses);
    });
  }

Intent picture 意向图片

While it isn't entirely clear, it looks like the problem is that your Intent doesn't actually use the Entity Type that you're creating. 虽然尚不完全清楚,但问题似乎在于您的Intent实际上并未使用您正在创建的实体类型。 None of the "room" like words in your Intent are highlighted or matched to an Entity type. Intent中的“房间”之类的单词都不会突出显示或与实体类型匹配。

You need to have created the Entity Type first, and you can then use the API to update the specific values in it. 您需要先创建实体类型,然后才能使用API​​更新其中的特定值。 Once you've done this, you can also highlight the relevant words in your phrase to match them to a specific Entity Type, even if you don't have any Entities in it. 完成此操作后,即使其中没​​有任何实体,也可以突出显示短语中的相关词以使其与特定的实体类型匹配。

Even tho you have to have created the Entity Type, since you're updating the Entities inside a session, they will never show up in the Dialogflow UI. 即使您必须已经创建了实体类型,由于要在会话中更新实体,它们也永远不会显示在Dialogflow UI中。 Users who are saying phrases in the same session where the Entities were created, however, should still get matches. 但是,在创建实体的同一会话中说短语的用户仍应获得匹配项。

请检查您所有的语法和函数调用定义,以根据语法从会话实体objectEntityValue数组中调用实体值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM