通过允许内联编辑,可以增强智能 智能 Microsoft 365 Copilot 副驾驶® 副驾驶® 的声明性代理中的自适应卡响应。 这种方法允许卡收集输入数据,向应用程序发送结构化有效负载,并根据返回的响应动态更新卡 - 无需离开代理表面即可创建无缝、有状态的交互。
本文介绍如何使用 Action.Execute 自自适应卡架构版本 1.5) 开始的函数 (向 Copilot 代理响应添加模式对话框。 这些对话框允许用户通过自适应卡编辑和提交信息。
注意
该 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
}