joinPrompts concatenates two non-empty prompt fragments with a blank line, returning whichever is non-empty when the other isn't. Used by compactWithReason to splice pre_compact's additional_context into the caller's additionalPrompt without having to special-case empty strings at the callsite.
(a, b string)
| 1902 | // the caller's additionalPrompt without having to special-case empty |
| 1903 | // strings at the callsite. |
| 1904 | func joinPrompts(a, b string) string { |
| 1905 | switch { |
| 1906 | case a == "": |
| 1907 | return b |
| 1908 | case b == "": |
| 1909 | return a |
| 1910 | default: |
| 1911 | return a + "\n\n" + b |
| 1912 | } |
| 1913 | } |