Certains produits et fonctionnalités sont en cours de changement de nom. Les fonctionnalités de playbook et de flux génératifs sont également en cours de migration vers une console unique. Consultez les détails.
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Lors de la mise à jour des données de l'agent avec l'API, vous pouvez choisir d'écraser l'intégralité du type de données ou de n'écraser que des champs spécifiques du type de données.
Il est généralement préférable d'écraser des champs spécifiques, afin d'éviter d'écraser accidentellement l'ensemble de vos données.
Pour écraser des champs spécifiques, fournissez un FieldMask à votre requête de mise à jour.
Les exemples suivants montrent comment fournir un FieldMask pour mettre à jour le nom à afficher d'un type Intent.
Sélectionnez un protocole et une version pour la référence de l'intent :
importcom.google.cloud.dialogflow.cx.v3.Intent;importcom.google.cloud.dialogflow.cx.v3.Intent.Builder;importcom.google.cloud.dialogflow.cx.v3.IntentsClient;importcom.google.cloud.dialogflow.cx.v3.UpdateIntentRequest;importcom.google.protobuf.FieldMask;importjava.io.IOException;publicclassUpdateIntent{publicstaticvoidmain(String[]args)throwsIOException{// TODO(developer): Replace these variables before running the sample.StringprojectId="my-project-id";StringagentId="my-agent-id";StringintentId="my-intent-id";Stringlocation="my-location";StringdisplayName="my-display-name";updateIntent(projectId,agentId,intentId,location,displayName);}// DialogFlow API Update Intent sample.publicstaticvoidupdateIntent(StringprojectId,StringagentId,StringintentId,Stringlocation,StringdisplayName)throwsIOException{// Note: close() needs to be called on the IntentsClient object to clean up resources// such as threads. In the example below, try-with-resources is used,// which automatically calls close().try(IntentsClientclient=IntentsClient.create()){StringintentPath="projects/"+projectId+"/locations/"+location+"/agents/"+agentId+"/intents/"+intentId;BuilderintentBuilder=client.getIntent(intentPath).toBuilder();intentBuilder.setDisplayName(displayName);FieldMaskfieldMask=FieldMask.newBuilder().addPaths("display_name").build();Intentintent=intentBuilder.build();UpdateIntentRequestrequest=UpdateIntentRequest.newBuilder().setIntent(intent).setLanguageCode("en").setUpdateMask(fieldMask).build();// Make API request to update intent using fieldmaskIntentresponse=client.updateIntent(request);System.out.println(response);}}}
const{IntentsClient}=require('@google-cloud/dialogflow-cx');constintentClient=newIntentsClient();//TODO(developer): Uncomment these variables before running the sample.// const projectId = 'your-project-id';// const agentId = 'your-agent-id';// const intentId = 'your-intent-id';// const location = 'your-location';// const displayName = 'your-display-name';asyncfunctionupdateIntent(){constagentPath=intentClient.projectPath(projectId);constintentPath=`${agentPath}/locations/${location}/agents/${agentId}/intents/${intentId}`;//Gets the intent from intentPathconstintent=awaitintentClient.getIntent({name:intentPath});intent[0].displayName=displayName;//Specifies what is being updatedconstupdateMask={paths:['display_name'],};constupdateIntentRequest={intent:intent[0],updateMask,languageCode:'en',};//Send the request for update the intent.constresult=awaitintentClient.updateIntent(updateIntentRequest);console.log(result);}updateIntent();
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/04/14 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/04/14 (UTC)."],[[["When using the API to update agent data, you have the option to either overwrite all data or modify only specific fields."],["It is generally recommended to update specific fields to prevent the accidental overwriting of all your data."],["To update specific fields, a `FieldMask` must be included in the update request to indicate the fields to be modified."],["The examples provided illustrate how to use a `FieldMask` to specifically update the display name for an `Intent` type across REST, Java, Node.js and Python."]]],[]]