microsoft / teams-ai

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

[PY] fix: Use download url if possible in TeamsAttachmentDownloader #1786

Closed heyitsaamir closed 2 days ago

heyitsaamir commented 6 days ago

Linked issues

closes: #1789

Details

If download_url is available, it uses that to download the corresponding file in TeamsAttachmentDownloader. This is using the guidance here: https://devblogs.microsoft.com/microsoft365dev/working-with-files-in-your-microsoft-teams-bot/

Change details

Looks like a similar

Describe your changes, with screenshots and code snippets as appropriate

Looks like similar logic is in the C# codebase too: https://github.com/microsoft/teams-ai/blob/0534743ff7a65d7e8718111a53c0afee22179a4b/dotnet/packages/Microsoft.TeamsAI/Microsoft.TeamsAI/Application/TeamsAttachmentDownloader.cs#L83

I added a unit test and also tested it locally by sending myself a markdown file. Without this change, I got a 403 error. With this, the file was successfully downloaded.

lilyydu commented 2 days ago

Thanks for finding this bug and resolving it, @heyitsaamir!