summaryrefslogtreecommitdiffhomepage
path: root/internal/llm/tools
diff options
context:
space:
mode:
Diffstat (limited to 'internal/llm/tools')
-rw-r--r--internal/llm/tools/edit.go7
-rw-r--r--internal/llm/tools/tools.go2
-rw-r--r--internal/llm/tools/write.go2
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
}