Skip to content

Commit

Permalink
Remove warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
awaescher committed May 10, 2024
1 parent a79ac3c commit 4a3c57e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions OllamaApiConsole/Demos/ModelManagerConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ private async Task PullModel()

await AnsiConsole.Progress().StartAsync(async context =>
{
ProgressTask task = null;
ProgressTask? task = null;
await Ollama.PullModel(pullModel, status => UpdateProgressTaskByStatus(context, ref task, status));
task.StopTask();
task?.StopTask();
});
}

Expand All @@ -140,7 +140,7 @@ private async Task PushModel()
await Ollama.PushModel("mattw/pygmalion:latest", status => AnsiConsole.MarkupLineInterpolated($"{status.Status}"));
}

private void UpdateProgressTaskByStatus(ProgressContext context, ref ProgressTask task, PullStatus status)
private void UpdateProgressTaskByStatus(ProgressContext context, ref ProgressTask? task, PullStatus status)
{
if (status.Status != task?.Description)
{
Expand Down
3 changes: 2 additions & 1 deletion test/ChatTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ public class SendMethod : ChatTests
[Test]
public async Task Sends_Assistant_Answer_To_Streamer()
{
ChatResponseStream answerFromAssistant = null;
ChatResponseStream? answerFromAssistant = null;

_ollama.DefineChatResponse("assistant", "hi!");

var chat = new Chat(_ollama, answer => answerFromAssistant = answer);
await chat.Send("henlo", CancellationToken.None);

answerFromAssistant.Should().NotBeNull();
answerFromAssistant.Message.Role.Should().Be(ChatRole.Assistant);
answerFromAssistant.Message.Content.Should().Be("hi!");
}
Expand Down
2 changes: 1 addition & 1 deletion test/OllamaApiClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Tests;
public class OllamaApiClientTests
{
private OllamaApiClient _client;
private HttpResponseMessage _response;
private HttpResponseMessage? _response;

[OneTimeSetUp]
public void Setup()
Expand Down

0 comments on commit 4a3c57e

Please sign in to comment.