Skip to content

Commit f6129c5

Browse files
authored
Merge branch 'main' into rel/v0.4.2
2 parents 7009ec6 + 29c9be5 commit f6129c5

31 files changed

+1241
-174
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ jobs:
4242
$manifest.Package.Identity.Version = '${{ env.GitBuildVersionSimple }}.0'
4343
$manifest.Save($manifestPath)
4444
- name: Restore dependencies
45-
run: dotnet restore AIDevGallery.sln -r win-${{ matrix.dotnet-arch }} /p:Configuration=Release /p:Platform=${{ matrix.dotnet-arch }} /p:PublishReadyToRun=true /p:SelfContainedIfPreviewWASDK=true
45+
run: dotnet restore AIDevGallery.sln -r win-${{ matrix.dotnet-arch }} /p:Configuration=${{ matrix.dotnet-configuration }} /p:Platform=${{ matrix.dotnet-arch }} /p:PublishReadyToRun=true /p:SelfContainedIfPreviewWASDK=true
4646
- name: Build
4747
run: |
48-
dotnet build AIDevGallery.Utils --no-restore /p:Configuration=Release
49-
dotnet build AIDevGallery --no-restore -r win-${{ matrix.dotnet-arch }} -f net9.0-windows10.0.26100.0 /p:Configuration=Release /p:Platform=${{ matrix.dotnet-arch }} /p:AppxPackageDir="AppPackages/" /p:UapAppxPackageBuildMode=SideloadOnly /p:AppxBundle=Never /p:GenerateAppxPackageOnBuild=true /p:SelfContainedIfPreviewWASDK=true
48+
dotnet build AIDevGallery.Utils --no-restore /p:Configuration=${{ matrix.dotnet-configuration }}
49+
dotnet build AIDevGallery --no-restore -r win-${{ matrix.dotnet-arch }} -f net9.0-windows10.0.26100.0 /p:Configuration=${{ matrix.dotnet-configuration }} /p:Platform=${{ matrix.dotnet-arch }} /p:AppxPackageDir="AppPackages/" /p:UapAppxPackageBuildMode=SideloadOnly /p:AppxBundle=Never /p:GenerateAppxPackageOnBuild=true /p:SelfContainedIfPreviewWASDK=true
5050
- name: Upload Artifact - MSIX
5151
uses: actions/upload-artifact@v4
5252
with:
@@ -83,17 +83,27 @@ jobs:
8383
$manifest.Package.Identity.Version = '${{ env.GitBuildVersionSimple }}.0'
8484
$manifest.Save($manifestPath)
8585
- name: Restore dependencies
86-
run: dotnet restore AIDevGallery.sln -r win-${{ matrix.dotnet-arch }} /p:Configuration=Release /p:Platform=${{ matrix.dotnet-arch }} /p:PublishReadyToRun=true
86+
run: dotnet restore AIDevGallery.sln -r win-${{ matrix.dotnet-arch }} /p:Configuration=${{ matrix.dotnet-configuration }} /p:Platform=${{ matrix.dotnet-arch }} /p:PublishReadyToRun=true
8787
- name: Build
8888
run: |
89-
dotnet build AIDevGallery.Utils --no-restore /p:Configuration=Release
90-
dotnet build AIDevGallery --no-restore -r win-${{ matrix.dotnet-arch }} -f net9.0-windows10.0.26100.0 /p:Configuration=Release /p:Platform=${{ matrix.dotnet-arch }}
89+
dotnet build AIDevGallery.Utils --no-restore /p:Configuration=${{ matrix.dotnet-configuration }}
90+
dotnet build AIDevGallery --no-restore -r win-${{ matrix.dotnet-arch }} -f net9.0-windows10.0.26100.0 /p:Configuration=${{ matrix.dotnet-configuration }} /p:Platform=${{ matrix.dotnet-arch }}
9191
- name: Setup Dev Tools
9292
uses: ilammy/msvc-dev-cmd@v1
9393
- name: Build Tests
94-
run: dotnet build AIDevGallery.UnitTests -r win-${{ matrix.dotnet-arch }} -f net9.0-windows10.0.26100.0 /p:Configuration=Release /p:Platform=${{ matrix.dotnet-arch }}
95-
- name: Run Tests
96-
run: vstest.console.exe .\AIDevGallery.UnitTests\bin\${{ matrix.dotnet-arch }}\Release\net9.0-windows10.0.26100.0\win-${{ matrix.dotnet-arch }}\AIDevGallery.UnitTests.build.appxrecipe /TestAdapterPath:"$HOME\.nuget\mstest.testadapter\3.8.2\buildTransitive\net9.0" /framework:FrameworkUap10 /logger:"trx;LogFileName=${{ github.workspace }}\TestResults\VsTestResults.trx"
94+
run: dotnet build AIDevGallery.UnitTests -r win-${{ matrix.dotnet-arch }} -f net9.0-windows10.0.26100.0 /p:Configuration=${{ matrix.dotnet-configuration }} /p:Platform=${{ matrix.dotnet-arch }}
95+
# - name: Run Tests
96+
# run: vstest.console.exe .\AIDevGallery.UnitTests\bin\${{ matrix.dotnet-arch }}\${{ matrix.dotnet-configuration }}\net9.0-windows10.0.26100.0\win-${{ matrix.dotnet-arch }}\AIDevGallery.UnitTests.build.appxrecipe /TestAdapterPath:"$HOME\.nuget\mstest.testadapter\3.9.1\buildTransitive\net9.0" /framework:FrameworkUap10 /logger:"trx;LogFileName=${{ github.workspace }}\TestResults\VsTestResults.trx"
97+
- name: Publish Test Builds If Failed
98+
if: failure()
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: test-builds-${{ matrix.dotnet-arch }}
102+
path: |
103+
.\AIDevGallery\bin\${{ matrix.dotnet-arch }}\${{ matrix.dotnet-configuration }}
104+
.\AIDevGallery\obj\${{ matrix.dotnet-arch }}\${{ matrix.dotnet-configuration }}
105+
.\AIDevGallery.UnitTests\bin\${{ matrix.dotnet-arch }}\${{ matrix.dotnet-configuration }}
106+
.\AIDevGallery.UnitTests\obj\${{ matrix.dotnet-arch }}\${{ matrix.dotnet-configuration }}
97107
- name: Publish Test Results
98108
if: ${{ !cancelled() }}
99109
uses: actions/upload-artifact@v4

AIDevGallery.SourceGenerator/Models/ApiDefinition.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ internal class ApiDefinition
1313
public required string ReadmeUrl { get; init; }
1414
public required string License { get; init; }
1515
public required string SampleIdToShowInDocs { get; init; }
16+
public string? Category { get; init; } = null;
1617
}

AIDevGallery.SourceGenerator/ModelsSourceGenerator.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,9 @@ private void GenerateApiDefinitionDetails(StringBuilder sourceBuilder, Dictionar
334334
IconGlyph = "{{apiDefinition.IconGlyph}}",
335335
Description = "{{apiDefinition.Description}}",
336336
ReadmeUrl = "{{apiDefinition.ReadmeUrl}}",
337-
License = "{{apiDefinition.License}}",
338-
{{(!string.IsNullOrWhiteSpace(apiDefinition.SampleIdToShowInDocs) ? $"SampleIdToShowInDocs = \"{apiDefinition.SampleIdToShowInDocs}\"" : string.Empty)}}
337+
License = "{{apiDefinition.License}}"
338+
{{(!string.IsNullOrWhiteSpace(apiDefinition.SampleIdToShowInDocs) ? $",SampleIdToShowInDocs = \"{apiDefinition.SampleIdToShowInDocs}\"" : string.Empty)}}
339+
{{(!string.IsNullOrWhiteSpace(apiDefinition.Category) ? $",Category = \"{apiDefinition.Category}\"" : string.Empty)}}
339340
}
340341
},
341342
"""");

AIDevGallery/AIDevGallery.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<PackageReference Include="MathNet.Numerics" />
6565
<PackageReference Include="Microsoft.Build" />
6666
<PackageReference Include="Microsoft.Extensions.AI" />
67-
<PackageReference Include="Microsoft.Extensions.AI.Ollama" />
67+
<PackageReference Include="OllamaSharp" />
6868
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" />
6969
<PackageReference Include="Microsoft.ML.OnnxRuntime.Extensions" />
7070
<PackageReference Include="Microsoft.ML.OnnxRuntimeGenAI.WinML" />
@@ -320,7 +320,7 @@
320320
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
321321
</Content>
322322
</ItemGroup>
323-
323+
324324
<!--
325325
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
326326
Explorer "Package and Publish" context menu entry to be enabled for this project even if

AIDevGallery/Controls/ModelPicker/ModelOrApiPicker.xaml.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
namespace AIDevGallery.Controls;
1818

19-
// TODO: Add telemetry
20-
// TODO: Remember state between uses
2119
internal sealed partial class ModelOrApiPicker : UserControl
2220
{
2321
private ObservableCollection<ModelSelectionItem> modelSelectionItems = new ObservableCollection<ModelSelectionItem>();

AIDevGallery/ExternalModelUtils/LemonadeModelProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public async Task<bool> IsAvailable()
178178

179179
public string? GetDetailsUrl(ModelDetails details)
180180
{
181-
return $"https://github.com/onnx/turnkeyml/tree/main";
181+
return $"https://github.com/lemonade-sdk/lemonade/tree/main";
182182
}
183183

184184
public string? GetIChatClientString(string url)

AIDevGallery/ExternalModelUtils/OllamaModelProvider.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using AIDevGallery.Models;
55
using AIDevGallery.Utils;
66
using Microsoft.Extensions.AI;
7+
using OllamaSharp;
78
using System;
89
using System.Collections.Generic;
910
using System.Diagnostics;
@@ -25,7 +26,7 @@ internal class OllamaModelProvider : IExternalModelProvider
2526

2627
public HardwareAccelerator ModelHardwareAccelerator => HardwareAccelerator.OLLAMA;
2728

28-
public List<string> NugetPackageReferences => ["Microsoft.Extensions.AI.Ollama"];
29+
public List<string> NugetPackageReferences => ["OllamaSharp"];
2930

3031
public string ProviderDescription => "The model will run locally via Ollama";
3132

@@ -138,7 +139,7 @@ public async Task<bool> IsAvailable()
138139
public IChatClient? GetIChatClient(string url)
139140
{
140141
var modelId = url.Split('/').LastOrDefault();
141-
return new OllamaChatClient(Url, modelId);
142+
return modelId == null ? null : new OllamaApiClient(Url, modelId);
142143
}
143144

144145
public string? GetDetailsUrl(ModelDetails details)
@@ -151,6 +152,6 @@ public async Task<bool> IsAvailable()
151152
public string? GetIChatClientString(string url)
152153
{
153154
var modelId = url.Split('/').LastOrDefault();
154-
return $"new OllamaChatClient(\"{Url}\", \"{modelId}\")";
155+
return modelId == null ? null : $"new OllamaApiClient(\"{Url}\", \"{modelId}\")";
155156
}
156157
}

AIDevGallery/Models/Samples.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ internal class ApiDefinition
5656
public string ReadmeUrl { get; init; } = null!;
5757
public string License { get; init; } = null!;
5858
public string SampleIdToShowInDocs { get; set; } = null!;
59+
public string? Category { get; init; }
5960
}
6061

6162
internal class ModelDetails

AIDevGallery/Pages/APIs/APIPage.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<Page.Resources>
1616
<tkconverters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
1717
</Page.Resources>
18-
<Grid x:Name="RootGrid" MaxWidth="1600">
18+
<Grid x:Name="RootGrid" MaxWidth="1600" RowSpacing="8">
1919
<Grid.RowDefinitions>
2020
<RowDefinition Height="Auto" />
2121
<RowDefinition Height="*" />

AIDevGallery/Pages/APIs/APISelectionPage.xaml.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,22 @@ private void SetupAPIs()
4949
{
5050
if (ModelTypeHelpers.ApiDefinitionDetails.TryGetValue(item, out var apiDefinition))
5151
{
52-
NavView.MenuItems.Add(new NavigationViewItem() { Content = apiDefinition.Name, Icon = new FontIcon() { Glyph = apiDefinition.IconGlyph }, Tag = item });
52+
if (!string.IsNullOrWhiteSpace(apiDefinition.Category))
53+
{
54+
NavigationViewItem? existingItem = NavView.MenuItems.OfType<NavigationViewItem>().FirstOrDefault(i => i.Content is string name && name == apiDefinition.Category);
55+
56+
if (existingItem == null)
57+
{
58+
existingItem = new NavigationViewItem() { Content = apiDefinition.Category, Icon = new FontIcon() { Glyph = "\uF0E2" }, SelectsOnInvoked = false, IsExpanded = true };
59+
NavView.MenuItems.Add(existingItem);
60+
}
61+
62+
existingItem.MenuItems.Add(new NavigationViewItem() { Content = apiDefinition.Name, Icon = new FontIcon() { Glyph = apiDefinition.IconGlyph }, Tag = item });
63+
}
64+
else
65+
{
66+
NavView.MenuItems.Add(new NavigationViewItem() { Content = apiDefinition.Name, Icon = new FontIcon() { Glyph = apiDefinition.IconGlyph }, Tag = item });
67+
}
5368
}
5469
}
5570
}

0 commit comments

Comments
 (0)