cleanup diff, cleanup agent
This commit is contained in:
parent
3ad983db0f
commit
cdc5f209dc
19 changed files with 456 additions and 552 deletions
|
|
@ -190,7 +190,7 @@ func (e *editTool) createNewFile(ctx context.Context, filePath, content string)
|
|||
return er, fmt.Errorf("failed to create parent directories: %w", err)
|
||||
}
|
||||
|
||||
sessionID, messageID := getContextValues(ctx)
|
||||
sessionID, messageID := GetContextValues(ctx)
|
||||
if sessionID == "" || messageID == "" {
|
||||
return er, fmt.Errorf("session ID and message ID are required for creating a new file")
|
||||
}
|
||||
|
|
@ -277,7 +277,7 @@ func (e *editTool) deleteContent(ctx context.Context, filePath, oldString string
|
|||
|
||||
newContent := oldContent[:index] + oldContent[index+len(oldString):]
|
||||
|
||||
sessionID, messageID := getContextValues(ctx)
|
||||
sessionID, messageID := GetContextValues(ctx)
|
||||
|
||||
if sessionID == "" || messageID == "" {
|
||||
return er, fmt.Errorf("session ID and message ID are required for creating a new file")
|
||||
|
|
@ -365,7 +365,7 @@ func (e *editTool) replaceContent(ctx context.Context, filePath, oldString, newS
|
|||
|
||||
newContent := oldContent[:index] + newString + oldContent[index+len(oldString):]
|
||||
|
||||
sessionID, messageID := getContextValues(ctx)
|
||||
sessionID, messageID := GetContextValues(ctx)
|
||||
|
||||
if sessionID == "" || messageID == "" {
|
||||
return er, fmt.Errorf("session ID and message ID are required for creating a new file")
|
||||
|
|
@ -409,4 +409,3 @@ func (e *editTool) replaceContent(ctx context.Context, filePath, oldString, newS
|
|||
|
||||
return er, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ type BaseTool interface {
|
|||
Run(ctx context.Context, params ToolCall) (ToolResponse, error)
|
||||
}
|
||||
|
||||
func getContextValues(ctx context.Context) (string, string) {
|
||||
func GetContextValues(ctx context.Context) (string, string) {
|
||||
sessionID := ctx.Value(SessionIDContextKey)
|
||||
messageID := ctx.Value(MessageIDContextKey)
|
||||
if sessionID == nil {
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ func (w *writeTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
|
|||
}
|
||||
}
|
||||
|
||||
sessionID, messageID := getContextValues(ctx)
|
||||
sessionID, messageID := GetContextValues(ctx)
|
||||
if sessionID == "" || messageID == "" {
|
||||
return NewTextErrorResponse("session ID or message ID is missing"), nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue