Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating with citations and feedback changes #1490

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 49 additions & 29 deletions samples/bot-conversation/nodejs/bots/teamsConversationBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,47 +199,54 @@ class TeamsConversationBot extends TeamsActivityHandler {
}

async addFeedbackButtons(turnContext) {
// Send a message with a custom feedback loop
await turnContext.sendActivity({
type: ActivityTypes.Message,
text: `This is an example for Feedback buttons that helps to provide feedback for a bot message`,
text: "We'd love to hear your thoughts! Please click below to provide feedback.",
channelData: {
feedbackLoopEnabled: true // Enable feedback buttons
feedbackLoop: {
type: "custom" // This triggers the custom feedback flow
}
},
});
}

async addCitations(turnContext) {
await turnContext.sendActivity({
type: ActivityTypes.Message,
text: `Hey I'm a friendly AI bot. This message is an example for Citaion - [1]`, // cite with [1]
text: `Hey I'm a friendly AI bot. This message is generated through AI [1]`, // cite with [1],
Copy link
Preview

Copilot AI Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comma at the end of the line is likely a typo and should be removed.

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
entities: [
{
type: "https://schema.org/Message",
"@type": "Message",
"@context": "https://schema.org",
"@id": "",
citation: [
{
"@type": "Claim",
position: 1, // Required. Should match the [1] in the text above
appearance: {
"@type": "DigitalDocument",
name: "Some secret citation", // Title
url: "https://example.com/claim-1", // Hyperlink on the title
abstract: "Excerpt", // Excerpt (abstract)
encodingFormat: "docx",
keywords: ["Keyword1 - 1", "Keyword1 - 2", "Keyword1 - 3"], // Keywords
usageInfo: {
"@type": "CreativeWork",
name: "Confidential \\ Contoso FTE", // Sensitivity title
description: "Only accessible to Contoso FTE", // Sensitivity description
},
},
},
],
{
type: "https://schema.org/Message",
"@type": "Message",
"@context": "https://schema.org",
citation: [
{
"@type": "Claim",
position: 1, // Required. Must match the [1] in the text above
appearance: {
"@type": "DigitalDocument",
name: "AI bot", // Title
url: "https://example.com/claim-1", // Hyperlink on the title
abstract: "Excerpt description", // Appears in the citation pop-up window
text: "{\"type\":\"AdaptiveCard\",\"$schema\":\"http://adaptivecards.io/schemas/adaptive-card.json\",\"version\":\"1.6\",\"body\":[{\"type\":\"TextBlock\",\"text\":\"Adaptive Card text\"}]}", // Appears as a stringified Adaptive Card
keywords: ["keyword 1", "keyword 2", "keyword 3"], // Appears in the citation pop-up window
encodingFormat: "application/vnd.microsoft.card.adaptive",
usageInfo: {
"@type": "CreativeWork",
name: "Confidential \\ Contoso FTE", // Sensitivity title
description: "Only accessible to Contoso FTE", // Sensitivity description
},
image: {
"@type": "ImageObject",
name: "Microsoft Word"
},
},
},
],
});
],
},
],
})
}

// Checks the count of members who have read the message sent by MessageAllMembers command.
Expand All @@ -255,6 +262,19 @@ class TeamsConversationBot extends TeamsActivityHandler {
async onInvokeActivity(context) {
try {
switch (context.activity.name) {
case "message/fetchTask":
return {
task: {
type: "continue",
value: {
title: "Task Module Title",
height: 500,
width: "medium",
url: "https://contoso.com/msteams/taskmodules/newcustomer",
fallbackUrl: "https://contoso.com/msteams/taskmodules/newcustomer"
}
}
};
case "message/submitAction":
return await context.sendActivity("Provided reaction : " + context.activity.value.actionValue.reaction + "<br> Feedback : " + JSON.parse(context.activity.value.actionValue.feedback).feedbackText);
default:
Expand Down