Skip to content

Conversation

@MehakBindra
Copy link
Collaborator

@MehakBindra MehakBindra commented Jul 17, 2025

  • Config.cs: Defines configuration option classes for GitHub and Azure, with properties for client IDs, tokens, and endpoints.

  • ConversationInfo.cs: Holds Teams conversation metadata such as bot ID, conversation ID, service URL, chat history, group status, and channel ID.

  • GitHubService.cs:

    • HandleWebhook: Processes incoming GitHub webhook events and routes them to assignment or status handlers.
    • HandlePRAssignments: Sends an adaptive card to Teams when a PR is assigned.
    • HandlePRStatusChanges: Sends an adaptive card to Teams when a PR status changes.
  • GitHubPlugin.cs:

    • ListPRs: Lists all pull requests in the configured repository and sends an adaptive card to Teams.
    • FilterPRs: Filters pull requests by label, assignee, or author and sends a filtered adaptive card to Teams.
  • GithubCards.cs:

    • CreateListPRsAdaptiveCard: Builds an adaptive card listing PRs with filter controls.
    • CreateFilterPRsAdaptiveCard: Builds an adaptive card for filtered PRs.
    • CreatePRItemContainer: Creates a card section for a single PR, including metadata and actions.
    • CreatePullRequestCard: Builds an adaptive card for PR assignment notifications.
    • CreatePullRequestStatusCard: Builds an adaptive card for PR status updates.
  • Controllers/ApiController.cs:

    • PostAsync: Receives GitHub webhook POST requests at /api/webhook and passes the payload to the repository service for handling.
  • Controllers/TeamsController.cs:

    • OnSignOutMessage: Signs out the user from Teams and confirms sign-out.
    • OnAdaptiveCardAction: Handles adaptive card actions for PR filtering and invokes the plugin.
    • OnMessage: Handles incoming Teams messages, manages GitHub authentication, and triggers chat orchestration.
    • OnSignIn: Handles GitHub sign-in events and updates configuration with the user's token.
  • KernelFactory.cs:

    • Create: Builds and configures the Semantic Kernel instance, registers plugins, and sets up OpenAI chat completion.
  • KernelOrchestrator.cs:

    • InitiateChat: Initializes chat history and system prompt for a new conversation.
    • CreateChatHistory: Adds user or assistant messages to chat history and persists it.
    • SaveActivityToChatHistory: Saves assistant activity to chat history.
    • GetChatMessageContentAsync: Handles chat completion and plugin invocation for Teams messages.
  • Program.cs: Configures dependency injection, sets up Teams and GitHub services, and starts the ASP.NET Core web application.

Copilot AI review requested due to automatic review settings July 17, 2025 16:31
@MehakBindra MehakBindra marked this pull request as draft July 17, 2025 16:31
@MehakBindra MehakBindra requested review from lilyydu and singhk97 July 17, 2025 16:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the Dex Agent sample to the Microsoft 365 Agents Toolkit (Teams App SDK), refactors the bot from the Bot Framework SDK to the new Teams.Cards and Teams.Api libraries, and overhauls the orchestration of chat history using a KernelOrchestrator with local storage.

  • Restructure core services and plugins under Microsoft.Teams.Apps and replace IRepositoryPlugin/IRepositoryService implementations.
  • Update adaptive card generation to use the new Teams.Cards library.
  • Revise provisioning YAML and Bicep templates to use the latest Teams Toolkit schemas and parameters.
  • Introduce KernelOrchestrator for managing chat history and streaming responses.
  • Define new configuration classes (ConfigOptions, GitHubConfigOptions, AzureConfigOptions) aligned with the updated appsettings format.

Reviewed Changes

Copilot reviewed 54 out of 69 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
dotnet/DexAgent/DexAgent/Interfaces/IRepsoitoryPlugin.cs Defines the base plugin interface (typo in filename)
dotnet/DexAgent/DexAgent/Config.cs Adds new GitHubConfigOptions and AzureConfigOptions
dotnet/DexAgent/DexAgent/GithubCards.cs Refactors adaptive card creation with Teams.Cards library
dotnet/DexAgent/DexAgent/GitHubModels/GitHubUser.cs Updates GitHub user model to use Newtonsoft.Json and nullables
dotnet/DexAgent/DexAgent/KernelOrchestrator.cs New orchestration logic for chat history and streaming
Comments suppressed due to low confidence (4)

dotnet/DexAgent/DexAgent/Interfaces/IRepsoitoryPlugin.cs:1

  • The interface file and name are misspelled as IRepsoitoryPlugin. Rename to IRepositoryPlugin and correct the file name.
using System.ComponentModel;

dotnet/DexAgent/DexAgent/GithubCards.cs:13

  • The file is named GithubCards.cs but the class is GitHubCards. Rename the file to GitHubCards.cs to match the class name and casing.
    public class GitHubCards

dotnet/DexAgent/DexAgent/KernelOrchestrator.cs:12

  • The new KernelOrchestrator class contains significant orchestration logic but currently lacks automated unit tests. Consider adding tests for chat history serialization, storage interactions, and streaming behavior.
    public class KernelOrchestrator

dotnet/DexAgent/DexAgent/Config.cs:19

  • The GitHubConfigOptions class expects an AuthToken property, but the JSON configuration uses ClientId/ClientSecret. Ensure the property names align with the JSON schema or adjust the JSON keys.
        public string? AuthToken { get; set; }  


ChatHistory history = JsonSerializer.Deserialize<ChatHistory>(currConvo.ChatHistory);
history.AddUserMessage(turnContext.Activity.Text);
ChatHistory? history = JsonSerializer.Deserialize<ChatHistory>(currConvo.ChatHistory ?? string.Empty);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if Deserialize or AddMessage throw, will currConvo make it back into the conversation list?

@MehakBindra MehakBindra changed the title Base Code for Dex V2 - Tested for 1:1 Dex Migration to V2 Jul 23, 2025
@MehakBindra MehakBindra marked this pull request as ready for review July 23, 2025 22:30
fix proactive messaging in channel

fix adaptive card union

add cached token saving

use app.send for channels
@MehakBindra MehakBindra force-pushed the Mehak/DexV2 branch 2 times, most recently from 3b5892e to 33042fb Compare July 29, 2025 00:56
Copy link
Contributor

@singhk97 singhk97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Left a comment about a possible breaking change w.r.t the template gallery.

Copy link
Contributor

@lilyydu lilyydu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delayed review, left some clarification comments! If this spans multiple PRs, could you provide a detailed desc above for easier following? :)

@MehakBindra MehakBindra requested review from lilyydu and singhk97 July 29, 2025 17:25
@MehakBindra
Copy link
Collaborator Author

@lilyydu @kavins14 , this PR will only be valid if microsoft/teams.net#92 and microsoft/teams.net#90 are merged. Since we're waiting on the adaptive card changes to be done with a code generator, we'll have to wait to resolve this too ?

Update README.md

Update README.md

Update README.md

rename DexAgent to dex-agent

fix minor

add env files

add devtunnel img

add devtunnel img
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants