add tool use, update system prompt

This commit is contained in:
duanfuxiang
2025-03-12 21:39:29 +08:00
parent cabf2d5fa4
commit b0fbbb22d3
36 changed files with 7149 additions and 430 deletions

66
src/types/apply.ts Normal file
View File

@@ -0,0 +1,66 @@
/**
* 用于指定插入内容的工具参数
*/
export enum ApplyStatus {
Idle = 0,
Applied = 1,
Failed = 2,
Rejected = 3,
}
export type ReadFileToolArgs = {
type: 'read_file';
filepath?: string;
}
export type ListFilesToolArgs = {
type: 'list_files';
filepath?: string;
recursive?: boolean;
}
export type RegexSearchFilesToolArgs = {
type: 'regex_search_files';
filepath?: string;
regex?: string;
file_pattern?: string;
finish?: boolean;
}
export type SemanticSearchFilesToolArgs = {
type: 'semantic_search_files';
filepath?: string;
query?: string;
finish?: boolean;
}
export type WriteToFileToolArgs = {
type: 'write_to_file';
filepath?: string;
content?: string;
startLine?: number;
endLine?: number;
}
export type InsertContentToolArgs = {
type: 'insert_content';
filepath?: string;
content?: string;
startLine?: number;
endLine?: number;
}
export type SearchAndReplaceToolArgs = {
type: 'search_and_replace';
filepath: string;
operations: {
search: string;
replace: string;
startLine?: number;
endLine?: number;
useRegex?: boolean;
ignoreCase?: boolean;
regexFlags?: string;
}[];
}
export type ToolArgs = ReadFileToolArgs | WriteToFileToolArgs | InsertContentToolArgs | SearchAndReplaceToolArgs | ListFilesToolArgs | RegexSearchFilesToolArgs | SemanticSearchFilesToolArgs;