mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Enable more analyzers and various code tweaks/cleanup (#738)
This commit is contained in:
committed by
GitHub
Unverified
parent
f3264966ff
commit
5e5761b288
+4
-5
@@ -52,18 +52,17 @@ public static class Program
|
||||
{
|
||||
if (request.DataIs<NumberSignal>())
|
||||
{
|
||||
var signal = request.DataAs<NumberSignal>();
|
||||
switch (signal)
|
||||
switch (request.DataAs<NumberSignal>())
|
||||
{
|
||||
case NumberSignal.Init:
|
||||
int initialGuess = ReadIntegerFromConsole("Please provide your initial guess: ");
|
||||
return request.CreateResponse<int>(initialGuess);
|
||||
return request.CreateResponse(initialGuess);
|
||||
case NumberSignal.Above:
|
||||
int lowerGuess = ReadIntegerFromConsole("You previously guessed too large. Please provide a new guess: ");
|
||||
return request.CreateResponse<int>(lowerGuess);
|
||||
return request.CreateResponse(lowerGuess);
|
||||
case NumberSignal.Below:
|
||||
int higherGuess = ReadIntegerFromConsole("You previously guessed too small. Please provide a new guess: ");
|
||||
return request.CreateResponse<int>(higherGuess);
|
||||
return request.CreateResponse(higherGuess);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -19,12 +19,10 @@ internal static class WorkflowHelper
|
||||
JudgeExecutor judgeExecutor = new(42);
|
||||
|
||||
// Build the workflow by connecting executors in a loop
|
||||
var workflow = new WorkflowBuilder(numberInputPort)
|
||||
return new WorkflowBuilder(numberInputPort)
|
||||
.AddEdge(numberInputPort, judgeExecutor)
|
||||
.AddEdge(judgeExecutor, numberInputPort)
|
||||
.Build<NumberSignal>();
|
||||
|
||||
return workflow;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +42,7 @@ internal enum NumberSignal
|
||||
internal sealed class JudgeExecutor() : ReflectingExecutor<JudgeExecutor>("Judge"), IMessageHandler<int>
|
||||
{
|
||||
private readonly int _targetNumber;
|
||||
private int _tries = 0;
|
||||
private int _tries;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="JudgeExecutor"/> class.
|
||||
|
||||
Reference in New Issue
Block a user