feat: 按发布时间倒序排列AI推荐结果

This commit is contained in:
dmy
2026-01-12 22:56:35 +08:00
parent 996289c671
commit 5f186bfb2a
2 changed files with 16 additions and 1 deletions

View File

@@ -144,6 +144,13 @@ ${JSON.stringify(bids.map(b => b.title), null, 2)}`;
});
}
// 按发布时间倒序排列
result.sort((a, b) => {
if (!a.publishDate) return 1;
if (!b.publishDate) return -1;
return new Date(b.publishDate).getTime() - new Date(a.publishDate).getTime();
});
return result;
} catch (error) {
this.logger.error('获取最新 AI 推荐失败:', error);