diff --git a/src/Tools/AI Test Toolkit/src/Logs/AITTestData.Codeunit.al b/src/Tools/AI Test Toolkit/src/Logs/AITTestData.Codeunit.al
index 35506c2efd..96843dd984 100644
--- a/src/Tools/AI Test Toolkit/src/Logs/AITTestData.Codeunit.al
+++ b/src/Tools/AI Test Toolkit/src/Logs/AITTestData.Codeunit.al
@@ -11,6 +11,9 @@ codeunit 149035 "AIT Test Data"
{
Access = Internal;
+ var
+ TurnsLbl: Label '%1: %2
', Comment = '%1 = The turn number as an integer, %2 = The data from that turn', Locked = true;
+
procedure UpdateTestInput(TestInput: Text; TestInputView: Enum "AIT Test Input - View"): Text
var
TestData: Codeunit "Test Input Json";
@@ -21,15 +24,15 @@ codeunit 149035 "AIT Test Data"
TestInputView::"Full Input":
exit(TestInput);
TestInputView::Question:
- exit(GetTestDataElement('question', TestData));
+ exit(FilterToElement('question', TestData));
TestInputView::Context:
- exit(GetTestDataElement('context', TestData));
+ exit(FilterToElement('context', TestData));
TestInputView::"Test Setup":
- exit(GetTestDataElement('test_setup', TestData));
+ exit(FilterToElement('test_setup', TestData));
TestInputView::"Ground Truth":
- exit(GetTestDataElement('ground_truth', TestData));
+ exit(FilterToElement('ground_truth', TestData));
TestInputView::"Expected Data":
- exit(GetTestDataElement('expected_data', TestData));
+ exit(FilterToElement('expected_data', TestData));
else
exit('');
end;
@@ -45,13 +48,13 @@ codeunit 149035 "AIT Test Data"
TestOutputView::"Full Output":
exit(TestOutput);
TestOutputView::Answer:
- exit(GetTestDataElement('answer', TestData));
+ exit(FilterToElement('answer', TestData));
TestOutputView::Question:
- exit(GetTestDataElement('question', TestData));
+ exit(FilterToElement('question', TestData));
TestOutputView::Context:
- exit(GetTestDataElement('context', TestData));
+ exit(FilterToElement('context', TestData));
TestOutputView::"Ground Truth":
- exit(GetTestDataElement('ground_truth', TestData));
+ exit(FilterToElement('ground_truth', TestData));
else
exit('');
end;
@@ -65,20 +68,38 @@ codeunit 149035 "AIT Test Data"
TestData.Initialize(TestDataText);
end;
- local procedure GetTestDataElement(ElementName: Text; TestData: Codeunit "Test Input Json"): Text
+ local procedure FilterToElement(ElementName: Text; TestData: Codeunit "Test Input Json"): Text
var
- ElementTestDataJson: Codeunit "Test Input Json";
- ElementExists: Boolean;
+ TurnsDataJson: Codeunit "Test Input Json";
+ ElementJson: Codeunit "Test Input Json";
+ TextBuilder: TextBuilder;
+ IsMultiTurn: Boolean;
+ NumberOfTurns: Integer;
+ I: Integer;
begin
- ElementTestDataJson := TestData.ElementExists('turns', ElementExists);
+ TurnsDataJson := TestData.ElementExists('turns', IsMultiTurn);
+
+ if not IsMultiTurn then
+ exit(GetTestDataElement(ElementName, TestData));
+
+ NumberOfTurns := TurnsDataJson.GetElementCount();
+ for I := 0 to NumberOfTurns - 1 do begin
+ ElementJson := TurnsDataJson.ElementAt(I);
+ TextBuilder.AppendLine(StrSubstNo(TurnsLbl, I, GetTestDataElement(ElementName, ElementJson)));
+ end;
- if ElementExists then
- TestData := ElementTestDataJson;
+ exit(TextBuilder.ToText());
+ end;
- ElementTestDataJson := TestData.ElementExists(ElementName, ElementExists);
+ local procedure GetTestDataElement(ElementName: Text; var TestData: Codeunit "Test Input Json"): Text
+ var
+ ElementJson: Codeunit "Test Input Json";
+ ElementExists: Boolean;
+ begin
+ ElementJson := TestData.ElementExists(ElementName, ElementExists);
- if ElementExists and (ElementTestDataJson.ToText() <> '{}') then
- exit(ElementTestDataJson.ToText())
+ if ElementExists and (ElementJson.ToText() <> '{}') then
+ exit(ElementJson.ToText())
else
exit('');
end;