Skip to content

Commit

Permalink
[Copilot] Minor fixes and additions for AI module (#416)
Browse files Browse the repository at this point in the history
<!-- Thank you for submitting a Pull Request. If you're new to
contributing to BCApps please read our pull request guideline below
* https://github.com/microsoft/BCApps/Contributing.md
-->
#### Summary <!-- Provide a general summary of your changes -->
- Add subscriber to `GetCopilotCapabilityStatus` to return if a copilot
capability is enabled
- Add captions to the Copilot Status enum for translation
- Add Copilot Status to dimensions for onmodify
- Add additional search term to Copilot & Capabilities page

#### Work Item(s) <!-- Add the issue number here after the #. The issue
needs to be open and approved. Submitting PRs with no linked issues or
unapproved issues is highly discouraged. -->
Fixes AB#492257 AB#492176 AB#491285 AB#491283
  • Loading branch information
darjoo authored Dec 8, 2023
1 parent d143cab commit 03d00da
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ page 7775 "Copilot AI Capabilities"
DataCaptionExpression = '';
AboutTitle = 'About Copilot';
AboutText = 'Copilot is the AI-powered assistant that helps people across your organization unlock their creativity and automate tedious tasks.';
AdditionalSearchTerms = 'OpenAI,AI,Copilot,Co-pilot,Artificial Intelligence,GPT,GTP,Dynamics 365 Copilot,ChatGPT,Copilot settings,Copilot setup,enable Copilot,Copilot admin';
AdditionalSearchTerms = 'OpenAI,AI,Copilot,Co-pilot,Artificial Intelligence,GPT,GTP,Dynamics 365 Copilot,ChatGPT,Copilot settings,Copilot setup,enable Copilot,Copilot admin,Copilot and';
InsertAllowed = false;
DeleteAllowed = false;
Extensible = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ using System.Globalization;
using System.Telemetry;
using System.Security.User;
using System.Azure.Identity;
using System.Environment;
using System.Privacy;

codeunit 7774 "Copilot Capability Impl"
Expand Down Expand Up @@ -82,6 +83,7 @@ codeunit 7774 "Copilot Capability Impl"
Commit();

AddTelemetryDimensions(CopilotCapability, CallerModuleInfo.Id(), CustomDimensions);
AddStatusTelemetryDimension(CopilotSettings.Status, CustomDimensions);
FeatureTelemetry.LogUsage('0000LDW', CopilotCategoryLbl, TelemetryModifiedCopilotCapabilityLbl, CustomDimensions);
end;

Expand Down Expand Up @@ -198,6 +200,19 @@ codeunit 7774 "Copilot Capability Impl"
exit(CopilotCategoryLbl);
end;

procedure AddStatusTelemetryDimension(CopilotStatus: Enum "Copilot Status"; var CustomDimensions: Dictionary of [Text, Text])
var
Language: Codeunit Language;
SavedGlobalLanguageId: Integer;
begin
SavedGlobalLanguageId := GlobalLanguage();
GlobalLanguage(Language.GetDefaultApplicationLanguageId());

CustomDimensions.Add('Status', Format(CopilotStatus));

GlobalLanguage(SavedGlobalLanguageId);
end;

procedure AddTelemetryDimensions(CopilotCapability: Enum "Copilot Capability"; AppId: Guid; var CustomDimensions: Dictionary of [Text, Text])
var
Language: Codeunit Language;
Expand Down Expand Up @@ -230,4 +245,14 @@ codeunit 7774 "Copilot Capability Impl"
TempPrivacyNotice."Integration Service Name" := AzureOpenAiTxt;
if not TempPrivacyNotice.Insert() then;
end;

[EventSubscriber(ObjectType::Codeunit, Codeunit::"System Action Triggers", 'GetCopilotCapabilityStatus', '', false, false)]
local procedure GetCopilotCapabilityStatus(Capability: Integer; var IsEnabled: Boolean)
var
AzureOpenAI: Codeunit "Azure OpenAI";
CopilotCapability: Enum "Copilot Capability";
begin
CopilotCapability := Enum::"Copilot Capability".FromInteger(Capability);
Isenabled := AzureOpenAI.IsEnabled(CopilotCapability, true);
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ enum 7775 "Copilot Status"
/// </summary>
value(0; Active)
{
Caption = 'Active';
}

/// <summary>
/// The Copilot is inactive.
/// </summary>
value(1; Inactive)
{
Caption = 'Inactive';
}
}

0 comments on commit 03d00da

Please sign in to comment.