Today we’re going to be having a quick look at how we can extend and enhance the Copilot capabilities within Model Driven Power Apps.
This is new preview release functionality and the documentation will be available on Microsoft’s website here:
https://learn.microsoft.com/en-us/power-apps/maker/model-driven-apps/customize-copilot-chat
In this video, we’ll look at two scenarios for a fictional Fitness Club. It will focus on using knowledge based search to find relevant information for a member, as well as helping us qualify if a member is eligible for a seniors discount.
This will help us demonstrate three aspects of Copilot in Model driven Power Apps.
1) The ability to add custom knowledge sources
2) The ability to create custom prompts (helper prompts that guides the users)
3) The ability to pull context information (e.g. the record ID) from the Model driven app into Copilot Studio.
The source code below is provided for scenarios 2 and 3.
Scenario 2
kind: AdaptiveDialog
beginDialog:
kind: OnEventActivity
id: main
priority: 200
eventName: Microsoft.PowerApps.Copilot.RequestSparks
actions:
- kind: ParseValue
id: iCepPf
variable: Topic.SparkGroupCustom
valueType:
kind: Table
properties:
displayName: String
displaySubtitle: String
iconName: String
sparks:
type:
kind: Table
properties:
displayName: String
eventName: String
iconName: String
payload: String
type: String
value: |-
=[{displayName:"Fitness App Help",displaySubtitle:"Fitness App Help",iconName:"List24Regular",
sparks:[
{displayName:"Check if customer qualifies for seniors discount?",type:"PromptText"},
{displayName:"How much strength training should a healthy adult have per week?",type:"PromptText"},
{displayName:"How much exercise should I have if I am pregnant?",type:"PromptText"},
{displayName:"How do I provide feedback on Copilot’s responses?",type:"PromptText"}
]}]
- kind: SetVariable
id: setVariable_pDu9cr
variable: Global.PA_Copilot_Sparks.sparkGroups
value: =ForAll(Sequence(CountRows(Global.PA_Copilot_Sparks.sparkGroups)+CountRows(Topic.SparkGroupCustom)), If(Value<=CountRows(Global.PA_Copilot_Sparks.sparkGroups),Index (Global.PA_Copilot_Sparks.sparkGroups,Value), Index(Topic.SparkGroupCustom, Value - CountRows(Global.PA_Copilot_Sparks.sparkGroups))))
Scenario 3
kind: AdaptiveDialog
beginDialog:
kind: OnRecognizedIntent
id: main
intent:
triggerQueries:
- Seniors Discount
actions:
- kind: SendActivity
id: sendActivity_j3tpzl
activity: Sure I can help you with that, just give me a moment while I check.
- kind: InvokeFlowAction
id: invokeFlowAction_UvxClz
input:
binding:
text: =Global.PA__Copilot_Model_PageContext.pageContext.id.guid
output:
binding:
seniorsdiscount: Topic.SeniorsDiscount
flowId: e2e567e0-accf-ef11-a72f-7c1e520a7995
- kind: ConditionGroup
id: conditionGroup_P4inEX
conditions:
- id: conditionItem_G8lY0G
condition: =Topic.SeniorsDiscount = true
actions:
- kind: SendActivity
id: sendActivity_lZHbIN
activity: Yes, this member qualifies for a Seniors Discount.
elseActions:
- kind: SendActivity
id: sendActivity_D5mZRr
activity: Unfortunately this member does not qualify for a Seniors Discount.
Original Post http://365lyf.com/enhancing-copilot-conversations-in-model-driven-power-apps-using-copilot-studio/