Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Setelah memiliki entity urutan, Anda dapat membuat intent untuk mengumpulkan
urutan dari pengguna akhir. Anda memerlukan setidaknya tiga intent dengan tanggung jawab berikut:
Intent kepala "Sequence"
Menangkap ucapan untuk memulai pengumpulan urutan.
Dipanggil oleh peristiwa tindak lanjut untuk terus merekam urutan hingga
pengguna akhir menyatakan bahwa mereka sudah selesai.
Intent kontekstual "Urutan - Edit"
Menangkap ucapan untuk memperbaiki urutan terakhir yang dikumpulkan.
Secara terprogram, loop kembali ke intent "Sequence" untuk mengumpulkan
urutan yang dikoreksi.
Intent kontekstual "Sequence - Done"
Menangkap ucapan yang menunjukkan bahwa urutan sudah selesai.
Di bagian berikutnya, Anda akan melihat cara webhook menghubungkan semua ini, tetapi pertama-tama,
mari kita siapkan intent.
Membuat intent "Sequence"
Ini adalah intent utama untuk mengumpulkan urutan. Konfigurasikan seperti ini:
Biarkan konteks input kosong sehingga pengguna akhir dapat memicu intent ini di awal
panggilan.
Tambahkan konteks output "collecting-sequence". Kita akan menggunakan konteks ini untuk mengaktifkan
intent koreksi dan penyelesaian selama alur.
Tambahkan konteks output "editing-sequence" dan tetapkan masa berlaku ke 0. Kita akan
mengaktifkan konteks ini dengan masa aktif dari intent "Sequence - Edit" di
bagian berikutnya, dan penting untuk menghapus konteks tersebut di sini sehingga
konteks "editing-sequence" hanya aktif segera setelah memicu
intent "Edit".
Tambahkan peristiwa "continue-sequence" agar webhook Anda dapat memutar intent ini untuk mengumpulkan semua urutan parsial.
Tambahkan frasa pelatihan agar pengguna akhir dapat memicu intent ini untuk memulai alur.
Contoh ini menggunakan frasa seperti "apa status pesanan saya", "lacak pesanan saya",
"di mana pesanan saya", dll.
Tambahkan nama tindakan "handle-sequence" agar webhook mengetahui kapan harus diaktifkan.
Anda akan membuat kode webhook di bagian berikutnya dalam tutorial ini, setelah semua intent disiapkan.
Tambahkan parameter yang diperlukan "new_sequence" menggunakan entity regexp yang Anda buat
untuk mengumpulkan urutan parsial di bagian sebelumnya. Tetapkan jenis entitas ke "@alphanumeric" dan nilai ke "$new_sequence".
Tambahkan parameter opsional "existing_sequence" dengan nilai
"#continue-sequence.existing_sequence" untuk mengekstrak urutan baru yang ada
dari peristiwa. Anda dapat mengosongkan jenis entity.
Tambahkan parameter opsional "previous_sequence" dengan nilai
"#continue-sequence.previous_sequence" untuk mengekstrak urutan sebelumnya
dari peristiwa. Anda dapat mengosongkan jenis entity.
Aktifkan panggilan webhook untuk intent ini dan panggilan webhook untuk pengisian slot.
Membuat intent "Urutan - Edit"
Intent ini memproses ucapan yang menunjukkan bahwa urutan sebelumnya
salah didengar oleh agen. Siapkan seperti ini:
Tambahkan konteks input "collecting-sequence" sehingga intent ini hanya dipanggil
saat kita berada di tengah alur urutan. Ini adalah konteks yang sama
yang diaktifkan oleh intent "Sequence".
Tambahkan konteks output "editing-sequence" untuk webhook fulfillment yang akan
dijadikan referensi. Saat intent ini diaktifkan, webhook akan memutar Dialogflow
kembali ke intent "Urutan" utama untuk mengumpulkan urutan berikutnya. Webhook
untuk pengisian slot intent "Sequence" akan memeriksa konteks
"editing-sequence" yang aktif untuk memberikan respons "coba lagi" yang simpatik kepada
pengguna akhir.
Tambahkan frasa pelatihan seperti "tidak", "itu salah", dll.
Tambahkan nama tindakan "handle-sequence". Ini adalah tindakan yang sama dengan
intent "Sequence" sehingga kita dapat menggunakan kembali logika webhook yang sama.
Tambahkan parameter "new_sequence" dengan nilai
"#collecting-sequence.previous_sequence" untuk mengekstrak urutan sebelumnya
dari konteks, yang secara efektif mengurungkan ucapan terakhir. Kita tidak menambahkan parameter "existing_sequence" di sini sehingga webhook akan menimpa urutan yang ada dengan urutan sebelumnya.
Aktifkan panggilan webhook untuk intent ini.
Buat intent "Sequence - Done".
Menambahkan konteks input "collecting-sequence"
Tambahkan konteks output "collecting-sequence" dan tetapkan masa aktif ke 0 untuk menghapus konteks. Menghapusnya akan mencegah intent "Edit" dan "Selesai"
terpicu lagi setelah agen selesai mengumpulkan urutan.
Tambahkan frasa pelatihan seperti "selesai", "selesai semua", dll.
Tambahkan parameter "sequence" dengan nilai
"#collecting-sequence.existing_sequence" untuk mengekstrak urutan
akhir dari konteks.
Aktifkan panggilan webhook untuk intent ini.
Menautkan intent melalui webhook
Sekarang Anda memiliki semua yang diperlukan untuk membuat kode logika untuk intent ini. Di bagian berikutnya, Anda akan melihat cara membuat kode webhook untuk menggunakan semua konteks, tindakan, parameter, dan peristiwa ini untuk menyelesaikan alur validasi urutan.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[[["\u003cp\u003eThere are three key intents for collecting sequences: "Sequence" to start and continue, "Sequence - Edit" to correct the last entry, and "Sequence - Done" to finalize the sequence.\u003c/p\u003e\n"],["\u003cp\u003eThe "Sequence" intent uses output contexts "collecting-sequence" and "editing-sequence" to manage the flow, along with the "continue-sequence" event and training phrases to start and continue sequence collection.\u003c/p\u003e\n"],["\u003cp\u003eThe "Sequence - Edit" intent utilizes the "collecting-sequence" input context to activate only during sequence collection, along with an "editing-sequence" output context to inform the webhook to correct the sequence.\u003c/p\u003e\n"],["\u003cp\u003eThe "Sequence - Done" intent, triggered by phrases indicating sequence completion, clears the "collecting-sequence" context to prevent further edits and extracts the complete sequence.\u003c/p\u003e\n"],["\u003cp\u003eAll three intents use the same action name "handle-sequence" and webhook calls, which allows a single webhook to manage the sequence validation flow.\u003c/p\u003e\n"]]],[],null,["# Creating the sequence flow intents\n\nNow that you have your sequence entity, you can create the intents to collect the\nsequence from the end-user. You'll want at least three intents with these responsibilities:\n\n1. A head intent \"Sequence\"\n - Catches utterances to start the sequence collection.\n - Invoked by follow-up events to continue capturing sequences until the end-user says they're done.\n2. A contextual intent \"Sequence - Edit\"\n - Catches utterances to correct the last sequence collected.\n - Programmatically loops back to the \"Sequence\" intent to collect the corrected sequence.\n3. A contextual intent \"Sequence - Done\"\n - Catches utterances that indicate the sequence is complete.\n\nIn the next section, you'll see how webhook will connect all of these, but first\nlet's set up the intents.\n\nCreate the \"Sequence\" intent\n----------------------------\n\nThis is the main intent for collecting sequences. Configure it like so:\n\n1. Leave the input contexts empty so end-users can trigger this intent at the start of the call.\n2. Add an output context \"collecting-sequence\". We'll use this context to enable the correcting and finishing intents during the flow.\n3. Add an output context \"editing-sequence\" and set the lifespan to 0. We'll activate this context with a lifespan from the \"Sequence - Edit\" intent in the next section, and it's important to clear that context here so that the \"editing-sequence\" context is only active immediately after triggering the \"Edit\" intent.\n4. Add an event \"continue-sequence\" so your webhook can loop this intent to\n collect all of the partial sequences.\n\n5. Add training phrases so the end-user can trigger this intent to start the flow.\n This example uses phrases like \"what's my order status\", \"track my order\",\n \"where is my order\", etc.\n\n6. Add an action name \"handle-sequence\" so the webhook knows when to fire.\n You'll code the webhook in the next section of this tutorial, after all the\n intents are set up.\n\n7. Add a required parameter \"new_sequence\" using the regexp entity you created\n to collect partial sequences in the previous section. Set the entity type to\n \"@alphanumeric\" and the value to \"$new_sequence\".\n\n8. Add an optional parameter \"existing_sequence\" with value\n \"#continue-sequence.existing_sequence\" to extract the new existing sequence\n from the event. You can leave the entity type empty.\n\n9. Add an optional parameter \"previous_sequence\" with value\n \"#continue-sequence.previous_sequence\" to extract the previous sequence\n from the event. You can leave the entity type empty.\n\n10. Enable webhook call for this intent *and* webhook call for slot filling.\n\nCreate the \"Sequence - Edit\" intent\n-----------------------------------\n\nThis intent listens for utterances that indicate the previous sequence was\nmisheard by the agent. Set it up like this:\n\n1. Add an input context \"collecting-sequence\" so that this intent is only called when we're in the middle of the sequence flow. This is the same context activated by the \"Sequence\" intent.\n2. Add an output context \"editing-sequence\" for our fulfillment webhook to reference. When this intent is activated, the webhook will loop Dialogflow back to the main \"Sequence\" intent to collect the next sequence. The webhook for the \"Sequence\" intent's slot-filling will check for an active \"editing-sequence\" context to provide a sympathetic \"try again\" response to the end-user.\n3. Add training phrases like \"no\", \"that's not right\", etc.\n\n4. Add the action name \"handle-sequence\". This is the same action as the\n \"Sequence\" intent so we can reuse the same webhook logic.\n\n5. Add a parameter \"new_sequence\" with value\n \"#collecting-sequence.previous_sequence\" to extract the previous sequence\n from the context, effcetively undoing the last utterance. We do *not* add an\n \"existing_sequence\" parameter here so that the webhook will overwrite the\n existing sequence with the previous one.\n\n6. Enable webhook call for this intent.\n\nCreate a \"Sequence - Done\" intent.\n----------------------------------\n\n1. Add an input context \"collecting-sequence\"\n2. Add an output context \"collecting-sequence\" and set the lifespan to 0 to clear the context. Clearing it prevents the \"Edit\" and \"Done\" intents from triggering again now that the agent is done collecting the sequence.\n3. Add training phrases like \"that's it\", \"all done\", etc.\n\n4. Add a parameter \"sequence\" with value\n \"#collecting-sequence.existing_sequence\" to extract the final\n sequence from the context.\n\n5. Enable webhook call for this intent.\n\nLink the intents through webhook\n================================\n\nYou now have everything you need to code the logic for these intents. In the next\nsection, you'll see how to code the webhook to use all these contexts, actions,\nparameters, and events to complete the sequence validation flow."]]