mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user