Repository navigation
[Teams Chatbot] Enable image input through Teams connector downloads - #17428
Open
Jialin Huang (JialinHuang803) wants to merge 19 commits into
Open
Jialin Huang (JialinHuang803) wants to merge 19 commits into
Jialin Huang (JialinHuang803) wants to merge 19 commits into
Conversation
Preserve Teams image attachments, download Graph hosted content through the Logic App Teams connection, and forward validated inline image bytes to Foundry. Handle payload size, logging, and conversation storage constraints. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Jialin Huang (JialinHuang803)
requested review from
Jiaqi Zhang (JiaqiZhang-Dev) and
Crystal YU (chunyu3)
as code owners
October 29, 2026 02:20
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> # Conflicts: # tools/sdk-ai-bots/azure-sdk-qa-bot-agent/tests/chat_service_test.py
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
HTTPX INFO logging exposes full preauthenticated SharePoint/OneDrive download URLs and their access-granting query parameters in backend logs despite the exception-logging safeguard.
1 open issue
What changed in this PR
Adds image context to the Teams QA bot’s answer-generation flow, using the existing Teams connector to download Graph-hosted images and forward them to Foundry.
Changes:
- Preserves inline images and uploaded image references, with authenticated backend downloads as a fallback.
- Adds image format validation, four-image and 5 MiB limits, and notices for unavailable image context.
- Increases the bot’s request-body limit, reduces image payload logging, and excludes inline bytes from conversation storage.
| File | Description |
|---|---|
tools/sdk-ai-bots/azure-sdk-qa-bot/test/ragImages.test.ts |
Tests payload forwarding and log redaction. |
tools/sdk-ai-bots/azure-sdk-qa-bot/test/promptGenerator.test.ts |
Tests connector-image prompt handling. |
tools/sdk-ai-bots/azure-sdk-qa-bot/test/messageBodyParser.test.ts |
Tests request-body size limits. |
tools/sdk-ai-bots/azure-sdk-qa-bot/test/logicAppImages.test.ts |
Tests connector download configuration and image preparation. |
tools/sdk-ai-bots/azure-sdk-qa-bot/test/conversation.test.ts |
Tests inline-byte exclusion from storage and updates constructor mocks. |
tools/sdk-ai-bots/azure-sdk-qa-bot/src/models/RAGModel.ts |
Replaces image-bearing logs with summaries. |
tools/sdk-ai-bots/azure-sdk-qa-bot/src/input/PromptGenerator.ts |
Omits image URLs from raw-prompt logs. |
tools/sdk-ai-bots/azure-sdk-qa-bot/src/input/messageBodyParser.ts |
Defines the 30 MiB JSON parser. |
tools/sdk-ai-bots/azure-sdk-qa-bot/src/input/ConversationHandler.ts |
Excludes inline image bytes from stored prompts. |
tools/sdk-ai-bots/azure-sdk-qa-bot/src/index.ts |
Enables the larger request-body parser. |
tools/sdk-ai-bots/azure-sdk-qa-bot/src/backend/rag.ts |
Redacts inline payloads and limits Axios error logging. |
tools/sdk-ai-bots/azure-sdk-qa-bot-agent/utils/teams_image.py |
Validates image data and handles bounded authenticated downloads. |
tools/sdk-ai-bots/azure-sdk-qa-bot-agent/tests/teams_image_test.py |
Covers authentication, validation, redirects, and image forwarding. |
tools/sdk-ai-bots/azure-sdk-qa-bot-agent/tests/chat_service_test.py |
Tests model image content, limits, and failure notices. |
tools/sdk-ai-bots/azure-sdk-qa-bot-agent/tests/activity_converter_service_test.py |
Tests image extraction, source validation, and deduplication. |
tools/sdk-ai-bots/azure-sdk-qa-bot-agent/services/chat_service.py |
Enforces image-count limits and reports unavailable context. |
tools/sdk-ai-bots/azure-sdk-qa-bot-agent/services/activity_converter_service.py |
Preserves supported inline and file-image attachments. |
tools/sdk-ai-bots/azure-sdk-qa-bot-agent/README.md |
Documents permissions, deployment, testing, and limitations. |
tools/sdk-ai-bots/azure-sdk-qa-bot-agent/pipelines/logicapp/template.json |
Downloads connector images and forwards data URIs with protected action history. |
Review effort: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace foreach result aggregation with four guarded download slots, preserving secure image payloads through direct capture outputs. Continue after failed or unused slots and cover the secured-output topology with regression tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep image preparation in one scope, start all four guarded downloads after filtering, and join direct secured capture outputs. Gate bot invocation on successful activity preparation so failed downloads do not block a ready reply. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Invoke the bot directly after successful image preparation while retaining partial download fallback and secured HTTP inputs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Check converted attachments before entering image processing, and send non-image activities directly to the bot with secured request inputs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Jiaqi Zhang (JiaqiZhang-Dev)
approved these changes
Nov 5, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Enable the Teams chatbot to use inline screenshots when answering channel messages.
Addresses Azure/azure-sdk-pr#2316.
The Logic App downloads images through its existing Teams connection; the backend receives image bytes and does not need Graph download permissions.
Image recognition happens in the hosted agent's vision-capable model.
Data flow: Teams HTML → image attachment URLs → connector downloads → base64 data URIs → frontend → backend → model
input_image.Changes by component
1. Backend: activity converter
services/activity_converter_service.py<img src>references from message HTML and add deduplicatedimage/*attachments to the Bot Framework activity.2. Logic App: image downloads
pipelines/logicapp/template.json3. Frontend: Teams bot
src/index.ts,src/input/,src/models/RAGModel.ts,src/backend/rag.tsprompt.images→additional_infos[].linkcontract.4. Backend: chat service and image validation
services/chat_service.py,utils/teams_image.pyinput_imageitems, with guidance to treat instructions inside images as untrusted content.5. Teams manifest and environment tags
supportsChannelFeatures: "tier1".dev-0.0.32,preprod-0.0.15, andprod-0.0.14.Scope and limitations
Validation
main.Testing: Teams Post Teams Post
Logic app run history