Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ codeunit 7772 "Azure OpenAI Impl" implements "AI Service Name"
GenerateChatCompletion(ChatMessages, AOAIChatCompletionParams, AOAIOperationResponse, CallerModuleInfo);
end;

[NonDebuggable]
procedure GenerateChatCompletion(var ChatMessages: Codeunit "AOAI Chat Messages"; AOAIChatCompletionParams: Codeunit "AOAI Chat Completion Params"; var AOAIOperationResponse: Codeunit "AOAI Operation Response"; CallerModuleInfo: ModuleInfo)
var
AOAIPolicyParams: Codeunit "AOAI Policy Params";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,30 @@ codeunit 7783 "AOAI User Message"
/// Adds a text content part to the user message.
/// </summary>
/// <param name="TextContent">The text content to add.</param>
[Scope('OnPrem')]
Comment thread
Groenbech96 marked this conversation as resolved.
Comment thread
Groenbech96 marked this conversation as resolved.
#pragma warning disable AS0022
procedure AddTextPart(TextContent: Text)
#pragma warning restore AS0022
var
CallerModuleInfo: ModuleInfo;
begin
AOAIUserMessageImpl.AddTextPart(TextContent);
NavApp.GetCallerModuleInfo(CallerModuleInfo);
AOAIUserMessageImpl.AddTextPart(TextContent, CallerModuleInfo);
end;

/// <summary>
/// Adds a file content part to the user message.
/// </summary>
/// <param name="FileData">The file data to add (e.g. base64-encoded content).</param>
[Scope('OnPrem')]
#pragma warning disable AS0022
procedure AddFilePart(FileData: Text)
#pragma warning restore AS0022
var
CallerModuleInfo: ModuleInfo;
begin
AOAIUserMessageImpl.AddFilePart(FileData);
NavApp.GetCallerModuleInfo(CallerModuleInfo);
AOAIUserMessageImpl.AddFilePart(FileData, CallerModuleInfo);
end;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,33 @@ codeunit 7784 "AOAI User Message Impl"
InherentPermissions = X;

var
CopilotCapabilityImpl: Codeunit "Copilot Capability Impl";
[NonDebuggable]
ContentParts: JsonArray;
HasFileContent, HasTextContent : Boolean;
NotMicrosoftPublisherErr: Label 'This functionality is only available to Microsoft published apps.';

[NonDebuggable]
procedure AddTextPart(TextContent: Text)
procedure AddTextPart(TextContent: Text; CallerModuleInfo: ModuleInfo)
var
TextPartObject: JsonObject;
begin
if not CopilotCapabilityImpl.IsPublisherMicrosoft(CallerModuleInfo) then
Comment thread
Groenbech96 marked this conversation as resolved.
Error(NotMicrosoftPublisherErr);
TextPartObject.Add('type', 'text');
TextPartObject.Add('text', TextContent);
ContentParts.Add(TextPartObject);
HasTextContent := true;
end;

[NonDebuggable]
procedure AddFilePart(FileData: Text)
procedure AddFilePart(FileData: Text; CallerModuleInfo: ModuleInfo)
var
FilePartObject: JsonObject;
FileDataObject: JsonObject;
begin
if not CopilotCapabilityImpl.IsPublisherMicrosoft(CallerModuleInfo) then
Error(NotMicrosoftPublisherErr);
FileDataObject.Add('file_data', FileData);
FilePartObject.Add('type', 'file');
FilePartObject.Add('file', FileDataObject);
Expand Down
Loading