feat(config): 更新配置中字段名从target_link改为detail_link

将JSON配置中的target_link字段统一改为detail_link,以更好地反映链接的实际用途。

BREAKING CHANGE: 配置文件中的字段名发生变化,需要更新相关引用
```
This commit is contained in:
2026-03-11 14:42:38 +08:00
parent 40118ec508
commit 0648770a6a
4 changed files with 11 additions and 5 deletions

View File

@@ -100,7 +100,7 @@ async function checkTask(taskId, options = {}) {
/**
* 运行 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 = {}) {
const baseUrl = options.baseUrl || DEFAULT_BASE_URL;
@@ -135,7 +135,13 @@ export async function runAgentTask(prompt, options = {}) {
if (result.success) {
console.log(`${logPrefix} 任务完成: ${result.message}`);
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} 条结果`);
return { results };
} else {

View File

@@ -785,7 +785,7 @@ function generateScraperResultsHtml(results) {
date: item.date || '-',
amount: amountText,
hasAmount,
url: item.target_link || item.url || '',
url: item.detail_link || item.target_link || item.url || '',
});
}
}