Skip to content

Commit

Permalink
Moving from a lifecycle hook to event for model download
Browse files Browse the repository at this point in the history
The lifecycle hook would get blocked if you used WaitFor on the model resource, as it wouldn't fire until the model was healthy, which it couldn't achieve. Refactored to use an event instead that relies on the server resource ready event.

Had to turn the event into a non-blocking with Task.Run otherwise models couldn't be downloaded concurrently, as the events would run one at a time, waiting for model download completion before continuing on.

Also took this time to refactor the AddModel method to have a few extension methods, making it a bit clearer as to what happens when.

Fixes #256
  • Loading branch information
aaronpowell committed Nov 18, 2024
1 parent 4475e9d commit 28c61f6
Show file tree
Hide file tree
Showing 3 changed files with 190 additions and 213 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
builder.AddProject<Projects.CommunityToolkit_Aspire_Hosting_Ollama_Web>("webfrontend")
.WithExternalHttpEndpoints()
.WithReference(phi3)
.WaitFor(phi3)
.WithReference(llama);

builder.Build().Run();

This file was deleted.

Loading

0 comments on commit 28c61f6

Please sign in to comment.