Description
Versions
botbuilder: 4.23.1
nodejs: 20.11.0
Describe the bug
When using citation with text
and encodingFormat
properties Internal server error
is thrown without any explanation. If these properties or streaming entity is removed, then message is sent to user.
To Reproduce
Here is code snippet that throws mentioned error
...
this.onMessage(async (context, next) => {
if (context.activity.text === "test") {
const activity = await context.sendActivity({
type: ActivityTypes.Typing,
text: "Gathering information...",
entities: [
{
type: "streaminfo",
streamType: "informative", // informative or streaming; default= streaming.
streamSequence: 1, // (required) incremental integer; must be present for start and continue streaming request, but must not be set for final streaming request.
},
],
});
await new Promise((r) => setTimeout(r, 2000));
await context.sendActivity({
type: ActivityTypes.Message,
text: `Hey I'm a friendly AI bot. This message is generated through AI [1]`, // cite with [1],
entities: [
{
streamId: activity.id,
type: "streaminfo",
streamType: "final",
},
{
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
encodingFormat: "application/vnd.microsoft.card.adaptive",
keywords: ["keyword 1", "keyword 2", "keyword 3"], // Appears in the citation pop-up window
image: {
"@type": "ImageObject",
name: "Microsoft Word",
},
},
},
],
},
],
});
return await next();
}
...
Expected behavior
Streaming with informative message sent and final message with additional information about the citation is sent afterwards.
Additional context
Issue appeared couple of days ago, seems like there was some kind of update to azure bot service?
With this issue we also encountered that there can no longer be changes to text when sending final message. Everything that was streamed before should be inside final message text otherwise error with text Request streamed content should contain the previously streamed content
was thrown. We were changing citation numbers so they start from 1 and not in some random order, e.g. [2] [5], and stripping some unnecessary content