Initial commit: Nexus Mission Control Platform
- ASP.NET Core 10 Backend (JWT Auth, Agent config API) - Vue 3 Frontend (Dashboard, Team, Agents, Config Editor) - PostgreSQL Database - Docker Compose setup - Mission Control Dashboard redesign
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using System.Net.Http.Json;
|
||||
using Nexus.Api.Domain;
|
||||
|
||||
namespace Nexus.Api.Integrations;
|
||||
|
||||
public sealed class OllamaProvider(HttpClient client) : IModelProvider
|
||||
{
|
||||
private sealed record OllamaTag(string Name);
|
||||
private sealed record OllamaTags(IReadOnlyCollection<OllamaTag>? Models);
|
||||
|
||||
public string Name => "Ollama";
|
||||
|
||||
public async Task<IReadOnlyCollection<ModelProviderStatus>> GetModelsAsync(
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await client.GetFromJsonAsync<OllamaTags>("/api/tags", cancellationToken);
|
||||
return response?.Models?
|
||||
.Select(model => new ModelProviderStatus(
|
||||
Name,
|
||||
model.Name,
|
||||
OperationalStatus.Online,
|
||||
true,
|
||||
"Local"))
|
||||
.ToArray() ?? [];
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
return
|
||||
[
|
||||
new(Name, "qwen3:4b", OperationalStatus.Offline, true, exception.Message)
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user