add tool use, update system prompt
This commit is contained in:
66
src/types/apply.ts
Normal file
66
src/types/apply.ts
Normal 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;
|
||||
@@ -2,6 +2,7 @@ import { SerializedEditorState } from 'lexical'
|
||||
|
||||
import { SelectVector } from '../database/schema'
|
||||
|
||||
import { ApplyStatus } from './apply'
|
||||
import { LLMModel } from './llm/model'
|
||||
import { ContentPart } from './llm/request'
|
||||
import { ResponseUsage } from './llm/response'
|
||||
@@ -9,6 +10,7 @@ import { Mentionable, SerializedMentionable } from './mentionable'
|
||||
|
||||
export type ChatUserMessage = {
|
||||
role: 'user'
|
||||
applyStatus: ApplyStatus
|
||||
content: SerializedEditorState | null
|
||||
promptContent: string | ContentPart[] | null
|
||||
id: string
|
||||
@@ -20,6 +22,7 @@ export type ChatUserMessage = {
|
||||
|
||||
export type ChatAssistantMessage = {
|
||||
role: 'assistant'
|
||||
applyStatus: ApplyStatus
|
||||
content: string
|
||||
reasoningContent: string
|
||||
id: string
|
||||
@@ -33,6 +36,7 @@ export type ChatMessage = ChatUserMessage | ChatAssistantMessage
|
||||
|
||||
export type SerializedChatUserMessage = {
|
||||
role: 'user'
|
||||
applyStatus: ApplyStatus
|
||||
content: SerializedEditorState | null
|
||||
promptContent: string | ContentPart[] | null
|
||||
id: string
|
||||
@@ -44,6 +48,7 @@ export type SerializedChatUserMessage = {
|
||||
|
||||
export type SerializedChatAssistantMessage = {
|
||||
role: 'assistant'
|
||||
applyStatus: ApplyStatus
|
||||
content: string
|
||||
reasoningContent: string
|
||||
id: string
|
||||
|
||||
Reference in New Issue
Block a user