(limit = 10)
| 287 | * @returns {Promise<string[]>} 工具名称数组 |
| 288 | */ |
| 289 | const getRecentUsedTools = async (limit = 10) => { |
| 290 | // 确保数据已加载 |
| 291 | await loadUsageData(); |
| 292 | // 收集所有日期,按新到旧排序 |
| 293 | const dates = Object.keys(usageData.dailyUsage).sort((a, b) => b.localeCompare(a)); |
| 294 | const toolSet = []; |
| 295 | for (const date of dates) { |
| 296 | const tools = Object.keys(usageData.dailyUsage[date].tools || {}); |
| 297 | for (const tool of tools) { |
| 298 | if (!toolSet.includes(tool)) { |
| 299 | toolSet.push(tool); |
| 300 | if (toolSet.length >= limit) { |
| 301 | return toolSet; |
| 302 | } |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | return toolSet; |
| 307 | }; |
| 308 | |
| 309 | /** |
| 310 | * 获取DashBoard统计数据 |
nothing calls this directly
no test coverage detected