Codeunit 4329 Agent User Feedback in 28
- App
- System Application
- Namespace
- System.Agents
Versions171819202122232425262728latest
Source in 28
src/System Application/App/Agent/Interaction/Internal/AgentUserFeedback.Codeunit.al103 lines, Copyright (c) Microsoft Corporation. MIT
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace System.Agents;
using System.Feedback;
codeunit 4329 "Agent User Feedback"
{
InherentEntitlements = X;
InherentPermissions = X;
// The values below align with the existing feature and context properties from the timeline.
var
AgentUserSecurityIdTok: Label 'Copilot.Agents.AgentId', Locked = true;
AgentMetadataProviderTok: Label 'Copilot.Agents.AgentTypeId', Locked = true;
AgentTaskIdTok: Label 'Copilot.Agents.TaskId', Locked = true;
AgentFeatureAreaTok: Label 'Copilot', Locked = true;
AgentFeatureDisplayNameTok: Label 'Copilot', Locked = true;
// The values below are not used by the timeline.
var
AgentTaskLogEntryIdTok: Label 'Copilot.Agents.TaskLogEntryId', Locked = true;
AgentTaskLogEntryTypeTok: Label 'Copilot.Agents.TaskLogEntryType', Locked = true;
[Scope('OnPrem')]
procedure GetAgentMetadataProviderTok(): Text
begin
exit(AgentMetadataProviderTok);
end;
[Scope('OnPrem')]
procedure GetAgentUserSecurityIdTok(): Text
begin
exit(AgentUserSecurityIdTok);
end;
[Scope('OnPrem')]
procedure GetAgentTaskIdTok(): Text
begin
exit(AgentTaskIdTok);
end;
[Scope('OnPrem')]
procedure GetAgentTaskLogEntryIdTok(): Text
begin
exit(AgentTaskLogEntryIdTok);
end;
[Scope('OnPrem')]
procedure GetAgentTaskLogEntryTypeTok(): Text
begin
exit(AgentTaskLogEntryTypeTok);
end;
[Scope('OnPrem')]
procedure InitializeAgentContext(AgentMetadataProvider: Enum "Agent Metadata Provider"; AgentUserSecurityID: Guid) Context: Dictionary of [Text, Text]
begin
Context.Add(AgentMetadataProviderTok, Format(AgentMetadataProvider.AsInteger()));
Context.Add(AgentUserSecurityIdTok, Format(AgentUserSecurityID));
end;
[Scope('OnPrem')]
procedure InitializeAgentTaskContext(TaskId: BigInteger) Context: Dictionary of [Text, Text]
var
Agent: Record Agent;
AgentTaskImpl: Codeunit "Agent Task Impl.";
begin
if not (AgentTaskImpl.TryGetAgentRecordFromTaskId(TaskId, Agent)) then
exit;
Context := InitializeAgentContext(Agent."Agent Metadata Provider", Agent."User Security ID");
Context.Add(AgentTaskIdTok, Format(TaskId));
end;
[Scope('OnPrem')]
procedure RequestFeedback(FeatureName: Text; Context: Dictionary of [Text, Text])
var
MicrosoftUserFeedback: Codeunit "Microsoft User Feedback";
EmptyContextFiles: Dictionary of [Text, Text];
FeedbackType: Text;
CopilotThumbsUpTok: Label 'Copilot.ThumbsUp', Locked = true;
CopilotThumbsDownTok: Label 'Copilot.ThumbsDown', Locked = true;
FeedbackTypeTok: Label 'Feedback.Type', Locked = true;
begin
MicrosoftUserFeedback.SetIsAIFeedback(true);
if Context.ContainsKey(FeedbackTypeTok) then
FeedbackType := Context.Get(FeedbackTypeTok);
case FeedbackType of
CopilotThumbsUpTok:
MicrosoftUserFeedback.RequestLikeFeedback(FeatureName, AgentFeatureAreaTok, AgentFeatureDisplayNameTok, EmptyContextFiles, Context);
CopilotThumbsDownTok:
MicrosoftUserFeedback.RequestDislikeFeedback(FeatureName, AgentFeatureAreaTok, AgentFeatureDisplayNameTok, EmptyContextFiles, Context);
else
MicrosoftUserFeedback.RequestFeedback(FeatureName, AgentFeatureAreaTok, AgentFeatureDisplayNameTok, EmptyContextFiles, Context);
end;
end;
}Procedures, 8
| Name | Parameters | Returns | Access | Obsolete |
|---|---|---|---|---|
| GetAgentMetadataProviderTok | () | Text | public | - |
| GetAgentUserSecurityIdTok | () | Text | public | - |
| GetAgentTaskIdTok | () | Text | public | - |
| GetAgentTaskLogEntryIdTok | () | Text | public | - |
| GetAgentTaskLogEntryTypeTok | () | Text | public | - |
| InitializeAgentContext | (Enum Agent Metadata Provider, Guid) | Dictionary | public | - |
| InitializeAgentTaskContext | (BigInteger) | Dictionary | public | - |
| RequestFeedback | (Text, Dictionary) | public | - |