Add SessionEndpoint, update ChatEndpoint, update deploy script and project file, remove DEVY.md

This commit is contained in:
Meleki committed 2026-02-27 11:23:31 +01:00
1 parent a927d6da33
commit 882d4ec21d
5 files changed
+56 -26

No files matched your search

-23
View File
@@ -1,23 +0,0 @@
## Info
- **.NET 10** without Nullable and Implicit Usings
## Deployment
- **Workspace:** `/home/node/.openclaw/workspace/projects/gott/`
- **Build & Deploy:** `bash deploy.sh`
- **WICHTIG:** Bei reinen Frontend-Änderungen (CSS/JS/HTML) IMMER auch `publish/wwwroot/` aktualisieren!
## Git
- **Push:** `git push`
## Notizen
**Commits:** NICHT nach jeder Nachricht committen - erst wenn Aufgabe abgeschlossen und User zufrieden ist.
## REGELN (NIEMALS BRECHEN)
- **NUR `bash deploy.sh` für Deployment.** NIEMALS `dotnet publish` direkt ausführen. Wenn deploy.sh nicht funktioniert → NACHFRAGEN!
- **NIEMALS Dateien in `publish/data/` manuell überschreiben oder manipulieren.** Das sind Live-Daten (Sessions, Users, History). Ein falscher Schreibvorgang = Datenverlust.
- **Keine Experimente am Live-System.** Wenn was nicht klappt, nicht "kreativ werden" sondern FRAGEN!
+2
View File
@@ -83,6 +83,8 @@ public static class ChatEndpoint
if (!string.IsNullOrWhiteSpace(agent.Instructions)) if (!string.IsNullOrWhiteSpace(agent.Instructions))
promptParts.Add($"## Instructions\n{agent.Instructions}"); promptParts.Add($"## Instructions\n{agent.Instructions}");
if (!string.IsNullOrWhiteSpace(session.Workspace))
promptParts.Add($"## Workspace\n{session.Workspace}");
if (!string.IsNullOrWhiteSpace(session.Context)) if (!string.IsNullOrWhiteSpace(session.Context))
promptParts.Add($"## Kontext\n{session.Context}"); promptParts.Add($"## Kontext\n{session.Context}");
+50
View File
@@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -17,6 +18,7 @@ public static class SessionEndpoint
app.MapPost("/api/sessions", HandleCreate); app.MapPost("/api/sessions", HandleCreate);
app.MapPut("/api/sessions/{sessionId}", HandleUpdate); app.MapPut("/api/sessions/{sessionId}", HandleUpdate);
app.MapDelete("/api/sessions/{sessionId}", HandleDelete); app.MapDelete("/api/sessions/{sessionId}", HandleDelete);
app.MapGet("/api/sessions/{sessionId}/system-prompt", HandleSystemPrompt);
} }
private static async Task HandleList(HttpContext ctx, DatabaseService db) private static async Task HandleList(HttpContext ctx, DatabaseService db)
@@ -81,4 +83,52 @@ public static class SessionEndpoint
await db.DeleteSession(sessionId); await db.DeleteSession(sessionId);
ctx.Response.StatusCode = 204; ctx.Response.StatusCode = 204;
} }
private static async Task HandleSystemPrompt(HttpContext ctx, DatabaseService db)
{
var sessionId = ctx.Request.RouteValues["sessionId"]?.ToString();
if (string.IsNullOrEmpty(sessionId))
{
ctx.Response.StatusCode = 400;
return;
}
var session = await db.GetSession(sessionId);
if (session == null)
{
ctx.Response.StatusCode = 404;
return;
}
if (string.IsNullOrEmpty(session.AgentId))
{
ctx.Response.StatusCode = 400;
await ctx.Response.WriteAsJsonAsync(new { error = "Kein Agent ausgewählt" });
return;
}
var agent = await db.GetAgent(session.AgentId);
if (agent == null)
{
ctx.Response.StatusCode = 400;
await ctx.Response.WriteAsJsonAsync(new { error = "Agent nicht gefunden" });
return;
}
var promptParts = new List<string>();
promptParts.Add($"Du bist {agent.Name}.");
if (!string.IsNullOrWhiteSpace(agent.Persona))
promptParts.Add($"## Persona\n{agent.Persona}");
if (!string.IsNullOrWhiteSpace(agent.Instructions))
promptParts.Add($"## Instructions\n{agent.Instructions}");
if (!string.IsNullOrWhiteSpace(session.Workspace))
promptParts.Add($"## Workspace\n{session.Workspace}");
if (!string.IsNullOrWhiteSpace(session.Context))
promptParts.Add($"## Kontext\n{session.Context}");
var systemPrompt = string.Join("\n\n", promptParts);
ctx.Response.ContentType = "text/plain; charset=utf-8";
await ctx.Response.WriteAsync(systemPrompt);
}
} }
+3 -2
View File
@@ -6,6 +6,7 @@ _hostname=$(hostname)
if [ "$_hostname" = "stein2" ]; then if [ "$_hostname" = "stein2" ]; then
cd /home/node/.openclaw/workspace/projects/gott cd /home/node/.openclaw/workspace/projects/gott
systemctl stop gott
elif [ "$_hostname" = "meleki" ]; then elif [ "$_hostname" = "meleki" ]; then
cd ~/.openclaw/workspace/projects/gott cd ~/.openclaw/workspace/projects/gott
else else
@@ -19,9 +20,9 @@ dotnet publish -c Release -o publish
cp wwwroot/index.html publish/wwwroot/index.html cp wwwroot/index.html publish/wwwroot/index.html
if [ "$_hostname" = "stein2" ]; then if [ "$_hostname" = "stein2" ]; then
systemctl restart gott systemctl start gott
elif [ "$_hostname" = "meleki" ]; then elif [ "$_hostname" = "meleki" ]; then
ssh -o ConnectTimeout=5 meleki@192.168.100.200 "nohup sudo systemctl restart gott > /dev/null 2>&1 &" ssh -o ConnectTimeout=5 meleki@192.168.100.200 "nohup sudo systemctl restart gott > /dev/null 2>&1 &"
fi fi
echo "Service restarted" echo "OK"
+1 -1
View File
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net9.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<NoWarn>ASP0015;IDE0017;IDE0028;IDE0130;IDE0305;IDE1006;SYSLIB1045</NoWarn> <NoWarn>ASP0015;IDE0017;IDE0028;IDE0130;IDE0305;IDE1006;SYSLIB1045</NoWarn>
</PropertyGroup> </PropertyGroup>