feat: add a service for periodic cleanup of error accounts based on configuration.

This commit is contained in:
2026-02-01 06:02:39 +08:00
parent e867bc5cbd
commit 14a07e741e
5 changed files with 85 additions and 10 deletions

View File

@@ -131,8 +131,22 @@ export default function LiveLogViewer({
}
}
const handleClear = () => {
setLogs([])
const handleClear = async () => {
if (!confirm('确定要清空所有日志吗?此操作不可撤销。')) {
return
}
try {
const res = await fetch('/api/logs/clear', { method: 'POST' })
const data = await res.json()
if (data.code === 0) {
setLogs([])
pausedLogsRef.current = []
} else {
alert('清空日志失败: ' + (data.message || '未知错误'))
}
} catch (e) {
alert('清空日志失败: ' + (e instanceof Error ? e.message : '网络错误'))
}
}
return (
@@ -161,8 +175,8 @@ export default function LiveLogViewer({
</button>
<button
onClick={handleClear}
className="p-1.5 rounded-lg bg-slate-700 text-slate-400 hover:bg-slate-600 transition-colors"
title="清空"
className="p-1.5 rounded-lg bg-red-500/20 text-red-400 hover:bg-red-500/30 transition-colors"
title="清空所有日志"
>
<Trash2 className="h-3.5 w-3.5" />
</button>