This commit is contained in:
Javier Calvarro Nelson
2025-12-10 17:08:40 +01:00
Unverified
parent 0340531f3a
commit 0eef9949bf
37 changed files with 75 additions and 173 deletions
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using Microsoft.Extensions.AI;
@@ -16,8 +16,8 @@ public readonly struct Suggestion : IEquatable<Suggestion>
/// <param name="message">The message to send when the suggestion is selected.</param>
public Suggestion(string text, ChatMessage message)
{
Text = text;
Message = message;
this.Text = text;
this.Message = message;
}
/// <summary>
@@ -26,8 +26,8 @@ public readonly struct Suggestion : IEquatable<Suggestion>
/// <param name="text">The display text for the suggestion, also used as the message content.</param>
public Suggestion(string text)
{
Text = text;
Message = new ChatMessage(ChatRole.User, text);
this.Text = text;
this.Message = new ChatMessage(ChatRole.User, text);
}
/// <summary>
@@ -41,13 +41,13 @@ public readonly struct Suggestion : IEquatable<Suggestion>
public ChatMessage Message { get; }
/// <inheritdoc/>
public override bool Equals(object? obj) => obj is Suggestion other && Equals(other);
public override bool Equals(object? obj) => obj is Suggestion other && this.Equals(other);
/// <inheritdoc/>
public bool Equals(Suggestion other) => Text == other.Text;
public bool Equals(Suggestion other) => this.Text == other.Text;
/// <inheritdoc/>
public override int GetHashCode() => Text?.GetHashCode() ?? 0;
public override int GetHashCode() => this.Text?.GetHashCode() ?? 0;
/// <summary>
/// Determines whether two <see cref="Suggestion"/> instances are equal.
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using Microsoft.Extensions.AI;
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json;
using Microsoft.Extensions.AI;
@@ -4,7 +4,6 @@ using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Components.AI;
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json.Serialization;
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json.Serialization;
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json;
using System.Text.RegularExpressions;
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json.Serialization;
@@ -1,6 +1,5 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using AGUIDojoClient.Components.Shared;
using Microsoft.Extensions.AI;
namespace Microsoft.AspNetCore.Components.AI;
@@ -1,8 +1,7 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.AI;
using Microsoft.AspNetCore.Components.Rendering;
using Microsoft.Extensions.AI;
namespace AGUIDojoClient.Components.Demos.HumanInTheLoop;
@@ -1,6 +1,5 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using System.Runtime.CompilerServices;
using Microsoft.Agents.AI;
using Microsoft.Extensions.AI;
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json.Serialization;
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json.Serialization;
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
namespace AGUIDojoClient.Components.Demos.HumanInTheLoop;
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using System.Text.RegularExpressions;
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json.Serialization;
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
namespace AGUIDojoClient.Components.Demos.PredictiveStateUpdates;
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json.Serialization;
@@ -1,5 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json.Serialization;
@@ -1,5 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json.Serialization;
@@ -1,5 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json.Serialization;
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
namespace AGUIDojoClient.Components.Demos.ToolBasedGenerativeUI;
@@ -1,8 +1,7 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.AI;
using Microsoft.AspNetCore.Components.Rendering;
using Microsoft.Extensions.AI;
namespace AGUIDojoClient.Components.Demos.ToolBasedGenerativeUI;
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
namespace AGUIDojoClient.Components.Shared;
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using Microsoft.Agents.AI.AGUI;
using Microsoft.Extensions.AI;
@@ -19,8 +19,8 @@ public sealed class DemoService
/// <param name="httpClientFactory">Factory for creating HTTP clients.</param>
public DemoService(IHttpClientFactory httpClientFactory)
{
_httpClientFactory = httpClientFactory;
_scenarios = InitializeScenarios();
this._httpClientFactory = httpClientFactory;
this._scenarios = InitializeScenarios();
}
/// <summary>
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json.Serialization;
@@ -27,37 +27,61 @@ public sealed class WeatherInfo
/// <summary>
/// Gets the temperature in Fahrenheit.
/// </summary>
public double TemperatureFahrenheit => (Temperature * 9.0 / 5.0) + 32;
public double TemperatureFahrenheit => (this.Temperature * 9.0 / 5.0) + 32;
/// <summary>
/// Gets an emoji icon based on weather conditions.
/// </summary>
public string ConditionIcon => GetConditionIcon(Conditions);
public string ConditionIcon => GetConditionIcon(this.Conditions);
private static string GetConditionIcon(string conditions)
{
if (string.Equals(conditions, "sunny", StringComparison.OrdinalIgnoreCase) ||
string.Equals(conditions, "clear", StringComparison.OrdinalIgnoreCase))
{
return "☀️";
}
if (string.Equals(conditions, "cloudy", StringComparison.OrdinalIgnoreCase) ||
string.Equals(conditions, "overcast", StringComparison.OrdinalIgnoreCase))
{
return "☁️";
}
if (string.Equals(conditions, "rainy", StringComparison.OrdinalIgnoreCase) ||
string.Equals(conditions, "rain", StringComparison.OrdinalIgnoreCase))
{
return "🌧️";
}
if (string.Equals(conditions, "stormy", StringComparison.OrdinalIgnoreCase) ||
string.Equals(conditions, "thunderstorm", StringComparison.OrdinalIgnoreCase))
{
return "⛈️";
}
if (string.Equals(conditions, "snowy", StringComparison.OrdinalIgnoreCase) ||
string.Equals(conditions, "snow", StringComparison.OrdinalIgnoreCase))
{
return "❄️";
}
if (string.Equals(conditions, "foggy", StringComparison.OrdinalIgnoreCase) ||
string.Equals(conditions, "fog", StringComparison.OrdinalIgnoreCase))
{
return "🌫️";
}
if (string.Equals(conditions, "windy", StringComparison.OrdinalIgnoreCase))
{
return "💨";
}
if (string.Equals(conditions, "partly cloudy", StringComparison.OrdinalIgnoreCase))
{
return "⛅";
}
return "🌡️";
}
}