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...'
This commit is contained in:
Meleki committed 2026-03-11 16:43:08 +01:00
1 parent 7972ca6a3a
commit 5ed910edcd
5 files changed
+127 -3

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
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 });
}
}