From c5e1d0c88c0b6a01be8e751f78a87d23536e6592 Mon Sep 17 00:00:00 2001 From: ywkj Date: Sun, 26 Apr 2026 20:34:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20rerank=20top-N=2010=E2=86=925,=20?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=20Feishu=20=E5=88=97=E8=A1=A8=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SKILL.md | 2 +- src/index.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/SKILL.md b/SKILL.md index 30315a1..8864a26 100644 --- a/SKILL.md +++ b/SKILL.md @@ -67,7 +67,7 @@ bun dist/run.js [args] [--dry-run] ## 结果展示格式 -将 `rerank.results`(优先)或 `searchBody.data.items.item` 格式化为 markdown 表格,**每页 5 行**: +将 `rerank.results`(优先)或 `searchBody.data.items.item` 格式化为 markdown 表格,**最多 5 条**: | # | 商品名称 | 价格 | 销量 | 链接 | |---|----------|------|------|------| diff --git a/src/index.ts b/src/index.ts index 86bfa81..23f73c3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -212,7 +212,7 @@ async function runDetectBestAndSearch(args: string[], dryRun: boolean): Promise< // Otherwise fall back to the keyword-intersection rerank. if (!dryRun && postFilter && !postFilter.error && postFilter.keptCount > 0) { const items: SearchItem[] = (searchResult.searchBody as any)?.data?.items?.item ?? []; - const sorted = [...items].sort((a, b) => (b.sales ?? 0) - (a.sales ?? 0)).slice(0, 10); + const sorted = [...items].sort((a, b) => (b.sales ?? 0) - (a.sales ?? 0)).slice(0, 5); rerankResult = { source: 'post-filter', results: sorted, @@ -225,7 +225,7 @@ async function runDetectBestAndSearch(args: string[], dryRun: boolean): Promise< rerankResult = await runRerank([ `--image-results=${tmpFile}`, `--description=${best.description}`, - '--top=10', + '--top=5', ], dryRun); } catch (e: any) { rerankResult = { error: e.message }; @@ -360,7 +360,7 @@ async function runDetectAndSearch(args: string[], dryRun: boolean): Promise 0) { const items: SearchItem[] = (searchResult.searchBody as any)?.data?.items?.item ?? []; - const sorted = [...items].sort((a, b) => (b.sales ?? 0) - (a.sales ?? 0)).slice(0, 10); + const sorted = [...items].sort((a, b) => (b.sales ?? 0) - (a.sales ?? 0)).slice(0, 5); rerankResult = { source: 'post-filter', results: sorted, @@ -373,7 +373,7 @@ async function runDetectAndSearch(args: string[], dryRun: boolean): Promise const positionals = args.filter((a) => !a.startsWith('--')); const imageResultsArg = getFlag(args, '--image-results') || positionals[0]; const keywordArg = getFlag(args, '--keyword') || positionals[1]; - const topN = parseInt(getFlag(args, '--top') || '10', 10); + const topN = parseInt(getFlag(args, '--top') || '5', 10); const description = getFlag(args, '--description') || '';