Avatar: Ctrl+V paste + serverseitige Skalierung auf max 256px; Tool-Boxes: Diff-View für edit/write_file, Foldout für alle Tools, stop_reason im Chat; ImageSharp 3.1.12

This commit is contained in:
Meleki committed 2026-02-27 16:46:07 +01:00
1 parent 18b2feef4a
commit e662548d79
13 files changed
+416 -42

No files matched your search

+6 -5
View File
@@ -47,13 +47,14 @@ public static class SessionEndpoint
await ctx.Response.WriteAsJsonAsync(session);
}
private static async Task HandleCreate(HttpContext ctx, DatabaseService db)
private static async Task HandleCreate(HttpContext ctx, DatabaseService db, ImageService imageService)
{
var body = await JsonSerializer.DeserializeAsync<JsonElement>(ctx.Request.Body);
var name = body.TryGetProperty("name", out var n) ? n.GetString() : "Neue Session";
var description = body.TryGetProperty("description", out var d) ? d.GetString() : null;
var image = body.TryGetProperty("image", out var img) ? img.GetString() : null;
var imageRaw = body.TryGetProperty("image", out var img) ? img.GetString() : null;
var image = imageService.ResizeDataUrl(imageRaw);
var agentId = body.TryGetProperty("agentId", out var a) ? a.GetString() : null;
var workspace = body.TryGetProperty("workspace", out var w) ? w.GetString() : null;
var context = body.TryGetProperty("context", out var ctxEl) ? ctxEl.GetString() : null;
@@ -63,7 +64,7 @@ public static class SessionEndpoint
await ctx.Response.WriteAsJsonAsync(session);
}
private static async Task HandleUpdate(HttpContext ctx, DatabaseService db)
private static async Task HandleUpdate(HttpContext ctx, DatabaseService db, ImageService imageService)
{
var sessionId = ctx.Request.RouteValues["sessionId"]?.ToString();
if (string.IsNullOrEmpty(sessionId))
@@ -73,7 +74,7 @@ public static class SessionEndpoint
}
var body = await JsonSerializer.DeserializeAsync<JsonElement>(ctx.Request.Body);
await db.UpdateSession(sessionId, body);
await db.UpdateSession(sessionId, body, imageService);
var session = await db.GetSession(sessionId);
await ctx.Response.WriteAsJsonAsync(session);
@@ -183,7 +184,7 @@ public static class SessionEndpoint
var process = Process.Start(psi);
if (process != null)
{
process.WaitForExit(5000);
process.WaitForExit(500);
}
ctx.Response.StatusCode = 202;