From b64b7452f9c8522cdf8951dd6588567c7354d3bc Mon Sep 17 00:00:00 2001 From: Devis Lucato Date: Wed, 11 Sep 2024 00:18:36 -0700 Subject: [PATCH] Use connector nuget package (#40) --- examples/dotnet-01-echo-bot/MyAgent.cs | 4 +-- .../dotnet-01-echo-bot.csproj | 25 +++++++++++++-- .../dotnet-02-message-types-demo/MyAgent.cs | 3 +- .../dotnet-02-message-types-demo.csproj | 32 ++++++++++++++++--- .../dotnet-03-simple-chatbot.csproj | 5 +-- 5 files changed, 54 insertions(+), 15 deletions(-) diff --git a/examples/dotnet-01-echo-bot/MyAgent.cs b/examples/dotnet-01-echo-bot/MyAgent.cs index cf61f294..691178d1 100644 --- a/examples/dotnet-01-echo-bot/MyAgent.cs +++ b/examples/dotnet-01-echo-bot/MyAgent.cs @@ -68,7 +68,7 @@ public override async Task ReceiveCommandAsync( if (!this.Config.ReplyToAgents && command.Sender.Role == "assistant") { return; } // Support only the "say" command - if (command.CommandName.ToLowerInvariant() != "say") { return; } + if (!command.CommandName.Equals("say", StringComparison.OrdinalIgnoreCase)) { return; } // Update the chat history to include the message received await base.AddMessageToHistoryAsync(conversationId, command, cancellationToken).ConfigureAwait(false); @@ -107,7 +107,7 @@ public override async Task ReceiveMessageAsync( if (string.IsNullOrWhiteSpace(message.Content)) { return; } // Create the answer content - var answer = Message.CreateChatMessage(this.Id, "echo: "+ message.Content); + var answer = Message.CreateChatMessage(this.Id, "echo: " + message.Content); // Update the chat history to include the outgoing message await this.AddMessageToHistoryAsync(conversationId, answer, cancellationToken).ConfigureAwait(false); diff --git a/examples/dotnet-01-echo-bot/dotnet-01-echo-bot.csproj b/examples/dotnet-01-echo-bot/dotnet-01-echo-bot.csproj index dd797393..94d4519a 100644 --- a/examples/dotnet-01-echo-bot/dotnet-01-echo-bot.csproj +++ b/examples/dotnet-01-echo-bot/dotnet-01-echo-bot.csproj @@ -9,15 +9,36 @@ - + + + true + true + All + latest + + true + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + all runtime; build; native; contentfiles; analyzers; buildtransitive - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/examples/dotnet-02-message-types-demo/MyAgent.cs b/examples/dotnet-02-message-types-demo/MyAgent.cs index 7cb243c7..a5364846 100644 --- a/examples/dotnet-02-message-types-demo/MyAgent.cs +++ b/examples/dotnet-02-message-types-demo/MyAgent.cs @@ -29,7 +29,6 @@ public MyAgentConfig Config /// Service containing the agent, used to communicate with Workbench backend /// Agent data storage /// Azure content safety - /// Semantic Kernel /// App logger factory public MyAgent( string agentId, @@ -75,7 +74,7 @@ public override async Task ReceiveCommandAsync( if (!this.Config.CommandsEnabled) { return; } // Support only the "say" command - if (command.CommandName.ToLowerInvariant() != "say") { return; } + if (!command.CommandName.Equals("say", StringComparison.OrdinalIgnoreCase)) { return; } // Update the chat history to include the message received await base.ReceiveMessageAsync(conversationId, command, cancellationToken).ConfigureAwait(false); diff --git a/examples/dotnet-02-message-types-demo/dotnet-02-message-types-demo.csproj b/examples/dotnet-02-message-types-demo/dotnet-02-message-types-demo.csproj index ce3ed2b3..bd7a8033 100644 --- a/examples/dotnet-02-message-types-demo/dotnet-02-message-types-demo.csproj +++ b/examples/dotnet-02-message-types-demo/dotnet-02-message-types-demo.csproj @@ -6,21 +6,43 @@ enable AgentExample AgentExample + $(NoWarn);CA1308;CA1861; - - - - + + + + + true + true + All + latest + + true + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + all runtime; build; native; contentfiles; analyzers; buildtransitive - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/examples/dotnet-03-simple-chatbot/dotnet-03-simple-chatbot.csproj b/examples/dotnet-03-simple-chatbot/dotnet-03-simple-chatbot.csproj index 2a17a9c2..0768b4be 100644 --- a/examples/dotnet-03-simple-chatbot/dotnet-03-simple-chatbot.csproj +++ b/examples/dotnet-03-simple-chatbot/dotnet-03-simple-chatbot.csproj @@ -9,14 +9,11 @@ $(NoWarn);SKEXP0010;CA1861; - - - - +