diff options
| author | Kujtim Hoxha <[email protected]> | 2025-04-12 18:45:36 +0200 |
|---|---|---|
| committer | Kujtim Hoxha <[email protected]> | 2025-04-21 13:38:42 +0200 |
| commit | bd2ec29b65e430f83f430db5fdc424c7d631989d (patch) | |
| tree | 0d7ee1a29a7932d54ffa1f247303568d85a3cf11 /internal/llm/tools/tools.go | |
| parent | 0697dcc1d9c7330d8c9d8a2be0bb94b3d46c9345 (diff) | |
| download | opencode-bd2ec29b65e430f83f430db5fdc424c7d631989d.tar.gz opencode-bd2ec29b65e430f83f430db5fdc424c7d631989d.zip | |
add initial git support
Diffstat (limited to 'internal/llm/tools/tools.go')
| -rw-r--r-- | internal/llm/tools/tools.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/llm/tools/tools.go b/internal/llm/tools/tools.go index 6bb528686..473b787bb 100644 --- a/internal/llm/tools/tools.go +++ b/internal/llm/tools/tools.go @@ -17,6 +17,9 @@ type toolResponseType string const ( ToolResponseTypeText toolResponseType = "text" ToolResponseTypeImage toolResponseType = "image" + + SessionIDContextKey = "session_id" + MessageIDContextKey = "message_id" ) type ToolResponse struct { @@ -62,3 +65,15 @@ type BaseTool interface { Info() ToolInfo Run(ctx context.Context, params ToolCall) (ToolResponse, error) } + +func getContextValues(ctx context.Context) (string, string) { + sessionID := ctx.Value(SessionIDContextKey) + messageID := ctx.Value(MessageIDContextKey) + if sessionID == nil { + return "", "" + } + if messageID == nil { + return sessionID.(string), "" + } + return sessionID.(string), messageID.(string) +} |
