Make the dipping sauce: stir the sweet chili sauce and rice vinegar together in a small bowl, then fold in the diced cucumber, red onion, and peanuts if using. Set aside.
Process the fish: add the fish chunks to a food processor and pulse until a smooth, sticky paste forms, about 1 minute, scraping down the bowl once.
Season the paste: add the red curry paste, egg, fish sauce, and sugar; pulse 8-10 times until evenly mixed and pale salmon-pink.
Knead for the bounce: transfer the paste to a bowl and knead by hand for 2-3 minutes, slapping it against the bowl a few times. It should feel tacky and hold its shape.
Fold in the beans and lime leaves: stir the sliced long beans and kaffir lime leaf strips through the paste until evenly distributed.
Shape the cakes: with wet hands, scoop about 2 tablespoons of paste per cake and flatten into patties about 1/2 inch thick and 2 1/2 inches across. Makes about 12.
Heat the oil: pour oil 1/2 inch deep into a wide skillet and heat over medium-high until shimmering, about 350°F (175°C).
Fry in batches: fry 3-4 minutes per side until deeply golden brown with caramelized edges. Drain on a wire rack or paper-towel-lined plate. Serve hot with the dipping sauce.