Skip to content

Commit e6c6d2f

Browse files
Add knowledge_connector_settings to dialogflow_cx_flow/page (#13792) (#980)
[upstream:b91d85e5f8e75fd5312759f5a447cf45357e7a03] Signed-off-by: Modular Magician <[email protected]>
1 parent 400cc36 commit e6c6d2f

File tree

2 files changed

+255
-1
lines changed

2 files changed

+255
-1
lines changed

dialogflowcx_flow_full/main.tf

Lines changed: 131 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,134 @@ resource "google_dialogflow_cx_flow" "basic_flow" {
294294
enable_consent_based_redaction = true
295295
}
296296
}
297-
}
297+
298+
knowledge_connector_settings {
299+
enabled = true
300+
trigger_fulfillment {
301+
messages {
302+
channel = "some-channel"
303+
text {
304+
text = ["information completed, navigating to page 2"]
305+
}
306+
}
307+
messages {
308+
payload = <<EOF
309+
{"some-key": "some-value", "other-key": ["other-value"]}
310+
EOF
311+
}
312+
messages {
313+
conversation_success {
314+
metadata = <<EOF
315+
{"some-metadata-key": "some-value", "other-metadata-key": 1234}
316+
EOF
317+
}
318+
}
319+
messages {
320+
output_audio_text {
321+
text = "some output text"
322+
}
323+
}
324+
messages {
325+
output_audio_text {
326+
ssml = <<EOF
327+
<speak>Some example <say-as interpret-as="characters">SSML XML</say-as></speak>
328+
EOF
329+
}
330+
}
331+
messages {
332+
live_agent_handoff {
333+
metadata = <<EOF
334+
{"some-metadata-key": "some-value", "other-metadata-key": 1234}
335+
EOF
336+
}
337+
}
338+
messages {
339+
play_audio {
340+
audio_uri = "http://example.com/some-audio-file.mp3"
341+
}
342+
}
343+
messages {
344+
telephony_transfer_call {
345+
phone_number = "1-234-567-8902"
346+
}
347+
}
348+
webhook = google_dialogflow_cx_webhook.my_webhook.id
349+
return_partial_responses = true
350+
tag = "some-tag"
351+
set_parameter_actions {
352+
parameter = "some-param"
353+
value = "123.45"
354+
}
355+
conditional_cases {
356+
cases = jsonencode([
357+
{
358+
condition = "$sys.func.RAND() < 0.5",
359+
caseContent = [
360+
{
361+
message = { text = { text = ["First case"] } }
362+
}
363+
]
364+
},
365+
{
366+
caseContent = [
367+
{
368+
message = { text = { text = ["Final case"] } }
369+
}
370+
]
371+
},
372+
])
373+
}
374+
advanced_settings {
375+
speech_settings {
376+
endpointer_sensitivity = 30
377+
no_speech_timeout = "3.500s"
378+
use_timeout_based_endpointing = true
379+
models = {
380+
name : "wrench"
381+
mass : "1.3kg"
382+
count : "3"
383+
}
384+
}
385+
dtmf_settings {
386+
enabled = true
387+
max_digits = 1
388+
finish_digit = "#"
389+
interdigit_timeout_duration = "3.500s"
390+
endpointing_timeout_duration = "3.500s"
391+
}
392+
logging_settings {
393+
enable_stackdriver_logging = true
394+
enable_interaction_logging = true
395+
enable_consent_based_redaction = true
396+
}
397+
}
398+
enable_generative_fallback = true
399+
}
400+
data_store_connections {
401+
data_store_type = "UNSTRUCTURED"
402+
data_store = "projects/${data.google_project.project.number}/locations/${google_dialogflow_cx_agent.agent.location}/collections/default_collection/dataStores/${google_discovery_engine_data_store.my_datastore.data_store_id}"
403+
document_processing_mode = "DOCUMENTS"
404+
}
405+
target_flow = google_dialogflow_cx_agent.agent.start_flow
406+
}
407+
}
408+
409+
resource "google_discovery_engine_data_store" "my_datastore" {
410+
location = "global"
411+
data_store_id = "datastore-flow-full"
412+
display_name = "datastore-flow-full"
413+
industry_vertical = "GENERIC"
414+
content_config = "NO_CONTENT"
415+
solution_types = ["SOLUTION_TYPE_CHAT"]
416+
}
417+
418+
resource "google_dialogflow_cx_webhook" "my_webhook" {
419+
parent = google_dialogflow_cx_agent.agent.id
420+
display_name = "MyWebhook"
421+
generic_web_service {
422+
uri = "https://example.com"
423+
}
424+
}
425+
426+
data "google_project" "project" {
427+
}

dialogflowcx_page_full/main.tf

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,17 +550,141 @@ resource "google_dialogflow_cx_page" "basic_page" {
550550
finish_digit = "#"
551551
}
552552
}
553+
knowledge_connector_settings {
554+
enabled = true
555+
trigger_fulfillment {
556+
messages {
557+
channel = "some-channel"
558+
knowledge_info_card {}
559+
}
560+
messages {
561+
channel = "some-channel"
562+
text {
563+
text = ["information completed, navigating to page 2"]
564+
}
565+
}
566+
messages {
567+
payload = <<EOF
568+
{"some-key": "some-value", "other-key": ["other-value"]}
569+
EOF
570+
}
571+
messages {
572+
conversation_success {
573+
metadata = <<EOF
574+
{"some-metadata-key": "some-value", "other-metadata-key": 1234}
575+
EOF
576+
}
577+
}
578+
messages {
579+
output_audio_text {
580+
text = "some output text"
581+
}
582+
}
583+
messages {
584+
output_audio_text {
585+
ssml = <<EOF
586+
<speak>Some example <say-as interpret-as="characters">SSML XML</say-as></speak>
587+
EOF
588+
}
589+
}
590+
messages {
591+
live_agent_handoff {
592+
metadata = <<EOF
593+
{"some-metadata-key": "some-value", "other-metadata-key": 1234}
594+
EOF
595+
}
596+
}
597+
messages {
598+
play_audio {
599+
audio_uri = "http://example.com/some-audio-file.mp3"
600+
}
601+
}
602+
messages {
603+
telephony_transfer_call {
604+
phone_number = "1-234-567-8902"
605+
}
606+
}
607+
webhook = google_dialogflow_cx_webhook.my_webhook.id
608+
return_partial_responses = true
609+
tag = "some-tag"
610+
set_parameter_actions {
611+
parameter = "some-param"
612+
value = "123.45"
613+
}
614+
conditional_cases {
615+
cases = jsonencode([
616+
{
617+
condition = "$sys.func.RAND() < 0.5",
618+
caseContent = [
619+
{
620+
message = { text = { text = ["First case"] } }
621+
}
622+
]
623+
},
624+
{
625+
caseContent = [
626+
{
627+
message = { text = { text = ["Final case"] } }
628+
}
629+
]
630+
},
631+
])
632+
}
633+
advanced_settings {
634+
speech_settings {
635+
endpointer_sensitivity = 30
636+
no_speech_timeout = "3.500s"
637+
use_timeout_based_endpointing = true
638+
models = {
639+
name : "wrench"
640+
mass : "1.3kg"
641+
count : "3"
642+
}
643+
}
644+
dtmf_settings {
645+
enabled = true
646+
max_digits = 1
647+
finish_digit = "#"
648+
interdigit_timeout_duration = "3.500s"
649+
endpointing_timeout_duration = "3.500s"
650+
}
651+
logging_settings {
652+
enable_stackdriver_logging = true
653+
enable_interaction_logging = true
654+
enable_consent_based_redaction = true
655+
}
656+
}
657+
enable_generative_fallback = true
658+
}
659+
data_store_connections {
660+
data_store_type = "PUBLIC_WEB"
661+
data_store = "projects/${data.google_project.project.number}/locations/${google_dialogflow_cx_agent.agent.location}/collections/default_collection/dataStores/datastore-page-full"
662+
document_processing_mode = "CHUNKS"
663+
}
664+
target_page = google_dialogflow_cx_page.my_page2.id
665+
}
553666
}
554667

555668
resource "google_dialogflow_cx_page" "my_page2" {
556669
parent = google_dialogflow_cx_agent.agent.start_flow
557670
display_name = "MyPage2"
558671
}
559672

673+
resource "google_discovery_engine_data_store" "my_datastore" {
674+
location = "global"
675+
data_store_id = "datastore-page-full"
676+
display_name = "datastore-page-full"
677+
industry_vertical = "GENERIC"
678+
content_config = "NO_CONTENT"
679+
}
680+
560681
resource "google_dialogflow_cx_webhook" "my_webhook" {
561682
parent = google_dialogflow_cx_agent.agent.id
562683
display_name = "MyWebhook"
563684
generic_web_service {
564685
uri = "https://example.com"
565686
}
566687
}
688+
689+
data "google_project" "project" {
690+
}

0 commit comments

Comments
 (0)