Files
gott/Endpoints/InfoEndpoint.cs
T
Meleki a646e695cd feat: embedding model warning modal on frontend load
- InfoEndpoint: EmbeddingService injiziert, embeddingAvailable in /api/info Response
- title.js: _showEmbeddingWarning() Modal via _createModal() wenn Modell fehlt
- base.css: ol margin-left wie ul (geordnete Listen)
2026-03-11 14:38:27 +01:00

47 lines
1.6 KiB
C#

using System;
using System.IO;
using System.Reflection;
using Gott.Services;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
namespace Gott.Endpoints;
public static class InfoEndpoint
{
public static void MapInfoEndpoint(this IEndpointRouteBuilder app)
{
app.MapGet("/api/info", HandleInfo);
}
private static IResult HandleInfo(EmbeddingService embeddingService)
{
var assembly = Assembly.GetExecutingAssembly();
var location = assembly.Location;
long buildTime = 0;
if (!string.IsNullOrEmpty(location) && File.Exists(location))
{
var lastWrite = File.GetLastWriteTimeUtc(location);
buildTime = new DateTimeOffset(lastWrite).ToUnixTimeSeconds();
}
else
{
var dir = AppContext.BaseDirectory;
var exeName = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows) ? "gott.exe" : "gott";
var exePath = Path.Combine(dir, exeName);
if (File.Exists(exePath))
{
var lastWrite = File.GetLastWriteTimeUtc(exePath);
buildTime = new DateTimeOffset(lastWrite).ToUnixTimeSeconds();
}
}
var isWindows = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
var embeddingAvailable = embeddingService.IsAvailable;
return Results.Json(new { buildTime, isWindows, embeddingAvailable });
}
}