mergeHookInstructions function

String? mergeHookInstructions(
  1. String? userInstructions,
  2. String? hookInstructions
)

Merges user-supplied custom instructions with hook-provided instructions.

Implementation

String? mergeHookInstructions(
  String? userInstructions,
  String? hookInstructions,
) {
  if (hookInstructions == null || hookInstructions.isEmpty) {
    return (userInstructions != null && userInstructions.isNotEmpty)
        ? userInstructions
        : null;
  }
  if (userInstructions == null || userInstructions.isEmpty) {
    return hookInstructions;
  }
  return '$userInstructions\n\n$hookInstructions';
}