Files
gott/Endpoints/ModelsEndpoint.cs
T
Meleki 5ed910edcd feat: Dynamisches Modell-Laden für Nvidia & Pollinations Provider
- OpenAiService: FetchModels() generisch für beide Provider (OpenAI-Format & Pollinations-Array-Format)
- Pollinations Base-URL direkt auf text.pollinations.ai/openai (kein g4f.space Proxy → kein 402)
- Pollinations Modelle-URL: text.pollinations.ai/models
- ModelsEndpoint: /api/models/nvidia + /api/models/pollinations
- agent-page.js: loadProviderModels() generisch, Promise.all für beide Provider parallel
- index.html: statische Nvidia-Option entfernt, beide Optgroups mit 'Wird geladen...'
2026-03-11 16:43:08 +01:00

33 lines
1015 B
C#

using System.Linq;
using Gott.Services;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
namespace Gott.Endpoints;
public static class ModelsEndpoint
{
public static void MapModelsEndpoint(this IEndpointRouteBuilder app)
{
app.MapGet("/api/models/nvidia", HandleNvidiaModels);
app.MapGet("/api/models/pollinations", HandlePollinationsModels);
}
private static IResult HandleNvidiaModels(OpenAiService openAiService)
{
var models = openAiService.GetNvidiaModels()
.Select(m => new { id = m.Id, displayName = m.DisplayName })
.ToList();
return Results.Json(new { models });
}
private static IResult HandlePollinationsModels(OpenAiService openAiService)
{
var models = openAiService.GetPollinationsModels()
.Select(m => new { id = m.Id, displayName = m.DisplayName })
.ToList();
return Results.Json(new { models });
}
}