Commit f13bdde
Changed files (1)
cmd
del
cmd/del/main.go
@@ -1846,6 +1846,96 @@ func (d *Del) streamResponseChunks(ctx context.Context, text string) {
func (d *Del) buildOllamaTools() []api.Tool {
var tools []api.Tool
+ // === TEMPORARY: SINGLE TOOL FOR DEBUGGING ===
+ // Test with just one simple tool to see if that works
+
+ // list_dir tool only
+ listDirFunc := api.ToolFunction{
+ Name: "list_dir",
+ Description: "List directory contents",
+ }
+ listDirFunc.Parameters.Type = "object"
+ listDirFunc.Parameters.Required = []string{}
+ listDirFunc.Parameters.Properties = make(map[string]struct {
+ Type api.PropertyType `json:"type"`
+ Items any `json:"items,omitempty"`
+ Description string `json:"description"`
+ Enum []any `json:"enum,omitempty"`
+ })
+
+ // Helper function to create property
+ makeProperty := func(propType string, description string) struct {
+ Type api.PropertyType `json:"type"`
+ Items any `json:"items,omitempty"`
+ Description string `json:"description"`
+ Enum []any `json:"enum,omitempty"`
+ } {
+ return struct {
+ Type api.PropertyType `json:"type"`
+ Items any `json:"items,omitempty"`
+ Description string `json:"description"`
+ Enum []any `json:"enum,omitempty"`
+ }{
+ Type: api.PropertyType{propType},
+ Description: description,
+ }
+ }
+
+ listDirFunc.Parameters.Properties["path"] = makeProperty("string", "Path to the directory to list (defaults to current directory)")
+
+ tools = append(tools, api.Tool{
+ Type: "function",
+ Function: listDirFunc,
+ })
+
+ // Add memory tools for testing
+ // remember tool
+ rememberFunc := api.ToolFunction{
+ Name: "remember",
+ Description: "Store information in persistent memory",
+ }
+ rememberFunc.Parameters.Type = "object"
+ rememberFunc.Parameters.Required = []string{"content"}
+ rememberFunc.Parameters.Properties = make(map[string]struct {
+ Type api.PropertyType `json:"type"`
+ Items any `json:"items,omitempty"`
+ Description string `json:"description"`
+ Enum []any `json:"enum,omitempty"`
+ })
+ rememberFunc.Parameters.Properties["content"] = makeProperty("string", "Information to remember")
+
+ tools = append(tools, api.Tool{
+ Type: "function",
+ Function: rememberFunc,
+ })
+
+ // recall tool
+ recallFunc := api.ToolFunction{
+ Name: "recall",
+ Description: "Retrieve information from persistent memory",
+ }
+ recallFunc.Parameters.Type = "object"
+ recallFunc.Parameters.Required = []string{}
+ recallFunc.Parameters.Properties = make(map[string]struct {
+ Type api.PropertyType `json:"type"`
+ Items any `json:"items,omitempty"`
+ Description string `json:"description"`
+ Enum []any `json:"enum,omitempty"`
+ })
+ recallFunc.Parameters.Properties["query"] = makeProperty("string", "Optional search query to filter memories")
+
+ tools = append(tools, api.Tool{
+ Type: "function",
+ Function: recallFunc,
+ })
+
+ return tools
+}
+
+// Original buildOllamaTools function starts here (now unused)
+func (d *Del) buildOllamaToolsOriginal() []api.Tool {
+ var tools []api.Tool
+
// Helper function to create property
makeProperty := func(propType string, description string) struct {
Type api.PropertyType `json:"type"`
@@ -1924,6 +2014,10 @@ func (d *Del) buildOllamaTools() []api.Tool {
Function: runCommandFunc,
})
+ // === TEMPORARY: MINIMAL TOOL SET FOR DEBUGGING ===
+ // Reduced from 22 tools to 3 essential tools to fix hanging issue
+ return tools
+
// git_status tool
gitStatusFunc := api.ToolFunction{
Name: "git_status",
@@ -2529,29 +2623,11 @@ func (d *Del) processMessage(ctx context.Context, userInput string) {
// Add all tool results to history
d.chatHistory = append(d.chatHistory, toolResults...)
- // Get final AI response after tool execution (without tools to avoid confusion)
- d.updateThinking("๐ง Generating final response...")
-
- finalCtx, finalCancel := context.WithTimeout(ctx, 30*time.Second)
- defer finalCancel()
-
- var finalResponse string
- err = d.client.Chat(finalCtx, &api.ChatRequest{
- Model: d.model,
- Messages: d.chatHistory,
- // Don't include tools in final response to avoid infinite loops
- }, func(resp api.ChatResponse) error {
- finalResponse += resp.Message.Content
- return nil
- })
-
- if err == nil && finalResponse != "" {
- d.chatHistory = append(d.chatHistory, api.Message{Role: "assistant", Content: finalResponse})
- fullResponse = finalResponse
- } else if err != nil {
- // If final response fails, just show tool results
- fullResponse = "โ
Tool execution completed successfully."
- }
+ // === TEMPORARY: SKIP FINAL AI RESPONSE TO FIX HANGING ===
+ // The final AI response generation is causing hangs
+ // For now, just show that tool execution completed
+ d.updateThinking("โ
Skipping final response generation...")
+ fullResponse = "โ
Tool execution completed successfully."
}
d.stopThinking()