Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleLittleCloud committed Oct 30, 2024
1 parent 5b0422b commit c9d1358
Showing 1 changed file with 35 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,47 +1,46 @@
using Microsoft.AutoGen.Abstractions;

namespace Microsoft.AutoGen.Agents
namespace Microsoft.AutoGen.Agents;

public interface IHandleConsole : IHandle<Output>, IHandle<Input>
{
public interface IHandleConsole : IHandle<Output>, IHandle<Input>
{
string Route { get; }
AgentId AgentId { get; }
ValueTask PublishEvent(CloudEvent item);
string Route { get; }
AgentId AgentId { get; }
ValueTask PublishEvent(CloudEvent item);

async Task IHandle<Output>.Handle(Output item)
{
// Assuming item has a property `Message` that we want to write to the console
Console.WriteLine(item.Message);
await ProcessOutput(item.Message);
async Task IHandle<Output>.Handle(Output item)
{
// Assuming item has a property `Message` that we want to write to the console
Console.WriteLine(item.Message);
await ProcessOutput(item.Message);

var evt = new OutputWritten
{
Route = "console"
}.ToCloudEvent(AgentId.Key);
await PublishEvent(evt);
}
async Task IHandle<Input>.Handle(Input item)
var evt = new OutputWritten
{
Console.WriteLine("Please enter input:");
string content = Console.ReadLine() ?? string.Empty;
Route = "console"
}.ToCloudEvent(AgentId.Key);
await PublishEvent(evt);
}
async Task IHandle<Input>.Handle(Input item)
{
Console.WriteLine("Please enter input:");
string content = Console.ReadLine() ?? string.Empty;

await ProcessInput(content);
await ProcessInput(content);

var evt = new InputProcessed
{
Route = "console"
}.ToCloudEvent(AgentId.Key);
await PublishEvent(evt);
}
static Task ProcessOutput(string message)
var evt = new InputProcessed
{
// Implement your output processing logic here
return Task.CompletedTask;
}
static Task<string> ProcessInput(string message)
{
// Implement your input processing logic here
return Task.FromResult(message);
}
Route = "console"
}.ToCloudEvent(AgentId.Key);
await PublishEvent(evt);
}
static Task ProcessOutput(string message)
{
// Implement your output processing logic here
return Task.CompletedTask;
}
static Task<string> ProcessInput(string message)
{
// Implement your input processing logic here
return Task.FromResult(message);
}
}

0 comments on commit c9d1358

Please sign in to comment.