Dashboard-Performance: API-Endpoints konsolidieren
Backend:
- GET /api/sessions: Git-Status inline integriert (parallel pro Session)
- Neue Hilfsmethoden GetGitStatusSummaryAsync (Counts) und
GetGitStatusDetailedAsync (Dateinamen, für Einzel-Endpoint)
- GetSessionsWithStats gibt typisierte SessionWithStats zurück
- Neue Models: SessionWithStats, GitStatusSummary
- GET /api/agents: Skills inline pro Agent integriert
- SkillService als Parameter in HandleList
- Skills als Array mit slug/name/description
Frontend:
- Dashboard: 1 paralleler Promise.all statt sequentieller Requests
- Vorher: agents → sessions → N×git-status → M×agent-skills → cronjobs → shares
- Nachher: Promise.all([agents, sessions, cronjobs, shares]) (4 Requests)
- Git-Status direkt aus Session-Response, Skills aus Agent-Response
- Session-Page: Agent-Skills aus inline-Daten statt N×apiGetAgentSkills
Reduziert Dashboard-Requests von ~4+N+M auf 4 (fix).
This commit is contained in:
1 parent
0dcc05ebf9
commit
11acfde081
7 files changed
+265
-119
No files matched your search
@@ -419,13 +419,13 @@ public class DatabaseService
|
||||
"SELECT * FROM sessions WHERE user_id = @userId AND is_deleted = 0 ORDER BY updated_at DESC", new { userId });
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<object>> GetSessionsWithStats(string userId)
|
||||
public async Task<List<SessionWithStats>> GetSessionsWithStats(string userId)
|
||||
{
|
||||
using var conn = CreateConnection();
|
||||
var sessions = await conn.QueryAsync<SessionRecord>(
|
||||
"SELECT * FROM sessions WHERE user_id = @userId AND is_deleted = 0 ORDER BY updated_at DESC", new { userId });
|
||||
|
||||
var results = new List<object>();
|
||||
var results = new List<SessionWithStats>();
|
||||
foreach (var s in sessions)
|
||||
{
|
||||
var activeCount = await conn.ExecuteScalarAsync<int>(@"
|
||||
@@ -440,26 +440,9 @@ public class DatabaseService
|
||||
WHERE c.session_id = @sessionId AND m.type = 'text'",
|
||||
new { sessionId = s.SessionId });
|
||||
|
||||
results.Add(new
|
||||
results.Add(new SessionWithStats
|
||||
{
|
||||
s.SessionId,
|
||||
s.Name,
|
||||
s.Description,
|
||||
s.Image,
|
||||
s.AgentId,
|
||||
s.Workspace,
|
||||
s.Context,
|
||||
s.CustomCommands,
|
||||
s.AvatarScale,
|
||||
s.AvatarOffsetX,
|
||||
s.AvatarOffsetY,
|
||||
s.ReviewAgentId,
|
||||
s.MaxReviewIterations,
|
||||
s.FinalizerAgentId,
|
||||
s.PreparerAgentId,
|
||||
s.IsDeleted,
|
||||
s.CreatedAt,
|
||||
s.UpdatedAt,
|
||||
Session = s,
|
||||
MessageCount = activeCount,
|
||||
ArchiveMessageCount = totalCount - activeCount,
|
||||
TotalMessageCount = totalCount,
|
||||
|
||||
Reference in new issue
Block a user