问题
I've got a C# project and the dialogflow google api reference added in it.
using Google.Cloud.Dialogflow.V2;
And I want to know if I can use that to import a zip to my dialogflow agent.
Using the Dialogflow Web Console I can do this:
Would be great if I could achieve this functionality in C# somehow.
Any help / advice would be appreciated.
回答1:
I'd expect that to be a matter of calling AgentsClient.ImportAgent, e.g.
var zipFile = File.ReadAllBytes("agent.zip");
var zipByteString = ByteString.CopyFrom(zipFile);
var client = AgentsClient.Create();
var request = new ImportAgentRequest
{
ParentAsProjectName = new ProjectName("[YOUR PROJECT ID]")
AgentContent = zipByteString
};
var operation = client.ImportAgent(client);
operation.PollUntilCompleted();
来源:https://stackoverflow.com/questions/57480321/how-to-import-a-dialogflow-zip-using-an-api