diff options
| author | Kujtim Hoxha <[email protected]> | 2025-04-13 14:37:05 +0200 |
|---|---|---|
| committer | Kujtim Hoxha <[email protected]> | 2025-04-21 13:41:27 +0200 |
| commit | cdc5f209dccdc980714f2ca1aeb52133d6e93cce (patch) | |
| tree | 02fe97994dfce7f2e842be7b4c5170f534220eee /internal/llm/tools | |
| parent | 3ad983db0f2c08826d56cb5de274d706c95b3353 (diff) | |
| download | opencode-cdc5f209dccdc980714f2ca1aeb52133d6e93cce.tar.gz opencode-cdc5f209dccdc980714f2ca1aeb52133d6e93cce.zip | |
cleanup diff, cleanup agent
Diffstat (limited to 'internal/llm/tools')
| -rw-r--r-- | internal/llm/tools/edit.go | 7 | ||||
| -rw-r--r-- | internal/llm/tools/tools.go | 2 | ||||
| -rw-r--r-- | internal/llm/tools/write.go | 2 |
3 files changed, 5 insertions, 6 deletions
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 } |
