```
feat: 切换到Firecrawl Browser Sandbox并更新API密钥 - 将抓取功能从Firecrawl Agent切换到Firecrawl Browser Sandbox - 更新.env文件中的FIRECRAWL_API_KEY为新密钥 - 修改前端界面文本,将"Firecrawl Agent"改为"Firecrawl Browser Sandbox" - 重构runScraper函数,添加按钮状态管理和滚动定位功能 - 移除zod验证schema,简化数据处理逻辑 - 更新定时任务调度器以使用新的浏览器抓取方式 - 清空results.json历史数据 ```
This commit is contained in:
@@ -906,7 +906,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p style="color:#888;font-size:13px;margin:-8px 0 18px;">通过配置 URL 和提示词,使用 Firecrawl Agent
|
||||
<p style="color:#888;font-size:13px;margin:-8px 0 18px;">通过配置 URL 和提示词,使用 Firecrawl Browser Sandbox
|
||||
抓取任意网页数据。结果会自动保存,可在「抓取结果」页查看历史。</p>
|
||||
|
||||
<div class="scrapers-table-wrap">
|
||||
@@ -1057,7 +1057,7 @@
|
||||
<td>
|
||||
<div class="action-btns">
|
||||
<button class="btn-sm btn-edit" onclick="openScraperModal('${s.id}')" title="编辑">编辑</button>
|
||||
<button class="btn-sm btn-run" onclick="runScraper('${s.id}')" title="测试运行">测试</button>
|
||||
<button class="btn-sm btn-run" onclick="runScraper('${s.id}', this)" title="测试运行">测试</button>
|
||||
<button class="btn-sm ${s.enabled ? 'btn-toggle-on' : 'btn-toggle-off'}" onclick="toggleScraper('${s.id}', ${!s.enabled})" title="切换启用状态">${s.enabled ? '禁用' : '启用'}</button>
|
||||
<button class="btn-sm btn-delete" onclick="deleteScraper('${s.id}')" title="删除">删除</button>
|
||||
</div>
|
||||
@@ -1140,12 +1140,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function runScraper(id) {
|
||||
async function runScraper(id, btnEl) {
|
||||
const item = scrapersList.find(s => s.id === id);
|
||||
const resultDiv = document.getElementById('scraperRunResult');
|
||||
const contentDiv = document.getElementById('scraperRunResultContent');
|
||||
resultDiv.style.display = 'block';
|
||||
contentDiv.textContent = `正在测试抓取「${item?.city} - ${item?.type}」,请稍候...`;
|
||||
resultDiv.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||
|
||||
const originalText = btnEl ? btnEl.textContent : '';
|
||||
if (btnEl) {
|
||||
btnEl.disabled = true;
|
||||
btnEl.textContent = '测试中...';
|
||||
}
|
||||
try {
|
||||
const res = await fetch(`/api/scrapers/${id}/run`, { method: 'POST' });
|
||||
const json = await res.json();
|
||||
@@ -1153,6 +1160,11 @@
|
||||
contentDiv.textContent = JSON.stringify(json.data, null, 2);
|
||||
} catch (err) {
|
||||
contentDiv.textContent = '❌ 测试失败: ' + err.message;
|
||||
} finally {
|
||||
if (btnEl) {
|
||||
btnEl.disabled = false;
|
||||
btnEl.textContent = originalText || '测试';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1213,4 +1225,4 @@
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user