feat: rename info to status, add /status slash command

Rename session info endpoint from /sessions/:id/info to /sessions/:id/status
and update frontend tab label accordingly. Add /status slash command that
displays current session metrics (message count, context usage, cache hit
rate, used skills) as formatted text in any channel.
This commit is contained in:
Acbox
2026-04-02 03:28:48 +08:00
parent b3c783fb0b
commit 33b57ee345
14 changed files with 154 additions and 28 deletions
+17
View File
@@ -42,6 +42,23 @@ func (q *Queries) GetLatestAssistantUsage(ctx context.Context, sessionID pgtype.
return input_tokens, err
}
const getLatestSessionIDByBot = `-- name: GetLatestSessionIDByBot :one
SELECT s.id
FROM bot_sessions s
WHERE s.bot_id = $1
AND s.type = 'chat'
AND s.deleted_at IS NULL
ORDER BY s.updated_at DESC
LIMIT 1
`
func (q *Queries) GetLatestSessionIDByBot(ctx context.Context, botID pgtype.UUID) (pgtype.UUID, error) {
row := q.db.QueryRow(ctx, getLatestSessionIDByBot, botID)
var id pgtype.UUID
err := row.Scan(&id)
return id, err
}
const getSessionCacheStats = `-- name: GetSessionCacheStats :one
SELECT
COALESCE(SUM((m.usage->>'inputTokens')::bigint), 0)::bigint AS total_input_tokens,