???? ?? ?? ?? ??? ?? fallback ???? ?? ??
- CodeLanguageCatalog? UTF-8 ???? ????? ?? fallback ???? ??? ??? manifest/build/test/lint ?? ?? ??? ???? - WorkspaceContextGenerator? ?? ??? ????? ?? Language Workflow ??? ?????? ??? no-LSP ?????? ?? ??? ?? ??? ?? ??? - AgentLoopLlmRequestPreparationService? ??? ?? tool-call ??? pre-call reminder ?? ??? AgentLoopService?? ??? - CodeLanguageCatalogTests, WorkspaceContextGeneratorTests, AgentLoopLlmRequestPreparationServiceTests? ??? ?? fallback/????/LLM ?? ?? ??? ??? - ??: dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\\verify_final_batch\\ -p:IntermediateOutputPath=obj\\verify_final_batch\\ (?? 0 / ?? 0) - ??: dotnet test src/AxCopilot.Tests/AxCopilot.Tests.csproj -c Release -v minimal --filter "CodeLanguageCatalogTests|WorkspaceContextGeneratorTests|AgentLoopLlmRequestPreparationServiceTests|AgentLoopIterationPreparationServiceTests|AgentMessageInvariantHelperTests|AgentToolResultBudgetTests|ChatStorageServiceTests|HtmlSkillGoldenReportTests|PptxSkillGoldenDeckTests|DocxSkillGoldenDocumentTests|ExcelSkillGoldenWorkbookTests" -p:OutputPath=bin\\verify_final_batch_tests\\ -p:IntermediateOutputPath=obj\\verify_final_batch_tests\\ (?? 54)
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
using AxCopilot.Models;
|
||||
using AxCopilot.Services.Agent;
|
||||
using FluentAssertions;
|
||||
using Xunit;
|
||||
|
||||
namespace AxCopilot.Tests.Services;
|
||||
|
||||
public class AgentLoopLlmRequestPreparationServiceTests
|
||||
{
|
||||
[Fact]
|
||||
public void Prepare_ShouldInjectToolReminderOnFirstForcedCall()
|
||||
{
|
||||
var queryMessages = new List<ChatMessage>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Role = "user",
|
||||
Content = "inspect the repository"
|
||||
}
|
||||
};
|
||||
|
||||
var result = AgentLoopLlmRequestPreparationService.Prepare(
|
||||
queryMessages,
|
||||
totalToolCalls: 0,
|
||||
forceInitialToolCallEnabled: true,
|
||||
injectPreCallToolReminder: true,
|
||||
noToolCallLoopRetry: 0);
|
||||
|
||||
result.ForceInitialToolCall.Should().BeTrue();
|
||||
result.InjectedToolReminder.Should().BeTrue();
|
||||
result.SendMessages.Should().HaveCount(2);
|
||||
result.SendMessages.Last().Content.Should().Contain("[TOOL_REQUIRED]");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Prepare_ShouldSkipReminderWhenRetryLoopIsAlreadyActive()
|
||||
{
|
||||
var queryMessages = new List<ChatMessage>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Role = "user",
|
||||
Content = "inspect the repository"
|
||||
}
|
||||
};
|
||||
|
||||
var result = AgentLoopLlmRequestPreparationService.Prepare(
|
||||
queryMessages,
|
||||
totalToolCalls: 0,
|
||||
forceInitialToolCallEnabled: true,
|
||||
injectPreCallToolReminder: true,
|
||||
noToolCallLoopRetry: 1);
|
||||
|
||||
result.ForceInitialToolCall.Should().BeTrue();
|
||||
result.InjectedToolReminder.Should().BeFalse();
|
||||
result.SendMessages.Should().HaveCount(1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user