fix: add missing getOperationStats function (v1.0.7)

This commit is contained in:
陈海富
2026-01-31 19:26:39 +08:00
parent ec3d588922
commit 52e91ba583
2 changed files with 16 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "cfspider-browser",
"version": "1.0.6",
"version": "1.0.7",
"description": "CFspider 智能浏览器 - AI驱动的可视化爬虫自然语言控制浏览器自动化",
"keywords": [
"browser",

View File

@@ -385,6 +385,21 @@ interface OperationLog {
let operationLogs: OperationLog[] = []
const MAX_OPERATION_LOGS = 50
/**
* 获取操作统计
*/
export function getOperationStats(): { total: number, successRate: number, domains: string[] } {
const total = operationLogs.length
const successful = operationLogs.filter(l => l.success).length
const domains = [...new Set(operationLogs.map(l => l.domain).filter(d => d))]
return {
total,
successRate: total > 0 ? Math.round((successful / total) * 100) : 0,
domains
}
}
/**
* 记录操作日志
*/