Skip to content

Commit

Permalink
Fix build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dluc committed Nov 26, 2024
1 parent 590e67e commit 1c689de
Show file tree
Hide file tree
Showing 19 changed files with 42 additions and 191 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@
**/__pycache__
**/.pytest_cache
**/.venv
.azure
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
.azure
5 changes: 3 additions & 2 deletions examples/dotnet/dotnet-01-echo-bot/dotnet-01-echo-bot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Nullable>enable</Nullable>
<RootNamespace>AgentExample</RootNamespace>
<PackageId>AgentExample</PackageId>
<NoWarn>$(NoWarn);CA1515;IDE0290;</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand All @@ -27,15 +28,15 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20">
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.12.19">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
28 changes: 14 additions & 14 deletions examples/dotnet/dotnet-02-message-types-demo/MyAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,20 @@ public override Task ReceiveMessageAsync(
Message message,
CancellationToken cancellationToken = default)
{
switch (this.Config.Behavior.ToLowerInvariant())
return this.Config.Behavior.ToLowerInvariant() switch
{
case "echo": return this.EchoExampleAsync(conversationId, message, cancellationToken);
case "reverse": return this.ReverseExampleAsync(conversationId, message, cancellationToken);
case "safety check": return this.SafetyCheckExampleAsync(conversationId, message, cancellationToken);
case "markdown sample": return this.MarkdownExampleAsync(conversationId, message, cancellationToken);
case "html sample": return this.HTMLExampleAsync(conversationId, message, cancellationToken);
case "code sample": return this.CodeExampleAsync(conversationId, message, cancellationToken);
case "json sample": return this.JSONExampleAsync(conversationId, message, cancellationToken);
case "mermaid sample": return this.MermaidExampleAsync(conversationId, message, cancellationToken);
case "music sample": return this.MusicExampleAsync(conversationId, message, cancellationToken);
case "none": return this.NoneExampleAsync(conversationId, message, cancellationToken);
default: return this.NoneExampleAsync(conversationId, message, cancellationToken);
}
"echo" => this.EchoExampleAsync(conversationId, message, cancellationToken),
"reverse" => this.ReverseExampleAsync(conversationId, message, cancellationToken),
"safety check" => this.SafetyCheckExampleAsync(conversationId, message, cancellationToken),
"markdown sample" => this.MarkdownExampleAsync(conversationId, message, cancellationToken),
"html sample" => this.HTMLExampleAsync(conversationId, message, cancellationToken),
"code sample" => this.CodeExampleAsync(conversationId, message, cancellationToken),
"json sample" => this.JSONExampleAsync(conversationId, message, cancellationToken),
"mermaid sample" => this.MermaidExampleAsync(conversationId, message, cancellationToken),
"music sample" => this.MusicExampleAsync(conversationId, message, cancellationToken),
"none" => this.NoneExampleAsync(conversationId, message, cancellationToken),
_ => this.NoneExampleAsync(conversationId, message, cancellationToken)
};
}

// Check text with Azure Content Safety
Expand All @@ -111,7 +111,7 @@ public override Task ReceiveMessageAsync(
Response<AnalyzeTextResult>? result = await this._contentSafety.AnalyzeTextAsync(text, cancellationToken).ConfigureAwait(false);

bool isSafe = result.HasValue && result.Value.CategoriesAnalysis.All(x => x.Severity is 0);
IEnumerable<string> report = result.HasValue ? result.Value.CategoriesAnalysis.Select(x => $"{x.Category}: {x.Severity}") : Array.Empty<string>();
IEnumerable<string> report = result.HasValue ? result.Value.CategoriesAnalysis.Select(x => $"{x.Category}: {x.Severity}") : [];

return (isSafe, report);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<RootNamespace>AgentExample</RootNamespace>
<PackageId>AgentExample</PackageId>
<NoWarn>$(NoWarn);CA1308;CA1861;</NoWarn>
<NoWarn>$(NoWarn);CA1308;CA1861;CA1515;IDE0290;</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand All @@ -31,15 +31,15 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20">
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.12.19">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion examples/dotnet/dotnet-03-simple-chatbot/MyAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ private IChatCompletionService GetChatCompletionService()
Response<AnalyzeTextResult>? result = await this._contentSafety.AnalyzeTextAsync(text, cancellationToken).ConfigureAwait(false);

bool isSafe = result.HasValue && result.Value.CategoriesAnalysis.All(x => x.Severity is 0);
IEnumerable<string> report = result.HasValue ? result.Value.CategoriesAnalysis.Select(x => $"{x.Category}: {x.Severity}") : Array.Empty<string>();
IEnumerable<string> report = result.HasValue ? result.Value.CategoriesAnalysis.Select(x => $"{x.Category}: {x.Severity}") : [];

return (isSafe, report);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<RootNamespace>AgentExample</RootNamespace>
<PackageId>AgentExample</PackageId>
<NoWarn>$(NoWarn);SKEXP0010;CA1861;</NoWarn>
<NoWarn>$(NoWarn);SKEXP0010;CA1861;CA1515;IDE0290;CA1031;CA1812;</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand All @@ -30,15 +30,15 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20">
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.12.19">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 2 additions & 0 deletions libraries/dotnet/SemanticWorkbench.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">512</s:Int64>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LINES/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">Copyright (c) Microsoft. All rights reserved.</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ABC/@EntryIndexedValue">ABC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ACS/@EntryIndexedValue">ACS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AI/@EntryIndexedValue">AI</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AIGPT/@EntryIndexedValue">AIGPT</s:String>
Expand All @@ -106,6 +107,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IOS/@EntryIndexedValue">IOS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=JSON/@EntryIndexedValue">JSON</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=JWT/@EntryIndexedValue">JWT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HTML/@EntryIndexedValue">HTML</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MQ/@EntryIndexedValue">MQ</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MQTT/@EntryIndexedValue">MQTT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MS/@EntryIndexedValue">MS</s:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ public abstract class AgentConfigBase
{
public object ToWorkbenchFormat()
{
Dictionary<string, object> result = new();
Dictionary<string, object> defs = new();
Dictionary<string, object> properties = new();
Dictionary<string, object> jsonSchema = new();
Dictionary<string, object> uiSchema = new();
Dictionary<string, object> result = [];
Dictionary<string, object> defs = [];
Dictionary<string, object> properties = [];
Dictionary<string, object> jsonSchema = [];
Dictionary<string, object> uiSchema = [];

foreach (var property in this.GetType().GetProperties())
{
Expand Down
4 changes: 2 additions & 2 deletions libraries/dotnet/WorkbenchConnector/Models/Conversation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ public class Conversation

[JsonPropertyName("participants")]
[JsonPropertyOrder(2)]
public Dictionary<string, Participant> Participants { get; set; } = new();
public Dictionary<string, Participant> Participants { get; set; } = [];

[JsonPropertyName("messages")]
[JsonPropertyOrder(3)]
public List<Message> Messages { get; set; } = new();
public List<Message> Messages { get; set; } = [];

public Conversation()
{
Expand Down
2 changes: 1 addition & 1 deletion libraries/dotnet/WorkbenchConnector/Models/ServiceInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ServiceInfo<TAgentConfig>(TAgentConfig cfg)
public string Description { get; set; } = string.Empty;

[JsonPropertyName("metadata")]
public Dictionary<string, object> Metadata { get; set; } = new();
public Dictionary<string, object> Metadata { get; set; } = [];

[JsonPropertyName("default_config")]
public object DefaultConfiguration => cfg.ToWorkbenchFormat() ?? new();
Expand Down
8 changes: 5 additions & 3 deletions libraries/dotnet/WorkbenchConnector/WorkbenchConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ protected WorkbenchConnector(

this.Log = logger;
this.Storage = storage;
this.HttpClient = new HttpClient();
this.HttpClient.BaseAddress = new Uri(this.WorkbenchConfig.WorkbenchEndpoint);
this.Agents = new Dictionary<string, AgentBase<TAgentConfig>>();
this.HttpClient = new HttpClient
{
BaseAddress = new Uri(this.WorkbenchConfig.WorkbenchEndpoint)
};
this.Agents = [];

this.Log.LogTrace("Service instance created");
}
Expand Down
6 changes: 3 additions & 3 deletions libraries/dotnet/WorkbenchConnector/WorkbenchConnector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Nullable>enable</Nullable>
<LangVersion>12</LangVersion>
<RollForward>LatestMajor</RollForward>
<NoWarn>$(NoWarn);IDE0130;CA2254;CA1812;CA1813;</NoWarn>
<NoWarn>$(NoWarn);IDE0130;CA2254;CA1812;CA1813;IDE0290;</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand All @@ -31,15 +31,15 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20">
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.12.19">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
43 changes: 0 additions & 43 deletions tools/docker/Dockerfile.aspire.assistant

This file was deleted.

1 change: 0 additions & 1 deletion workbench-app/.dockerignore

This file was deleted.

39 changes: 0 additions & 39 deletions workbench-app/Dockerfile

This file was deleted.

15 changes: 0 additions & 15 deletions workbench-app/docker-entrypoint.sh

This file was deleted.

13 changes: 0 additions & 13 deletions workbench-app/nginx.conf

This file was deleted.

Loading

0 comments on commit 1c689de

Please sign in to comment.