(filename)
| 2968 | } |
| 2969 | |
| 2970 | async function resetSingleUsageStats(filename) { |
| 2971 | if (!confirm(`确定要重置 ${filename} 的使用统计吗?`)) return; |
| 2972 | |
| 2973 | try { |
| 2974 | const response = await fetch('./usage/reset', { |
| 2975 | method: 'POST', |
| 2976 | headers: getAuthHeaders(), |
| 2977 | body: JSON.stringify({ filename }) |
| 2978 | }); |
| 2979 | |
| 2980 | const data = await response.json(); |
| 2981 | |
| 2982 | if (response.ok && data.success) { |
| 2983 | showStatus(data.message, 'success'); |
| 2984 | await refreshUsageStats(); |
| 2985 | } else { |
| 2986 | showStatus(`重置失败: ${data.message || data.detail || data.error || '未知错误'}`, 'error'); |
| 2987 | } |
| 2988 | } catch (error) { |
| 2989 | showStatus(`网络错误: ${error.message}`, 'error'); |
| 2990 | } |
| 2991 | } |
| 2992 | |
| 2993 | async function resetAllUsageStats() { |
| 2994 | if (!confirm('确定要重置所有文件的使用统计吗?此操作不可恢复!')) return; |
nothing calls this directly
no test coverage detected