-
Notifications
You must be signed in to change notification settings - Fork 368
Expand file tree
/
Copy pathAgentConsumptionOverview.Codeunit.al
More file actions
63 lines (57 loc) · 2.56 KB
/
AgentConsumptionOverview.Codeunit.al
File metadata and controls
63 lines (57 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// ------------------------------------------------------------------------------------------------
// 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;
codeunit 4333 "Agent Consumption Overview"
{
InherentEntitlements = X;
InherentPermissions = X;
Permissions = tabledata "Agent Task" = r;
/// <summary>
/// Gets the total Copilot credits consumed by the agent task.
/// </summary>
/// <param name="TaskId">The ID of the agent task to get consumed credits for.</param>
/// <returns>The total Copilot credits consumed by the agent task.</returns>
procedure GetCopilotCreditsConsumed(TaskId: BigInteger): Decimal
var
AgentUtilities: Codeunit "Agent Utilities";
begin
exit(AgentUtilities.GetConsumedCopilotCredits(TaskId));
end;
/// <summary>
/// Opens the agent consumption overview page for the specified agent.
/// </summary>
/// <param name="AgentUserSecurityId">The agent user security ID.</param>
procedure OpenAgentConsumptionOverview(AgentUserSecurityId: Guid)
var
AgentTaskConsumption: Record "Agent Task Consumption";
begin
AgentTaskConsumption.SetRange("Agent User Security ID", AgentUserSecurityId);
Page.Run(Page::"Agent Consumption Overview", AgentTaskConsumption);
end;
/// <summary>
/// Opens the agent consumption overview page for the specified agent task.
/// </summary>
/// <param name="TaskId">The ID of the agent task.</param>
procedure OpenAgentTaskConsumptionOverview(TaskId: BigInteger)
var
AgentTaskConsumption: Record "Agent Task Consumption";
begin
AgentTaskConsumption.SetRange("Task ID", TaskId);
Page.Run(Page::"Agent Consumption Overview", AgentTaskConsumption);
end;
/// <summary>
/// Opens the agent consumption overview page for the agent tasks matching the specified filter.
/// </summary>
/// <param name="TaskIDFilter">The filter for the agent task IDs.</param>
procedure OpenAgentTaskConsumptionOverview(TaskIDFilter: Text)
var
AgentTaskConsumption: Record "Agent Task Consumption";
AgentConsumptionOverview: Page "Agent Consumption Overview";
begin
AgentTaskConsumption.SetFilter("Task ID", TaskIDFilter);
AgentConsumptionOverview.SetTableView(AgentTaskConsumption);
AgentConsumptionOverview.Run();
end;
}