fix: SkillsUsage 页面样式修复与 API server skill usage 统计 (#698)

* Reapply "feat: 新增 Skills Usage 监控统计与图表 (#668)" (#670)

This reverts commit 91de3b12a1.

* fix: count API-server skill usage

* fix: align SkillsUsageView header with other pages and update sidebar icon

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Zhicheng Han <zhicheng.han@mathematik.uni-goettingen.de>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
ekko
2026-05-14 09:28:51 +08:00
committed by GitHub
parent eae7195ba8
commit 9170e11715
19 changed files with 1760 additions and 3 deletions
+41
View File
@@ -45,11 +45,52 @@ export interface SkillsData {
archived: SkillInfo[]
}
export interface SkillUsageRow {
skill: string
view_count: number
manage_count: number
total_count: number
percentage: number
last_used_at: number | null
}
export interface SkillUsageDailySkillRow {
skill: string
view_count: number
manage_count: number
total_count: number
}
export interface SkillUsageDailyRow {
date: string
view_count: number
manage_count: number
total_count: number
skills: SkillUsageDailySkillRow[]
}
export interface SkillUsageStats {
period_days: number
summary: {
total_skill_loads: number
total_skill_edits: number
total_skill_actions: number
distinct_skills_used: number
}
by_day: SkillUsageDailyRow[]
top_skills: SkillUsageRow[]
}
export async function fetchSkills(): Promise<SkillsData> {
const res = await request<SkillListResponse>('/api/hermes/skills')
return { categories: res.categories, archived: res.archived ?? [] }
}
export async function fetchSkillUsageStats(days = 7): Promise<SkillUsageStats> {
const params = new URLSearchParams({ days: String(days) })
return request<SkillUsageStats>(`/api/hermes/skills/usage/stats?${params}`)
}
export async function fetchSkillContent(skillPath: string): Promise<string> {
const res = await request<{ content: string }>(`/api/hermes/skills/${skillPath}`)
return res.content