Skip to content

Commit

Permalink
fix(cea): fix cea code for custom api template (#13054)
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethBWSong authored Jan 15, 2025
1 parent ad64394 commit 8841ff2
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/fx-core/src/component/generator/apiSpec/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1298,9 +1298,21 @@ app.ai.action("{{operationId}}", async (context, state, parameter) => {
}
const cardName = "{{operationId}}".replace(/[^a-zA-Z0-9]/g, "_");
const cardTemplatePath = path.join(__dirname, '../adaptiveCards', cardName + '.json');
const isTeamsChannel = context.activity.channelId === Channels.Msteams;
if (await fs.exists(cardTemplatePath)){
const card = generateAdaptiveCard(cardTemplatePath, result);
await context.sendActivity({ attachments: [card] });
await context.sendActivity({
attachments: [card],
...(isTeamsChannel ? { channelData: { feedbackLoopEnabled: true }} : {}),
entities: [
{
type: "https://schema.org/Message",
"@type": "Message",
"@context": "https://schema.org",
additionalType: ["AIGeneratedContent"], // AI Generated label
},
]
});
}
else {
await context.sendActivity(JSON.stringify(result.data));
Expand Down Expand Up @@ -1330,7 +1342,7 @@ app.ai.action("{{operationId}}", async (context: TurnContext, state: Application
const card = generateAdaptiveCard(cardTemplatePath, result);
await context.sendActivity({
attachments: [card],
...(isTeamsChannel ? { channelData: true } : {}),
...(isTeamsChannel ? { channelData: { feedbackLoopEnabled: true }} : {}),
entities: [
{
type: "https://schema.org/Message",
Expand Down

0 comments on commit 8841ff2

Please sign in to comment.