Compare commits
No commits in common. "main" and "v0.1.8" have entirely different histories.
2
SKILL.md
2
SKILL.md
|
|
@ -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 行**:
|
||||
|
||||
| # | 商品名称 | 价格 | 销量 | 链接 |
|
||||
|---|----------|------|------|------|
|
||||
|
|
|
|||
|
|
@ -55,20 +55,6 @@ export interface SessionResponse {
|
|||
hookToken?: string;
|
||||
}
|
||||
|
||||
export interface ClientConfig {
|
||||
clientId: string;
|
||||
name: string;
|
||||
status: string;
|
||||
metadata: {
|
||||
provider?: {
|
||||
api_key?: string;
|
||||
base_url?: string;
|
||||
model?: string;
|
||||
};
|
||||
[key: string]: unknown;
|
||||
};
|
||||
}
|
||||
|
||||
export interface SkillClientOptions {
|
||||
apiBase?: string;
|
||||
dryRun?: boolean;
|
||||
|
|
@ -105,13 +91,6 @@ export class SkillClient {
|
|||
return JSON.parse(runCli('session'));
|
||||
}
|
||||
|
||||
async clientConfig(): Promise<ClientConfig> {
|
||||
if (this.dryRun) {
|
||||
return { clientId: '<dry-run>', name: '<dry-run>', status: 'active', metadata: {} };
|
||||
}
|
||||
return JSON.parse(runCli('client-config'));
|
||||
}
|
||||
|
||||
async get(urlPath: string): Promise<ApiResponse> {
|
||||
return this.request('GET', urlPath);
|
||||
}
|
||||
|
|
|
|||
10
src/index.ts
10
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, 5);
|
||||
const sorted = [...items].sort((a, b) => (b.sales ?? 0) - (a.sales ?? 0)).slice(0, 10);
|
||||
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=5',
|
||||
'--top=10',
|
||||
], dryRun);
|
||||
} catch (e: any) {
|
||||
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.
|
||||
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, 5);
|
||||
const sorted = [...items].sort((a, b) => (b.sales ?? 0) - (a.sales ?? 0)).slice(0, 10);
|
||||
rerankResult = {
|
||||
source: 'post-filter',
|
||||
results: sorted,
|
||||
|
|
@ -373,7 +373,7 @@ async function runDetectAndSearch(args: string[], dryRun: boolean): Promise<Outp
|
|||
rerankResult = await runRerank([
|
||||
`--image-results=${tmpFile}`,
|
||||
`--description=${best.description}`,
|
||||
'--top=5',
|
||||
'--top=10',
|
||||
], dryRun);
|
||||
} catch (e: any) {
|
||||
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 imageResultsArg = getFlag(args, '--image-results') || positionals[0];
|
||||
const keywordArg = getFlag(args, '--keyword') || positionals[1];
|
||||
const topN = parseInt(getFlag(args, '--top') || '5', 10);
|
||||
const topN = parseInt(getFlag(args, '--top') || '10', 10);
|
||||
|
||||
const description = getFlag(args, '--description') || '';
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue