fix(seahorse): handle json.Marshal errors in grep and expand tools

This commit is contained in:
程智超0668000959
2026-06-15 20:31:34 +08:00
parent cf67dd3851
commit ed55715b6b
2 changed files with 8 additions and 2 deletions
+4 -1
View File
@@ -124,6 +124,9 @@ func (t *ExpandTool) Execute(ctx context.Context, args map[string]any) *tools.To
"tokenCount": result.TokenCount,
"messages": messages,
}
data, _ := json.Marshal(output)
data, err := json.Marshal(output)
if err != nil {
return tools.ErrorResult(fmt.Sprintf("failed to marshal expand result: %v", err))
}
return tools.NewToolResult(string(data))
}
+4 -1
View File
@@ -167,6 +167,9 @@ func (t *GrepTool) Execute(ctx context.Context, args map[string]any) *tools.Tool
output["hint"] = result.Hint
}
data, _ := json.Marshal(output)
data, err := json.Marshal(output)
if err != nil {
return tools.ErrorResult(fmt.Sprintf("failed to marshal grep result: %v", err))
}
return tools.NewToolResult(string(data))
}