MCPcopy Create free account
hub / github.com/zxlie/FeHelper / getRecentUsedTools

Function getRecentUsedTools

apps/background/statistics.js:289–307  ·  view source on GitHub ↗
(limit = 10)

Source from the content-addressed store, hash-verified

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统计数据

Callers

nothing calls this directly

Calls 1

loadUsageDataFunction · 0.85

Tested by

no test coverage detected