您可以透過允許內嵌編輯,增強 Microsoft 365 Copilot 宣告式代理程式中的調適性卡片回應。 此方法可讓卡片收集輸入資料、將結構化承載傳送至您的應用程式,並根據傳回的回應動態更新卡片 - 建立順暢、有狀態的互動,而無需離開代理程式介面。
本文說明如何使用 Action.Execute 自調適型卡片結構描述版本 1.5 開始 (可用的函數,) 將強制回應對話方塊新增至您的 Copilot 代理程式回應。 這些對話方塊可讓使用者透過 [調適型卡片] 編輯和提交資訊。
注意
函數 Action.Execute 目前為預覽版。
自適性卡片編輯
若要使用強制回應對話方塊動作:
- 將 [調適型卡片] 範本 新增至您的 外掛程式資訊清單。
- 在自適性卡片定義中包含
Action.Execute結構描述。
下列範例顯示 Action.Execute 的結構描述。
{
"static_template": {
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.5",
"body": [
{
"type": "Container",
"$data": "${$root}",
"items": [
{
"type": "TextBlock",
"text": "ticketId: ${if(ticketId, ticketId, 'N/A')}",
"wrap": true
},
{
"type": "Input.Text",
"value": "${if(title, title, 'N/A')}",
"id": "title",
"wrap": true,
"maxLength": 500
},
{
"type": "Input.Text",
"value": "${if(description, description, 'N/A')}",
"id": "description",
"wrap": true,
"maxLength": 500,
"isMultiline": true
},
{
"type": "Input.Number",
"label": "Severity",
"value": "${if(severity, severity, 'N/A')}",
"id": "severity",
"wrap": true
},
{
"type": "Input.Date",
"label": "Due Date - Overdue ⏰",
"id": "dueDate",
"value": "${if(dueDate, dueDate, 'N/A')}",
"wrap": true
},
{
"type": "Input.Number",
"placeholder": "Placeholder text",
"id": "completionPercentage",
"label": "Completion Percentage",
"max": 100,
"min": 0,
"value": "${if(completionPercentage, completionPercentage, 'N/A')}",
"isVisible": true,
"wrap": true
}
]
}
],
"actions": [
{
"type": "Action.Execute",
"verb": "updateTickets",
"isVisible": true,
"id": "ticketUpdate",
"title": "Update Ticket",
"data": {
"ticketId": "${if(ticketId, ticketId, 'N/A')}"
}
}
]
}
},
{
"name": "updateTickets",
"description": "Update a ticket field for a given ticketId",
"capabilities": {
"response_semantics": {
"data_path": "$",
"properties": {
"title": "$.title",
"subtitle": "$.description"
},
"static_template": {
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.5",
"body": [
{
"type": "Container",
"$data": "${$root}",
"items": [
{
"type": "TextBlock",
"text": "ticketId: ${if(updatedTicket.ticketId, updatedTicket.ticketId, 'N/A')}",
"wrap": true
},
{
"type": "Input.Text",
"value": "${if(updatedTicket.title, updatedTicket.title, 'N/A')}",
"id": "title",
"wrap": true,
"maxLength": 500
},
{
"type": "Input.Text",
"value": "${if(updatedTicket.description, updatedTicket.description, 'N/A')}",
"id": "description",
"wrap": true,
"maxLength": 500,
"isMultiline": true
}
]
}
],
"actions": [
{
"type": "Action.Execute",
"verb": "updateTickets",
"isVisible": true,
"id": "ticketUpdate",
"title": "Update Ticket",
"data": {
"ticketId": "${if(updatedTicket.ticketId, updatedTicket.ticketId, 'N/A')}"
}
}
]
}
}
}
}
要求和回應範例
下列要求和回應範例顯示當使用者採取導致函式在用戶端中執行的動作 Action.Execute 時會發生什麼情況。
要求
{
"clientInfo": {
"clientPlatform": "chat-web",
"clientAppName": "Office",
"clientEntrypoint": "chat-officeweb",
"clientSessionId": "d8bc8369-277e-c48c-2faf-3c894945abe0"
},
"message": {
"text": "Card action execute",
"messageType": "ExecuteActionRequest",
"actionId": "jiraclouddev_searchForIssuesUsingJql(jql=\"assignee=currentUser() AND type=Task AND created >= -30d\", startAt=0, maxResults=10)",
"author": "user",
"executeActionData": {
"gptId": "gpt_ud",
"gptActionId": "plugin_1",
"titleId": "U_e80ce190-4f5a-ee50-ce95-dcbabd8cd2ec",
"verb": "updateTickets",
"data": {
"ticketId": 1,
"title": "Bug Fix",
"description": "Fix login issues",
"severity": "3",
"dueDate": "2025-06-20",
"completionPercentage": "97"
}
}
}
}
回應
{
"text": "Mohit custom text",
"executeActionData": "{\"type\":\"AdaptiveCard\",\"$schema\":\"http://adaptivecards.io/schemas/adaptive-card.json\",\"version\":\"1.5\",\"body\":[{\"type\":\"Container\",\"style\":\"good\",\"items\":[{\"type\":\"TextBlock\",\"text\":\"✅ Ticket updated successfully\",\"color\":\"default\",\"weight\":\"bolder\",\"wrap\":true},{\"type\":\"TextBlock\",\"text\":\"1\",\"wrap\":true},{\"type\":\"TextBlock\",\"text\":\"Bug Fix\",\"wrap\":true},{\"type\":\"TextBlock\",\"text\":\"Fix login issues\",\"wrap\":true},{\"type\":\"TextBlock\",\"text\":\"3\",\"wrap\":true},{\"type\":\"TextBlock\",\"text\":\"2025-06-20\",\"wrap\":true},{\"type\":\"TextBlock\",\"text\":\"97\",\"wrap\":true}]}]}",
"messageType": "ExecuteActionResponse",
"author": "bot",
"createdAt": "2025-04-30T11:07:44.9557335+00:00",
"timestamp": "2025-04-30T11:07:44.9557335+00:00",
"messageId": "649112bc-7fe2-40bd-990d-928364fb173c",
"requestId": "3058aa09-c9b6-3425-b0ef-49ef2ad4b9a5",
"offense": "Unknown",
"spokenText": "Ticket updated successfully",
"turnCount": 1
}