mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Fixed dotnet tests
This commit is contained in:
@@ -16,28 +16,16 @@ internal static class ActivityProcessor
|
||||
{
|
||||
await foreach (IActivity activity in activities.ConfigureAwait(false))
|
||||
{
|
||||
switch (activity.Type)
|
||||
if (!string.IsNullOrWhiteSpace(activity.Text))
|
||||
{
|
||||
case "message":
|
||||
// For streaming scenarios, we sometimes receive intermediate text via "typing" activities, but not always.
|
||||
// In some cases the response is also returned multiple times via "typing" activities, so the only reliable
|
||||
// way to get the final response is to wait for a "message" activity.
|
||||
|
||||
// TODO: Prototype a custom AIContent type for CardActions, where the user is instructed to
|
||||
// pick from a list of actions.
|
||||
// The activity text doesn't make sense without the actions, as the message
|
||||
// is often instructing the user to pick from the provided list of actions.
|
||||
if ((activity.Type == "message" && !streaming) || (activity.Type == "typing" && streaming))
|
||||
{
|
||||
yield return CreateChatMessageFromActivity(activity, [new TextContent(activity.Text)]);
|
||||
break;
|
||||
case "typing":
|
||||
case "event":
|
||||
// TODO: Revisit usage of TextReasoningContent here, to evaluate whether all are really reasoning
|
||||
// or whether simply an AIContent base type would be more appropriate.
|
||||
yield return CreateChatMessageFromActivity(activity, [new TextReasoningContent(activity.Text)]);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogWarning("Unknown activity type '{ActivityType}' received.", activity.Type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ public abstract class RunTests<TAgentFixture>(Func<TAgentFixture> createAgentFix
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(response);
|
||||
Assert.Single(response.Messages);
|
||||
Assert.Contains("Paris", response.Text);
|
||||
Assert.Equal(agent.Id, response.AgentId);
|
||||
}
|
||||
@@ -61,6 +62,7 @@ public abstract class RunTests<TAgentFixture>(Func<TAgentFixture> createAgentFix
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(response);
|
||||
Assert.Single(response.Messages);
|
||||
Assert.Contains("Paris", response.Text);
|
||||
}
|
||||
|
||||
@@ -82,6 +84,7 @@ public abstract class RunTests<TAgentFixture>(Func<TAgentFixture> createAgentFix
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(response);
|
||||
Assert.Single(response.Messages);
|
||||
Assert.Contains("Paris", response.Text);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user