-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Aspire code related warnings (#930)
- Loading branch information
Showing
13 changed files
with
126 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RollForward>LatestMajor</RollForward> | ||
<AssemblyName>Microsoft.KernelMemory.Aspire</AssemblyName> | ||
<RootNamespace>Microsoft.KernelMemory.Aspire</RootNamespace> | ||
<NoWarn>$(NoWarn);</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\service\Core\Core.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Aspire.Hosting" /> | ||
<PackageReference Include="Aspire.Hosting.AppHost" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<IsPackable>false</IsPackable> | ||
<PackageId>Microsoft.KernelMemory.Aspire</PackageId> | ||
<Product>.NET Aspire extensions for Kernel Memory</Product> | ||
<Description>Make it easier to develop and work with Kernel Memory</Description> | ||
<PackageTags>Aspire, Memory, RAG, Kernel Memory, AI, Artificial Intelligence, Embeddings, Vector DB, Vector Search, Memory DB</PackageTags> | ||
<DocumentationFile>bin/$(Configuration)/$(TargetFramework)/$(AssemblyName).xml</DocumentationFile> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\README.md" Link="README.md" Pack="true" PackagePath="." Visible="false" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
using System; | ||
using System.Diagnostics; | ||
using System.Threading.Tasks; | ||
using Aspire.Hosting; | ||
|
||
namespace Microsoft.KernelMemory.Aspire; | ||
|
||
public static class Dashboard | ||
{ | ||
/// <summary> | ||
/// Show Aspire dashboard URL before the logging start. | ||
/// </summary> | ||
public static IDistributedApplicationBuilder ShowDashboardUrl(this IDistributedApplicationBuilder builder, bool withStyle = false) | ||
{ | ||
Console.WriteLine(withStyle | ||
? $"\u001b[1mAspire dashboard URL: {GetUrl(builder)}\u001b[0m\n\n" | ||
: $"Aspire dashboard URL: {GetUrl(builder)}\n\n"); | ||
return builder; | ||
} | ||
|
||
/// <summary> | ||
/// Wait 5 seconds and automatically open the browser (when using 'dotnet run' the browser doesn't open) | ||
/// </summary> | ||
public static IDistributedApplicationBuilder LaunchDashboard(this IDistributedApplicationBuilder builder, int delay = 5000) | ||
{ | ||
Task.Run(async () => | ||
{ | ||
await Task.Delay(delay).ConfigureAwait(false); | ||
Process.Start(new ProcessStartInfo { FileName = GetUrl(builder), UseShellExecute = true }); | ||
}); | ||
|
||
return builder; | ||
} | ||
|
||
private static string GetUrl(IDistributedApplicationBuilder builder) | ||
{ | ||
string token = builder.Configuration["AppHost:BrowserToken"] ?? string.Empty; | ||
string url = builder.Configuration["ASPNETCORE_URLS"]?.Split(";")[0] ?? throw new ArgumentException("ASPNETCORE_URLS is empty"); | ||
return $"{url}/login?t={token}"; | ||
} | ||
} |
5 changes: 4 additions & 1 deletion
5
...ire/Aspire.Extensions/AspireExtensions.cs → ...pire/KernelMemoryEnvironmentExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# .NET Aspire for Kernel Memory | ||
|
||
[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/KMdiscord) | ||
|
||
This project contains | ||
[.NET Aspire](https://learn.microsoft.com/dotnet/aspire) | ||
extensions to make it easier to run Kernel Memory locally | ||
and in the cloud. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters