microsoft / teams-ai

SDK focused on building AI based applications and extensions for Microsoft Teams and other Bot Framework channels
MIT License
390 stars 169 forks source link

[Bug]: The Bot Framework SDK for C# does not return a value in the Activity.LocalTimezone property when using Copilot in Microsoft Teams #1493

Open rfessia opened 5 months ago

rfessia commented 5 months ago

Language

C#

Version

12

Description

In Microsoft Teams, when we use copilot the Activity.LocalTimezone property (in Bot Framework SDK) has no value, while if we perform a query without using copilot, it returns a value.

In the official Microsoft documentation it says that this property can be used to get the time zone from messages. We need to know the user's LocalTimeZone to make correct filters in our system: https://learn.microsoft.com/en-us/dotnet/api/microsoft.bot.schema.activity.localtimezone?view=botbuilder-dotnet-stable


BUG WHEN USING COPILOT:

  1. Messaging extension query USING COPILOT: Send a prompt to copilot in the new Microsof Teams.

meqc1

  1. Check incoming request: There is not localTimezone in the request.
{
  "type": "invoke",
  "id": "xxx",
  "timestamp": "2024-04-04T01:23:34.4625434Z",
  "localTimestamp": "2024-04-04T01:23:34.4625442+00:00",
  "serviceUrl": "https://smba.trafficmanager.net/teams",
  "channelId": "m365extensions",
  "from": {
    "id": "xxx",
    "name": "xxx",
    "aadObjectId": "xxx"
  },
  "conversation": {
    "tenantId": "xxx",
    "id": "outlook:xxx",
    "aadObjectId": "xxx"
  },
  "recipient": {
    "id": "xxx",
    "name": "xxx"
  },
  "locale": "en-us",
  "entities": [{ "type": "clientInfo", "locale": "en-us" }],
  "channelData": {
    "tenant": { "id": "xxx" },
    "source": { "name": "copilot" }
  },
  "value": {
    "commandId": "xxx",
    "parameters": [{ "name": "xxx", "value": "xxx" }],
    "queryOptions": { "skip": 0, "count": 10 }
  },
  "name": "composeExtension/query"
}
  1. Check Bot Framework SDK for C#: The LocalTimeZone property in TurnContext is null.

bf1


SUCCESSFUL REQUEST WHEN NOT USING COPILOT

  1. Messaging extension query WITHOUT USING COPILOT: Send a message extensions in Microsoft Teams.

meqc2

  1. Check incoming request: The localTimezone is present in the request.
{
  "name": "composeExtension/query",
  "type": "invoke",
  "timestamp": "2024-04-04T01:20:30.421Z",
  "localTimestamp": "2024-04-04T14:20:30.421+13:00",
  "id": "f:xxx",
  "channelId": "msteams",
  "serviceUrl": "https://smba.trafficmanager.net/apac/",
  "from": {
    "id": "29:xxx",
    "name": "xxx",
    "aadObjectId": "xxx"
  },
  "conversation": {
    "conversationType": "personal",
    "tenantId": "xxx",
    "id": "a:xxx"
  },
  "recipient": {
    "id": "28:xxx",
    "name": "xxx"
  },
  "entities": [
    {
      "locale": "en-US",
      "country": "US",
      "platform": "Windows",
      "timezone": "Pacific/Auckland",
      "type": "clientInfo"
    }
  ],
  "channelData": {
    "tenant": { "id": "xxx" },
    "source": { "name": "compose" }
  },
  "value": {
    "commandId": "xxx",
    "parameters": [{ "name": "initialRun", "value": "true" }],
    "queryOptions": { "count": 25, "skip": 0 }
  },
  "locale": "en-US",
  "localTimezone": "Pacific/Auckland"
}
  1. Check Bot Framework SDK for C#: The LocalTimeZone property has value in ITurnContext :)

bf2

P.S., Some values in the request were replaced with "xxx" just for security reasons.


STACK VERSION:

All packages used in the project:

pk


Thank you, I look forward to your prompt response, Regards

Reproduction Steps

BUG:
1. Send a message to the co-pilot in Microsoft Teams (desktop and web versions)
2. Check `Activity.LocalTimezone` in Bot Framework SDK for C#
3. The SDK Bot Framework has no value for the local time zone
aacebo commented 5 months ago

Hello, this issue seems to be with the underlying Bot Framework SDK, which is managed by a different team in a different repository. https://github.com/microsoft/botbuilder-dotnet, I would suggest contacting them to better understand what could be causing the issue.

rfessia commented 4 months ago

Hello @aacebo! The Bot Framework SDK team has told us that it is not a problem with the SDK, could you tell us where we should report it? Thank you! https://github.com/microsoft/botbuilder-dotnet/issues/6770