```
feat(config): 更新配置中字段名从target_link改为detail_link 将JSON配置中的target_link字段统一改为detail_link,以更好地反映链接的实际用途。 BREAKING CHANGE: 配置文件中的字段名发生变化,需要更新相关引用 ```
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
{
|
{
|
||||||
"id": "task-1710000000001",
|
"id": "task-1710000000001",
|
||||||
"city": "南京市",
|
"city": "南京市",
|
||||||
"prompt": "使用scrapling技能的fetch来爬取https://njggzy.nanjing.gov.cn/njweb/gchw/goods.html里房建市政、工程货物、交通水务、政府采购、产权交易、土地矿产、铁路航运和农村产权8个板块的招标公告列表的当天的的招标公告,获取项目名称 和项目金额(可能为合同预估价/最高投标限价等等),如果当天没有公告,默认获取最新的1条数据,不要试图写代码去正则匹配金额,因为金额的表述很多样,优先获取到详情md文件(或者html)后,使用`takeMoney`工具进行获取提取金额。\n输出结果为json,json结构如下\n```\n{\n \"results\": [\n\n {\n \"type\": \"比如房建市政\",\n\t\t\"project_name\": \"\",\n\t\t\"amount_yuan\": 0,\n\t\t\"date\": \"yyyy-MM-dd\",\n\t\t\"target_link: \"http...\"\n\t }\n ]\n}\n```",
|
"prompt": "使用scrapling技能的fetch来爬取https://njggzy.nanjing.gov.cn/njweb/gchw/goods.html里房建市政、工程货物、交通水务、政府采购、产权交易、土地矿产、铁路航运和农村产权8个板块的招标公告列表的当天的的招标公告,获取项目名称 和项目金额(可能为合同预估价/最高投标限价等等),如果当天没有公告,默认获取最新的1条数据,不要试图写代码去正则匹配金额,因为金额的表述很多样,优先获取到详情md文件(或者html)后,使用`takeMoney`工具进行获取提取金额。\n输出结果为json,json结构如下\n```\n{\n \"results\": [\n\n {\n \"type\": \"比如房建市政\",\n\t\t\"project_name\": \"\",\n\t\t\"amount_yuan\": 0,\n\t\t\"date\": \"yyyy-MM-dd\",\n\t\t\"detail_link: \"http...\"\n\t }\n ]\n}\n```",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"mode": "glm-5",
|
"mode": "glm-5",
|
||||||
"useBrowser": false
|
"useBrowser": false
|
||||||
|
|||||||
@@ -850,7 +850,7 @@
|
|||||||
<span class="name">${item.project_name || '-'}</span>
|
<span class="name">${item.project_name || '-'}</span>
|
||||||
<span class="amount">${item.amount_yuan ? item.amount_yuan.toLocaleString() + ' 元' : '-'}</span>
|
<span class="amount">${item.amount_yuan ? item.amount_yuan.toLocaleString() + ' 元' : '-'}</span>
|
||||||
<span class="date">${item.date || '-'}</span>
|
<span class="date">${item.date || '-'}</span>
|
||||||
${item.target_link ? `<a href="${item.target_link}" target="_blank">查看</a>` : ''}
|
${(item.detail_link || item.target_link) ? `<a href="${item.detail_link || item.target_link}" target="_blank">查看</a>` : ''}
|
||||||
</div>
|
</div>
|
||||||
`).join('') : '<div style="padding:10px;color:#999;font-size:13px;">无数据</div>';
|
`).join('') : '<div style="padding:10px;color:#999;font-size:13px;">无数据</div>';
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ async function checkTask(taskId, options = {}) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 运行 agent 任务:创建 + 轮询直到完成
|
* 运行 agent 任务:创建 + 轮询直到完成
|
||||||
* 返回 { results: [{ type, project_name, amount_yuan, date, target_link }] }
|
* 返回 { results: [{ type, project_name, amount_yuan, date, detail_link }] }
|
||||||
*/
|
*/
|
||||||
export async function runAgentTask(prompt, options = {}) {
|
export async function runAgentTask(prompt, options = {}) {
|
||||||
const baseUrl = options.baseUrl || DEFAULT_BASE_URL;
|
const baseUrl = options.baseUrl || DEFAULT_BASE_URL;
|
||||||
@@ -135,7 +135,13 @@ export async function runAgentTask(prompt, options = {}) {
|
|||||||
if (result.success) {
|
if (result.success) {
|
||||||
console.log(`${logPrefix} 任务完成: ${result.message}`);
|
console.log(`${logPrefix} 任务完成: ${result.message}`);
|
||||||
const data = result.data || {};
|
const data = result.data || {};
|
||||||
const results = Array.isArray(data.results) ? data.results : [];
|
const rawResults = Array.isArray(data.results) ? data.results : [];
|
||||||
|
const results = rawResults.map(item => {
|
||||||
|
if (!item || typeof item !== 'object') return item;
|
||||||
|
const detailLink = item.detail_link || item.target_link;
|
||||||
|
const { target_link, ...rest } = item;
|
||||||
|
return detailLink ? { ...rest, detail_link: detailLink } : rest;
|
||||||
|
});
|
||||||
console.log(`${logPrefix} 获取到 ${results.length} 条结果`);
|
console.log(`${logPrefix} 获取到 ${results.length} 条结果`);
|
||||||
return { results };
|
return { results };
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -785,7 +785,7 @@ function generateScraperResultsHtml(results) {
|
|||||||
date: item.date || '-',
|
date: item.date || '-',
|
||||||
amount: amountText,
|
amount: amountText,
|
||||||
hasAmount,
|
hasAmount,
|
||||||
url: item.target_link || item.url || '',
|
url: item.detail_link || item.target_link || item.url || '',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user