Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
<Nullable>enable</Nullable>

<AspireMajorVersion>9</AspireMajorVersion>
<AspireVersion>$(AspireMajorVersion).1.0</AspireVersion>
<AspireVersion>$(AspireMajorVersion).2.0</AspireVersion>
<AspireAppHostSdkVersion>$(AspireVersion)</AspireAppHostSdkVersion>
<AspNetCoreVersion>9.0.0</AspNetCoreVersion>
<DotNetExtensionsVersion>9.0.3</DotNetExtensionsVersion>
<OpenTelemetryVersion>1.11.1</OpenTelemetryVersion>
<TestContainersVersion>4.3.0</TestContainersVersion>
<MEAIVersion>9.3.0-preview.1.25161.3</MEAIVersion>
<MEAIVersion>9.4.0-preview.1.25207.5</MEAIVersion>
<IsPackable>false</IsPackable>

<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<ItemGroup Label="Integration Packages">
<PackageVersion Include="Azure.Provisioning.AppContainers" Version="1.0.0" />
<PackageVersion Include="JsonSchema.Net" Version="7.3.3" />
<PackageVersion Include="OllamaSharp" Version="5.1.7" />
<PackageVersion Include="OllamaSharp" Version="5.1.12" />
<PackageVersion Include="OpenFeature.Contrib.GOFeatureFlag" Version="0.2.0" />
<PackageVersion Include="MassTransit" Version="8.4.0" />
<PackageVersion Include="MassTransit.ActiveMQ" Version="8.4.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
<div>
<label>
<InputRadio Value="ServiceKeys.Phi3" />
@(OllamaClient1.GetService<ChatClientMetadata>()?.ModelId)
@(OllamaClient1.GetService<ChatClientMetadata>()?.DefaultModelId)
</label>
</div>
<div>
<label>
<InputRadio Value="ServiceKeys.Llama" />
@(OllamaClient2.GetService<ChatClientMetadata>()?.ModelId)
@(OllamaClient2.GetService<ChatClientMetadata>()?.DefaultModelId)
</label>
</div>
</InputRadioGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

builder.Services.AddOutputCache();

builder.AddOllamaApiClient(ServiceKeys.Phi3).AddChatClient();
builder.AddOllamaApiClient(ServiceKeys.Llama).AddChatClient();
builder.AddKeyedOllamaApiClient(ServiceKeys.Phi3).AddKeyedChatClient();
builder.AddKeyedOllamaApiClient(ServiceKeys.Llama).AddKeyedChatClient();

var app = builder.Build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,18 @@ public static IResourceBuilder<JavaAppExecutableResource> WithMavenBuild(
await BuildWithMaven(builder.Resource, context.ServiceProvider, context.CancellationToken, false).ConfigureAwait(false) ?
new ExecuteCommandResult { Success = true } :
new ExecuteCommandResult { Success = false, ErrorMessage = "Failed to build with Maven" },
(context) => context.ResourceSnapshot.State switch
new CommandOptions()
{
{ Text: "Stopped" } or
{ Text: "Exited" } or
{ Text: "Finished" } or
{ Text: "FailedToStart" } => ResourceCommandState.Enabled,
_ => ResourceCommandState.Disabled
},
iconName: "build"
);
IconName = "build",
UpdateState = (context) => context.ResourceSnapshot.State switch
{
{ Text: "Stopped" } or
{ Text: "Exited" } or
{ Text: "Finished" } or
{ Text: "FailedToStart" } => ResourceCommandState.Enabled,
_ => ResourceCommandState.Disabled
},
});

return builder;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,6 @@ private static IResourceBuilder<OllamaModelResource> AddModelResourceCommand(
builder.WithCommand(
name: name,
displayName: displayName,
updateState: context =>
context.ResourceSnapshot.State?.Text == KnownResourceStates.Running ?
ResourceCommandState.Enabled :
ResourceCommandState.Disabled,
executeCommand: async context =>
{
var modelResource = builder.Resource;
Expand All @@ -165,13 +161,15 @@ private static IResourceBuilder<OllamaModelResource> AddModelResourceCommand(

return await executeCommand(modelResource, ollamaClient, logger, notificationService, context.CancellationToken);
},
displayDescription: displayDescription,
parameter: parameter,
confirmationMessage: confirmationMessage,
iconName: iconName,
iconVariant: iconVariant,
isHighlighted: isHighlighted
);
commandOptions: new()
{
Description = displayDescription,
Parameter = parameter,
ConfirmationMessage = confirmationMessage,
IconName = iconName,
IconVariant = iconVariant,
IsHighlighted = isHighlighted
});

private static IResourceBuilder<OllamaModelResource> WithModelDownload(this IResourceBuilder<OllamaModelResource> builder)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,14 @@ internal static IResourceBuilder<TResource> InternalWithReference<TResource>(thi
var service = context.ServiceProvider.GetRequiredService<SqlProjectPublishService>();
await service.PublishSqlProject(builder.Resource, target.Resource, targetDatabaseName, context.CancellationToken);
return new ExecuteCommandResult { Success = true };
}, updateState: (context) => context.ResourceSnapshot?.State?.Text == KnownResourceStates.Finished ? ResourceCommandState.Enabled : ResourceCommandState.Disabled,
displayDescription: "Redeploys the SQL Server Database Project to the target database.",
iconName: "ArrowReset",
iconVariant: IconVariant.Filled,
isHighlighted: true);
}, new CommandOptions()
{
Description = "Redeploys the SQL Server Database Project to the target database.",
IconName = "ArrowReset",
IconVariant = IconVariant.Filled,
IsHighlighted = true,
UpdateState = (context) => context.ResourceSnapshot?.State?.Text == KnownResourceStates.Finished ? ResourceCommandState.Enabled : ResourceCommandState.Disabled,
});

return builder;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ public void AddBunNullNameThrows()
public void AddBunEmptyNameThrows()
{
var builder = DistributedApplication.CreateBuilder();
var name = "";

Assert.Throws<ArgumentException>(() => builder.AddBunApp(""));
Assert.Throws<ArgumentException>(() => builder.AddBunApp(name));
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public void AddNgrokEmptyNameThrows()
{
var builder = DistributedApplication.CreateBuilder();

Assert.Throws<ArgumentException>(() => builder.AddNgrok(""));
var name = "";
Assert.Throws<ArgumentException>(() => builder.AddNgrok(name));
}

[Fact]
Expand All @@ -64,16 +65,18 @@ public void AddNgrokWhitespaceConfigurationFolderThrows()
public void AddNgrokEmptyEndpointNameFolderThrows()
{
var builder = DistributedApplication.CreateBuilder();
var endpointName = "";

Assert.Throws<ArgumentException>(() => builder.AddNgrok("ngrok", endpointName: ""));
Assert.Throws<ArgumentException>(() => builder.AddNgrok("ngrok", endpointName));
}

[Fact]
public void AddNgrokWhitespaceEndpointNameFolderThrows()
{
var builder = DistributedApplication.CreateBuilder();
var endpointName = " ";

Assert.Throws<ArgumentException>(() => builder.AddNgrok("ngrok", endpointName: " "));
Assert.Throws<ArgumentException>(() => builder.AddNgrok("ngrok", endpointName));
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ public void RegisteringChatClientAndEmbeddingGeneratorReturnsCorrectModelForServ
var chatClient = host.Services.GetRequiredService<IChatClient>();
var embeddingGenerator = host.Services.GetRequiredService<IEmbeddingGenerator<string, Embedding<float>>>();

Assert.Equal("Chat", chatClient.GetService<ChatClientMetadata>()?.ModelId);
Assert.Equal("Embedding", embeddingGenerator.GetService<EmbeddingGeneratorMetadata>()?.ModelId);
Assert.Equal("Chat", chatClient.GetService<ChatClientMetadata>()?.DefaultModelId);
Assert.Equal("Embedding", embeddingGenerator.GetService<EmbeddingGeneratorMetadata>()?.DefaultModelId);
}

[Fact]
Expand Down