-
Notifications
You must be signed in to change notification settings - Fork 29
Dex Migration to V2 #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.Appsand replaceIRepositoryPlugin/IRepositoryServiceimplementations. - 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
KernelOrchestratorfor 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 toIRepositoryPluginand correct the file name.
using System.ComponentModel;
dotnet/DexAgent/DexAgent/GithubCards.cs:13
- The file is named
GithubCards.csbut the class isGitHubCards. Rename the file toGitHubCards.csto match the class name and casing.
public class GitHubCards
dotnet/DexAgent/DexAgent/KernelOrchestrator.cs:12
- The new
KernelOrchestratorclass 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
GitHubConfigOptionsclass expects anAuthTokenproperty, but the JSON configuration usesClientId/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); |
There was a problem hiding this comment.
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?
fix proactive messaging in channel fix adaptive card union add cached token saving use app.send for channels
3b5892e to
33042fb
Compare
singhk97
left a comment
There was a problem hiding this 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.
There was a problem hiding this 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? :)
|
@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
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/webhookand 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.