autosnippet
Version:
Extract code patterns into a knowledge base for AI coding assistants
176 lines (175 loc) • 4.43 kB
TypeScript
/**
* query.js — 查询类工具 (6)
*
* 3. search_recipes 搜索知识库 Recipe
* 2. search_candidates 搜索候选项
* 3. get_recipe_detail 获取 Recipe 详情
* 4. get_project_stats 获取项目统计
* 5. search_knowledge RAG 语义搜索
* 6. get_related_recipes 知识图谱关联查询
*/
import type { ToolHandlerContext } from './_shared.js';
export interface SearchRecipesParams {
keyword?: string;
category?: string;
language?: string;
knowledgeType?: string;
limit?: number;
}
export interface SearchCandidatesParams {
keyword?: string;
status?: string;
language?: string;
category?: string;
limit?: number;
}
export interface SearchKnowledgeParams {
query: string;
topK?: number;
}
export declare const searchRecipes: {
name: string;
description: string;
parameters: {
type: string;
properties: {
keyword: {
type: string;
description: string;
};
category: {
type: string;
description: string;
};
language: {
type: string;
description: string;
};
knowledgeType: {
type: string;
description: string;
};
limit: {
type: string;
description: string;
};
};
};
handler: (params: SearchRecipesParams, ctx: ToolHandlerContext) => Promise<any>;
};
export declare const searchCandidates: {
name: string;
description: string;
parameters: {
type: string;
properties: {
keyword: {
type: string;
description: string;
};
status: {
type: string;
description: string;
};
language: {
type: string;
description: string;
};
category: {
type: string;
description: string;
};
limit: {
type: string;
description: string;
};
};
};
handler: (params: SearchCandidatesParams, ctx: ToolHandlerContext) => Promise<any>;
};
export declare const getRecipeDetail: {
name: string;
description: string;
parameters: {
type: string;
properties: {
recipeId: {
type: string;
description: string;
};
};
required: string[];
};
handler: (params: {
recipeId: string;
}, ctx: ToolHandlerContext) => Promise<any>;
};
export declare const getProjectStats: {
name: string;
description: string;
parameters: {
type: string;
properties: {};
};
handler: (_params: Record<string, never>, ctx: ToolHandlerContext) => Promise<{
knowledge: any;
knowledgeGraph: Record<string, unknown> | null;
}>;
};
export declare const searchKnowledge: {
name: string;
description: string;
parameters: {
type: string;
properties: {
query: {
type: string;
description: string;
};
topK: {
type: string;
description: string;
};
};
required: string[];
};
handler: (params: SearchKnowledgeParams, ctx: ToolHandlerContext) => Promise<{
source: string;
results: any;
_meta: {
confidence: string;
hint: string | null;
};
message?: undefined;
} | {
source: string;
results: never[];
message: string;
_meta: {
confidence: string;
hint: string;
};
}>;
};
export declare const getRelatedRecipes: {
name: string;
description: string;
parameters: {
type: string;
properties: {
recipeId: {
type: string;
description: string;
};
relation: {
type: string;
description: string;
};
};
required: string[];
};
handler: (params: {
recipeId: string;
relation?: string;
}, ctx: ToolHandlerContext) => Promise<any>;
};