Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
24 changes: 14 additions & 10 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,32 @@
"isRoot": true,
"tools": {
"centralisedpackageconverter": {
"version": "1.0.52",
"version": "1.0.74",
"commands": [
"central-pkg-converter"
]
],
"rollForward": false
},
"cake.tool": {
"version": "2.0.0",
"version": "5.0.0",
"commands": [
"dotnet-cake"
]
],
"rollForward": false
},
"csharpier": {
"version": "0.28.2",
"version": "1.1.2",
"commands": [
"dotnet-csharpier"
]
"csharpier"
],
"rollForward": false
},
"dotnet-outdated-tool": {
"version": "4.6.4",
"version": "4.6.8",
"commands": [
"dotnet-outdated"
]
],
"rollForward": false
}
}
}
}
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -477,3 +477,6 @@ dotnet_diagnostic.IDE0022.severity = silent

# CA1822: Mark members as static
dotnet_diagnostic.CA1822.severity = suggestion

# CA1515: Consider making public types internal
dotnet_diagnostic.CA1515.severity = suggestion
14 changes: 6 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ jobs:
os: [ubuntu-latest, windows-latest]
steps:
- name: "Checkout"
uses: actions/checkout@v2.4.0
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: "Install .NET SDK"
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.204
- name: Install Aspire workload
run: dotnet workload install aspire
dotnet-version: 9.0.304
- name: "Dotnet Tool Restore"
run: dotnet tool restore
shell: pwsh
Expand All @@ -54,7 +52,7 @@ jobs:
run: dotnet cake --target=Pack
shell: pwsh
- name: "Publish Artefacts"
uses: actions/upload-artifact@v2.3.1
uses: actions/upload-artifact@v4
with:
name: ${{matrix.os}}
path: "./Artefacts"
Expand Down Expand Up @@ -111,7 +109,7 @@ jobs:
runs-on: windows-latest
steps:
- name: "Download Artefact"
uses: actions/download-artifact@v2.1.0
uses: actions/download-artifact@v4
with:
name: "windows-latest"
- name: "Dotnet NuGet Add Source"
Expand All @@ -131,7 +129,7 @@ jobs:
runs-on: windows-latest
steps:
- name: "Download Artefact"
uses: actions/download-artifact@v2.1.0
uses: actions/download-artifact@v4
with:
name: "windows-latest"
- name: "Dotnet NuGet Push"
Expand Down
41 changes: 29 additions & 12 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,49 @@
"version": "0.2.0",
"configurations": [
{
"name": "debug",
"name": "scan:cli",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/Dependify.Cli/bin/Debug/net8.0/Dependify.Cli.dll",
"args": [],
"program": "${workspaceFolder}/src/Dependify.Cli/bin/Debug/net9.0/Dependify.Cli.dll",
"args": [
"graph",
"show",
".",
"--format",
"json"
],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "externalTerminal",
"env": {}
},
{
"name": "serve:debug-samples",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/Dependify.Cli/bin/Debug/net9.0/Dependify.Cli.dll",
"args": [
"serve",
"./samples/"
],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "externalTerminal",
"env": {}
},
{
"name": "serve:debug",
"name": "serve:debug-root",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/Dependify.Cli/bin/Debug/net8.0/Dependify.Cli.dll",
"program": "${workspaceFolder}/src/Dependify.Cli/bin/Debug/net9.0/Dependify.Cli.dll",
"args": [
"serve",
"C:\\Users\\Oleksii_Nikiforov\\dev\\dependify\\samples\\aspire-project",
"--endpoint",
"http://localhost:60759/",
"--model-id",
"phi3:mini",
"--api-key",
"apiKey"
".",
"-l",
"Information"
],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cSpell.words": [
"Dependify"
"Dependify",
"Ollama"
],
"[csharp]": {
"editor.defaultFormatter": "csharpier.csharpier-vscode"
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<AnalysisLevel>latest</AnalysisLevel>
Expand Down
64 changes: 0 additions & 64 deletions dependify.sln

This file was deleted.

12 changes: 12 additions & 0 deletions dependify.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Solution>
<Folder Name="/src/">
<Project Path="src/Dependify.Aspire.Hosting.Ollama/Dependify.Aspire.Hosting.Ollama.csproj" />
<Project Path="src/Dependify.Aspire.Hosting/Dependify.Aspire.Hosting.csproj" />
<Project Path="src/Dependify.Cli/Dependify.Cli.csproj" />
<Project Path="src/Dependify.Core/Dependify.Core.csproj" />
<Project Path="src/Web/Web.csproj" />
</Folder>
<Folder Name="/tests/">
<Project Path="tests/Dependify.Core.Tests/Dependify.Core.Tests.csproj" />
</Folder>
</Solution>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireHost>true</IsAspireHost>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireSharedProject>true</IsAspireSharedProject>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
54 changes: 24 additions & 30 deletions src/Dependify.Aspire.Hosting.Ollama/OllamaLifecycleHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Aspire.Hosting.Lifecycle;
using Microsoft.Extensions.Logging;
using OllamaSharp;
using OllamaSharp.Models;

internal sealed class OllamaLifecycleHook(
ResourceLoggerService loggerService,
Expand Down Expand Up @@ -72,7 +73,7 @@

// retrieve the list of models available in the ollama server
var modelsAvailable = await ollamaClient
.ListLocalModels(cancellationToken)
.ListLocalModelsAsync(cancellationToken)
.ConfigureAwait(false);
var availableModelNames = modelsAvailable.Select(m => m.Name) ?? [];

Expand Down Expand Up @@ -121,7 +122,7 @@
)
.ConfigureAwait(false);
}
catch (Exception ex)

Check warning on line 125 in src/Dependify.Aspire.Hosting.Ollama/OllamaLifecycleHook.cs

View workflow job for this annotation

GitHub Actions / Build-ubuntu-latest

Modify 'DownloadModel' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 125 in src/Dependify.Aspire.Hosting.Ollama/OllamaLifecycleHook.cs

View workflow job for this annotation

GitHub Actions / Build-ubuntu-latest

Modify 'DownloadModel' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 125 in src/Dependify.Aspire.Hosting.Ollama/OllamaLifecycleHook.cs

View workflow job for this annotation

GitHub Actions / Build-windows-latest

Modify 'DownloadModel' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 125 in src/Dependify.Aspire.Hosting.Ollama/OllamaLifecycleHook.cs

View workflow job for this annotation

GitHub Actions / Build-windows-latest

Modify 'DownloadModel' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)
{
await notificationService
.PublishUpdateAsync(
Expand Down Expand Up @@ -159,32 +160,26 @@

long percentage = 0;

await ollamaClient
.PullModel(
model,
async status =>
await foreach (var response in ollamaClient.PullModelAsync(new PullModelRequest { Model = model }, cancellationToken))
{
if (response?.Total != 0 && response?.Total != null && response?.Completed != null)
{
var newPercentage = (long)(response.Completed / (double)response.Total * 100);
if (newPercentage != percentage)
{
if (status.Total != 0)
{
var newPercentage = (long)(status.Completed / (double)status.Total * 100);
if (newPercentage != percentage)
{
percentage = newPercentage;

var percentageState =
percentage == 0 ? "Downloading model" : $"Downloading ({model}) {percentage}%";
await notificationService
.PublishUpdateAsync(
resource,
state => state with { State = new(percentageState, KnownResourceStateStyles.Info) }
)
.ConfigureAwait(false);
}
}
},
cancellationToken
)
.ConfigureAwait(false);
percentage = newPercentage;

var percentageState =
percentage == 0 ? "Downloading model" : $"Downloading ({model}) {percentage}%";
await notificationService
.PublishUpdateAsync(
resource,
state => state with { State = new(percentageState, KnownResourceStateStyles.Info) }
)
.ConfigureAwait(false);
}
}
}

logger.LogInformation(
"{TimeStamp}: Finished pulling ollama model {Model}",
Expand All @@ -193,10 +188,9 @@
);
}

public ValueTask DisposeAsync()
public async ValueTask DisposeAsync()
{
this.cancellationTokenSource.Cancel();

return default;
await this.cancellationTokenSource.CancelAsync();
this.cancellationTokenSource.Dispose();
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Label="Package">
Expand Down
Loading
Loading