[英]DialogFlow V2 gRPC (c#) (updating entities, etc.)
我必須將DialogFlow(以前是API.AI)從V1 API重構為新的V2 gRPC。 因此,我准備了一切並開始重構。 但是立即我遇到了一些問題。 嘗試為某些entityType更新實體時,請參見下面的示例。
updateEntity。 同義詞是READ-ONLY屬性。
W00t ??? 知道為什么嗎? 還是有另一種(正確的?)方法嗎?
var client = DialogFlowHelper.DialogFlowCreateChannelClientEntityTypes();
List<EntityEntry> input = JsonConvert.DeserializeObject<List<EntityEntry>>(jsonData);
List<EntityType.Types.Entity> updateEntities = new List<EntityType.Types.Entity>();
foreach (var e in input)
{
var updateEntity = new EntityType.Types.Entity();
updateEntity.Value = e.value;
// HERE IS THE PROBLEM !!!!
// HERE IS THE PROBLEM !!!!
// HERE IS THE PROBLEM !!!!
//updateEntity.Synonyms =
updateEntities.Add(updateEntity);
}
var res = await client.BatchUpdateEntitiesAsync(
new EntityTypeName("no_problem", "no_problem"),
updateEntities
);
Definiton for 同義詞如下:
//
// Summary:
// Required. A collection of synonyms. For `KIND_LIST` entity types this must contain
// exactly one synonym equal to `value`.
[DebuggerNonUserCode]
public RepeatedField<string> Synonyms { get; }
我已經解決了這個問題。
同義詞集合(RepeatedField)已作為空集合存在。 因此,您只需向其中添加項目即可!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.