From cdc5f209dccdc980714f2ca1aeb52133d6e93cce Mon Sep 17 00:00:00 2001 From: Kujtim Hoxha Date: Sun, 13 Apr 2025 14:37:05 +0200 Subject: cleanup diff, cleanup agent --- internal/llm/tools/edit.go | 7 +++---- internal/llm/tools/tools.go | 2 +- internal/llm/tools/write.go | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'internal/llm/tools') diff --git a/internal/llm/tools/edit.go b/internal/llm/tools/edit.go index c9a0be079..647b8d35f 100644 --- a/internal/llm/tools/edit.go +++ b/internal/llm/tools/edit.go @@ -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 } - diff --git a/internal/llm/tools/tools.go b/internal/llm/tools/tools.go index 473b787bb..07afe1363 100644 --- a/internal/llm/tools/tools.go +++ b/internal/llm/tools/tools.go @@ -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 { diff --git a/internal/llm/tools/write.go b/internal/llm/tools/write.go index 27c98bb9d..1b087c193 100644 --- a/internal/llm/tools/write.go +++ b/internal/llm/tools/write.go @@ -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 } -- cgit v1.2.3