我必须将对话流(以前的api.ai)从v1 api重构为新的v2 grpc。所以我准备了所有的东西并开始重构。
但我马上就遇到了一些问题。在尝试更新某些EntityType的实体时,请参见下面的示例。
更新实体。
同义词
是
只读的
财产。
W00????知道为什么吗?还是有其他(合适的?)如何做到这一点?
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
);
定义
同义词
像这样:
//
// 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; }