fix: rerank top-N 10→5, 匹配 Feishu 列表展示
register-skill-release / register (push) Successful in 17s Details

This commit is contained in:
ywkj 2026-04-26 20:34:57 +08:00
parent eb8e7a7daf
commit c5e1d0c88c
2 changed files with 6 additions and 6 deletions

View File

@ -67,7 +67,7 @@ bun dist/run.js <command> [args] [--dry-run]
## 结果展示格式 ## 结果展示格式
`rerank.results`(优先)或 `searchBody.data.items.item` 格式化为 markdown 表格,**每页 5 行** `rerank.results`(优先)或 `searchBody.data.items.item` 格式化为 markdown 表格,**最多 5 条**
| # | 商品名称 | 价格 | 销量 | 链接 | | # | 商品名称 | 价格 | 销量 | 链接 |
|---|----------|------|------|------| |---|----------|------|------|------|

View File

@ -212,7 +212,7 @@ async function runDetectBestAndSearch(args: string[], dryRun: boolean): Promise<
// Otherwise fall back to the keyword-intersection rerank. // Otherwise fall back to the keyword-intersection rerank.
if (!dryRun && postFilter && !postFilter.error && postFilter.keptCount > 0) { if (!dryRun && postFilter && !postFilter.error && postFilter.keptCount > 0) {
const items: SearchItem[] = (searchResult.searchBody as any)?.data?.items?.item ?? []; 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 = { rerankResult = {
source: 'post-filter', source: 'post-filter',
results: sorted, results: sorted,
@ -225,7 +225,7 @@ async function runDetectBestAndSearch(args: string[], dryRun: boolean): Promise<
rerankResult = await runRerank([ rerankResult = await runRerank([
`--image-results=${tmpFile}`, `--image-results=${tmpFile}`,
`--description=${best.description}`, `--description=${best.description}`,
'--top=10', '--top=5',
], dryRun); ], dryRun);
} catch (e: any) { } catch (e: any) {
rerankResult = { error: e.message }; rerankResult = { error: e.message };
@ -360,7 +360,7 @@ async function runDetectAndSearch(args: string[], dryRun: boolean): Promise<Outp
// Otherwise fall back to the keyword-intersection rerank. // Otherwise fall back to the keyword-intersection rerank.
if (!dryRun && postFilter && !postFilter.error && postFilter.keptCount > 0) { if (!dryRun && postFilter && !postFilter.error && postFilter.keptCount > 0) {
const items: SearchItem[] = (searchResult.searchBody as any)?.data?.items?.item ?? []; 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 = { rerankResult = {
source: 'post-filter', source: 'post-filter',
results: sorted, results: sorted,
@ -373,7 +373,7 @@ async function runDetectAndSearch(args: string[], dryRun: boolean): Promise<Outp
rerankResult = await runRerank([ rerankResult = await runRerank([
`--image-results=${tmpFile}`, `--image-results=${tmpFile}`,
`--description=${best.description}`, `--description=${best.description}`,
'--top=10', '--top=5',
], dryRun); ], dryRun);
} catch (e: any) { } catch (e: any) {
rerankResult = { error: e.message }; rerankResult = { error: e.message };
@ -493,7 +493,7 @@ async function runRerank(args: string[], dryRun: boolean): Promise<OutputResult>
const positionals = args.filter((a) => !a.startsWith('--')); const positionals = args.filter((a) => !a.startsWith('--'));
const imageResultsArg = getFlag(args, '--image-results') || positionals[0]; const imageResultsArg = getFlag(args, '--image-results') || positionals[0];
const keywordArg = getFlag(args, '--keyword') || positionals[1]; 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') || ''; const description = getFlag(args, '--description') || '';