importcom.google.cloud.dialogflow.v2.Agent;importcom.google.cloud.dialogflow.v2.Agent.Builder;importcom.google.cloud.dialogflow.v2.AgentsClient;importcom.google.cloud.dialogflow.v2.AgentsSettings;importjava.io.IOException;publicclassSetAgent{publicstaticvoidmain(String[]args)throwsIOException{StringprojectId="my-project-id";// The display name will set the name of your agentStringdisplayName="my-display-name";setAgent(projectId,displayName);}publicstaticAgentsetAgent(Stringparent,StringdisplayName)throwsIOException{AgentsSettingsagentsSettings=AgentsSettings.newBuilder().build();try(AgentsClientclient=AgentsClient.create(agentsSettings)){// Set the details of the Agent to createBuilderbuild=Agent.newBuilder();build.setDefaultLanguageCode("en");build.setDisplayName(displayName);Agentagent=build.build();// Make API request to create agentAgentresponse=client.setAgent(agent);System.out.println(response);returnresponse;}}}
const{AgentsClient}=require('@google-cloud/dialogflow');// make sure to pass projectID as the input parameterconstparent='projects/'+parentId+'/locations/global';constagent={parent:parent,displayName:displayName,defaultLanguageCode:'en',timeZone:'America/Los_Angeles',};constclient=newAgentsClient();asyncfunctionsetAgent(){constrequest={agent,};const[response]=awaitclient.setAgent(request);console.log(`response: ${JSON.stringify(response,null,2)}`);}awaitsetAgent();
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-12-21。"],[],[]]